I have a Ubuntu box that has two networking interfaces (eth0 and wlan0). They are both configured for DHCP in
/etc/network/interfaces, but they both assign a default gateway:
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp auto wlan0 iface wlan0 inet dhcp wireless-essid test
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 172.16.1.1 0.0.0.0 UG 100 0 0 wlan0 0.0.0.0 10.0.0.1 0.0.0.0 UG 100 0 0 eth0 10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 172.16.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
How can I set up
/etc/network/interfaces to have only one default gateway, on the interface I want?
Worst case scenario, how can I at least control which one gets on top on the
route -n command, each boot?
This box will travel a lot, and will be connected to different networks, so I don´t know in advance the IP addresses/ranges it will have.
Sometimes the default gw interface will be eth0. Sometimes it will be wlan0 ... So, this needs to be kind of automatic ...