Routing table incorrect at startup

12,501

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, set managed=false in /etc/NetworkManager/NetworkManager.conf

Share:
12,501

Related videos on Youtube

Jos
Author by

Jos

Updated on September 18, 2022

Comments

  • Jos
    Jos almost 2 years

    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?

    • Lety
      Lety about 10 years
      please, can you post the output of sudo route -n after startup and /etc/resolv.conf content?
    • Jos
      Jos about 10 years
      @Letizia I added the information to the question.
    • Jos
      Jos about 10 years
      @bain Yes! Thanks. There was a file in /etc/NetworkManager/system-connections/ describing the network connection that contained the wrong router address. I must have created this years ago when I still ran X on it and used the network interface. I thought all network information was taken from /etc/network/interfaces, but it appears I was wrong.
    • bain
      bain about 10 years
      /etc/network/interfaces is ignored if managed=true is set in /etc/NetworkManager/NetworkManager.conf (NetworkManager docs)
    • Jos
      Jos about 10 years
      @bain Thank you. I had indeed managed=true in NetworkManager.conf.