Default route lost on reboot
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 videos on Youtube
Steve Valliere
Updated on September 18, 2022Comments
-
Steve Valliere almost 2 years
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
-
Admin over 12 yearsPost a
route -v
output in your question plz. -
Admin over 12 yearsAnd /etc/network/interfaces
-
Admin over 12 yearsThis question appears to be abandoned, if you are experiencing a similar issue please ask a new question with details pertaining to your problem. If you feel this question is not abandoned, please flag the question explaining that. :)
-
-
Steve Valliere almost 12 yearsThanks! I wish I'd known about that back when I needed it. I'm not trying to belittle your reply, it is just that the problem went away after I went through the upgrade process to 12.04 -- with no change to my /etc/network/interfaces files. But if it returns, I'll definitely give this a try.