I have one two interfaces on one machine, one is the Internet connection that get its IP from a DHCP, no problem.

The other interface (eth1) is to local machines, and it has the gateway is set in its configuration file (Ubuntu based distro).

The problem is, that when i am bring the eth1 interface up, it automatically add a default ( route to the route table (as it should do), and i can't connect to the Internet, since it try to send the packets to the local network. Until now i have had to do it manually by deleting the default route with the gateway.

Is there a way to set that it wouldn't add a default route once i bring up the interface ? I am still need the gateway to stay in the configuration file since i have to have some specific route to the 3.x network.

Here is my route table:     *        U     0      0        0 eth1     *        U     0      0        0 eth0
default         UG    100    0        0 eth1
default         DD-WRT         UG    100    0        0 eth0

2 Answers 2


Don't declare as a gateway. Gateway pretty much means “default route”. If the address of the interface is within the network, then netmask is all you need.

If that's not the case, add whatever route you need as part of the interface setup script. On Debian/Ubuntu, put an up clause in /etc/network/interfaces, or add a script in /etc/network/if-up.d. The command to run is route add eth1 && route add -net gw

  • commented the gateway clause in the /etc/network/interfaces/ under the problem maker interface, and it worked.
    – Hanan N.
    Dec 18, 2011 at 0:01

Do a ip route list first and then check the same again on eth1 interface. Put the same thing into /etc/sysconfig/network-scripts/route-eth1 file to make everytime the interface is restarted, the route configuration from the interface file to be applied. On the other hand, if you want to execute something specifically for it, you could put in /etc/rc.d/init.dnetwork script to do it for you everytime the network is restarted, it would as well read the route-eth1 file and apply the route configuration.

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.