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         UG    100    0        0 eth0        *        U     0      0        0 eth0         *        U     0      0        0 eth1

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

Using Ubuntu 12.04


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
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.