Whenever I reboot my Ubuntu server, the routing table is incorrect for the default route. The routing table correctly specifies the LAN IP address 192.168.124.0/24. All other traffic should go through the router at 192.168.124.253, but the default route specifies 192.168.124.254 for the gateway:
jos@hallway:~$ ip route list
default via 192.168.124.254 dev eth1 proto static
192.168.124.0/24 dev eth1 proto kernel scope link src 192.168.124.101
and similarly:
jos@hallway:~$ sudo route -n
[sudo] password for jos:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.124.254 0.0.0.0 UG 0 0 0 eth1
192.168.124.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
I have to manually correct this to .253, using:
sudo ip route del default
sudo ip route add default via 192.168.124.253
Otherwise, the server won't be able to reach the Internet.
Where does this .254 come from? It is not in my /etc/network/interfaces, or anywhere in /etc/iproute2. The server has a single ethernet interface with a static address. My /etc/network/interfaces is simply this:
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet static
address 192.168.124.101
netmask 255.255.255.0
gateway 192.168.124.253
dns-nameservers 192.168.124.253 8.8.8.8 8.8.4.4
My /etc/resolv.conf:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.124.253
nameserver 192.168.124.253
nameserver 8.8.8.8
nameserver 8.8.4.4
So what is going on here?
NetworkManager is still configuring the interface because
managed=true
is set in/etc/NetworkManager/NetworkManager.conf
To disable NetworkManager and instead use
/etc/network/interfaces
, setmanaged=false
in/etc/NetworkManager/NetworkManager.conf