Created Mon Aug, 05 2019 at 10:33AM
Using Ubuntu's default network manager, ethernet connections by default will have a lower metric (impedance) than wifi connections. This is true even in Windows environments.
You can either delete the ethernet default route completely, or set the metric value higher for the ethernet connection thereby telling it to attempt to use the wifi connection first.
➜ ~ sudo route
[sudo] password for jaime:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 172.21.50.1 0.0.0.0 UG 100 0 0 eth1
default lokersrx.diss.l 0.0.0.0 UG 600 0 0 wlan0
link-local * 255.255.0.0 U 1000 0 0 eth1
172.21.50.0 * 255.255.255.0 U 100 0 0 eth1
172.21.70.0 * 255.255.255.0 U 600 0 0 wlan0
➜ ~ sudo route del default eth1
In my case just deleting the secondary default route attached to eth1 did the trick for me.
If you want to set the metric specifically:
# first delete the default route, making note of the interface and next hop IP address
ip route del default dev $IF
# now add route back in with new metric value
ip route add default via $nexthop dev $IF metric $new_metric