20.04 server loses IP addresses on reboot

Asked by Mephi on 2020-04-13

I'm building a new server, and I thought I'd have a play with 20.04 Server as the OS with a plan to migrate everything over from the old 18.04 server.

I have an ansible playbook that logs into the server and sets everything up (new netplan file LXD configs, installs packages, etc.)

The server works fine at that point, but when I reboot the server it doesn't come up with a IP addresses. The bridge groups are defined as per the netplan file, but no Layer 3 stuff.

If I use the server terminal to run "sudo netplan apply" then it all comes up and starts working fine.

Any idea what's stopping my network interface addresses coming up? When it boots the terminal has a message about cloud-init, so I'm not sure if that could be screwing things up?

I've tried stopping the cloud init networking bits by creating the file at /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg but that doesn't seem to have helped.

Question information

Mephi (mephi-mephi) said : #1

On boot it looks like network I noticed following in syslog:
Apr 15 17:03:51 mephi-server systemd-networkd[794]: br0: Could not set route: Nexthop has invalid gateway. Network is unreachable
Apr 15 17:03:51 mephi-server systemd-networkd[794]: br0: Failed

But my ipv4 address and my gateway are within the same subnet.
My netplan file:

network:
    ethernets:
        enp4s0f0:
            dhcp4: false
        enp4s0f1:
            dhcp4: false
        enp4s0f2:
            dhcp4: false
        enp4s0f3:
            dhcp4: false
    bridges:
        br0:
            interfaces: [enp4s0f3]
            dhcp4: no
            dhcp6: no
            addresses:
            - 172.16.0.2/24
            gateway4: 172.16.0.254
            nameservers:
                addresses:
                - 172.16.0.254
                search: []
        br1:
            dhcp4: no
            dhcp6: no
        br107:
            dhcp4: no
            dhcp6: no
            interfaces: [vlan107]
    vlans:
        vlan107:
            id: 107
            link: enp4s0f3
            dhcp4: no
            dhcp6: no
    version: 2

More stuff from grepping syslog for networkd, in case it helps:
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br107: netdev ready
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br1: netdev ready
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br0: netdev ready
Apr 15 17:30:25 mephi-server systemd-networkd[798]: Enumeration completed
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br107: IPv6 successfully enabled
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br1: IPv6 successfully enabled
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br0: IPv6 successfully enabled
Apr 15 17:30:25 mephi-server systemd-networkd[798]: enp4s0f2: IPv6 successfully enabled
Apr 15 17:30:25 mephi-server systemd-networkd[798]: enp4s0f1: IPv6 successfully enabled
Apr 15 17:30:25 mephi-server systemd-networkd[798]: enp4s0f0: IPv6 successfully enabled
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br107: Link UP
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br107: Gained carrier
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br1: Link UP
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br1: Gained carrier
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br0: Link UP
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br0: Gained carrier
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br0: Lost carrier
Apr 15 17:30:25 mephi-server systemd-networkd[798]: vlan107: netdev ready
Apr 15 17:30:25 mephi-server systemd-networkd[798]: enp4s0f2: Link UP
Apr 15 17:30:25 mephi-server systemd-networkd[798]: enp4s0f1: Link UP
Apr 15 17:30:25 mephi-server systemd-networkd[798]: enp4s0f0: Link UP
Apr 15 17:30:25 mephi-server systemd-networkd[798]: enp4s0f3: Link UP
Apr 15 17:30:25 mephi-server systemd-networkd[798]: vlan107: Link UP
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br0: Could not set route: Nexthop has invalid gateway. Network is unreachable
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br0: Failed
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br1: Gained IPv6LL
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br107: Lost carrier
Apr 15 17:30:25 mephi-server systemd-networkd[798]: br107: Gained IPv6LL
Apr 15 17:30:25 mephi-server systemd[1]: Starting Dispatcher daemon for systemd-networkd...
Apr 15 17:30:26 mephi-server networkd-dispatcher[1129]: No valid path found for iwconfig
Apr 15 17:30:26 mephi-server systemd[1]: Started Dispatcher daemon for systemd-networkd.
Apr 15 17:30:27 mephi-server systemd-networkd[798]: enp4s0f3: Gained carrier
Apr 15 17:30:27 mephi-server systemd-networkd[798]: br0: Gained carrier
Apr 15 17:30:27 mephi-server systemd-networkd[798]: vlan107: Gained carrier
Apr 15 17:30:27 mephi-server systemd-networkd[798]: br107: Gained carrier
Apr 15 17:30:32 mephi-server networkd-dispatcher[1129]: WARNING:Unknown index 10 seen, reloading interface list
Apr 15 17:30:32 mephi-server systemd-networkd[798]: vethcb0d571e: Link UP
Apr 15 17:30:33 mephi-server systemd-networkd[798]: vethcb0d571e: Gained carrier
Apr 15 17:32:24 mephi-server systemd-networkd-wait-online[1036]: Event loop failed: Connection timed out
Apr 15 17:32:24 mephi-server systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Apr 15 17:32:24 mephi-server systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.

Mephi (mephi-mephi) said : #2

Oh, and I've apt purged cloud-init and the problem is still there, so I don't think it's a cloud-init issue

Mephi (mephi-mephi) said : #3

Right, I've been playing with my netplan files trying to narrow this down a bit and it seems to specifically relate to when an interface is in a bridge group.

The following config works:

network:
  ethernets:
    enp4s0f0:
      dhcp4: false
    enp4s0f1:
      dhcp4: false
    enp4s0f2:
      dhcp4: false
    enp4s0f3:
      dhcp4: false
      addresses: [ 172.16.0.2/24 ]
      gateway4: 172.16.0.254
      nameservers:
        addresses:
        - 172.16.0.254
        search: []

  bridges:
    br0:
      dhcp4: no
      dhcp6: no

  version: 2

The following config doesn't work:
network:
  ethernets:
    enp4s0f0:
      dhcp4: false
    enp4s0f1:
      dhcp4: false
    enp4s0f2:
      dhcp4: false
    enp4s0f3:
      dhcp4: false
      addresses: [ 172.16.0.2/24 ]
      gateway4: 172.16.0.254
      nameservers:
        addresses:
        - 172.16.0.254
        search: []

  bridges:
    br0:
      interfaces: [ enp4s0f3 ]
      dhcp4: no
      dhcp6: no

  version: 2

The only difference is the interface being included in br0

Can you help with this problem?

Provide an answer of your own, or ask Mephi for more information if necessary.

To post a message you must log in.