script
1
2
3
4
5
# Install the ifmetric
sudo apt-get install ifmetric
# List the metric of interface
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.42.0.1 0.0.0.0 UG 100 0 0 eth0
0.0.0.0 10.42.0.2 0.0.0.0 UG 600 0 0 wlan0
1
2
3
4
5
# Set preferred interface with lower metric
sudo ifmetric wlan0 50
# List the metric of interface
route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.42.0.2 0.0.0.0 UG 50 0 0 wlan0
0.0.0.0 10.42.0.1 0.0.0.0 UG 100 0 0 eth0