Ubuntu – Change default route to DHCP interface without a route push

routeUbuntu

How can I change the default route to utilize eth1 (DHCP), instead of eth0 (static)? I want this to be a permanent solution persistent through reboots.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         RT-C0C1C0CF879F 0.0.0.0         UG    100    0        0 eth0
10.0.0.0        *               255.255.255.0   U     0      0        0 eth0
1.1.1.0         *               255.255.240.0   U     0      0        0 eth1

I want the direct route (eth1) to be default, not through the NAT.

Using Ubuntu 12.04

Best Answer

I found the answer in: http://xmodulo.com/2012/03/how-to-set-default-route-in-linux.html


Removing any unnecessary default route leveraging post-up command in /etc/network/interfaces as follows. This will enable default route through eth0

$ sudo vi /etc/network/interfaces

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet dhcp
post-up route del default dev $IFACE
Related Topic