This is my routing table when I connect my Android phone via USB to my Raspberry and enable USB-tethering.
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.42.129 0.0.0.0 UG 204 0 0 usb0
0.0.0.0 192.168.0.1 0.0.0.0 UG 303 0 0 wlan0
192.168.0.0 0.0.0.0 255.255.255.0 U 303 0 0 wlan0
192.168.42.0 0.0.0.0 255.255.255.0 U 204 0 0 usb0
I want wlan0
to be the preferred interface.
So how can I change the metric of one the interfaces permanently?
Also how does Linux decide which metric value it will use for an interface?