Ubuntu – Default route lost on reboot

11.10networking

After upgrading to 11.10, my system is "forgetting" the default route to the internet every time the machine gets rebooted. It "remembers" the route to the office (on a second NIC). In my /etc/network/interfaces file I have both NICs configured as static and specify the IP, netmask AND gateway for each. But the gateway for the external NIC is no longer being set at boot time (though it worked perfectly in 11.04).

I'm wondering if it might be related to the "waiting for network configuration" problem that I and others seen. Either way, I need a solution or at least a work-around.

As requested… route -v (after I manually added the eth1 default gateway, of course — to see it before, imagine the eth1 gateway line missing):

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         216.199.48.57.n 0.0.0.0         UG    0      0        0 eth1
default         192.168.42.1    0.0.0.0         UG    100    0        0 eth0
192.168.42.0    *               255.255.255.0   U     0      0        0 eth0
216.199.48.56   *               255.255.255.248 U     0      0        0 eth1

/etc/network/interfaces:

# The loopback network interface
auto lo
iface lo inet loopback

# Office network
auto eth0
iface eth0 inet static
        address 192.168.42.4
        netmask 255.255.255.0
        gateway 192.168.42.1

# Internet
auto eth1
iface eth1 inet static
        address 216.199.48.58
        netmask 255.255.255.248
        gateway 216.199.48.57

Best Answer

  • By definition "Default" is a unique entity. The "gateway" statement sets the Default Gateway, thus is must be unique inside the file. This scenario requires you set a static route to your private network. Replace the eth0 gateway line with up route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.42.1.

    # Office network
    auto eth0
    iface eth0 inet static
            address 192.168.42.4
            netmask 255.255.255.0
            up route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.42.1
    
  • Related Question