Repro instructions: - (Enable systemd-networkd debug logging) - Start a server with its interface configured with DHCP - In the netplan config, configure the interface wtih static addressing, using the exact same address as it already has gotten from DHCP - Either wait for the initial DHCP lease time to expire, and observe that the interface loses its address; OR observe in the debug log that networkd applied the address with a lease time, even though you told netplan to use static addressing
Networkd config with static addressing: cat /run/systemd/network/10-netplan-ens3.network [Match] MACAddress=<redacted> [Network] LinkLocalAddressing=ipv6 Address=10.212.132.107/24 Gateway=10.212.132.1 DNS=8.8.8.8 DNS=8.8.4.4 Domains=<redacted> Networkd config with DHCP: cat /run/systemd/network/10-netplan-ens3.network [Match] MACAddress=<redacted> [Network] DHCP=ipv4 LinkLocalAddressing=ipv6 [DHCP] RouteMetric=100 UseMTU=true Debug log output from systemd-networkd when netplan tells it to apply static addressing when the interface already has an address from DHCP: Sep 30 10:36:15 nettest1 systemd[1]: Stopped Network Service. Sep 30 10:36:16 nettest1 systemd[1]: Starting Network Service... <snip> Sep 30 10:36:16 nettest1 systemd-networkd[6086]: ens3: Adding address: 10.212.132.107/24 (valid for 11h 52min 55s) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/1833193 Title: systemd-networkd fails to apply static IPv4 when the static IP is the same as previously configured by DHCP Status in systemd package in Ubuntu: New Bug description: In bionic, running systemd 237-3ubuntu10.22 and netplan.io 0.97-0ubuntu1~18.04.1, systemd-networkd fails to configure an interface with a static IPv4 address if the statically confiugred address is the same as the interface already has gotten from DHCP. This will cause the interface to loose its IP address when the DHCP lease exires, even though you've told netplan to configure it as static. I expect systemd-networkd to actually configure an IP address as static, regardless of what address the interface has before from DHCP. # lsb_release -rd Description: Ubuntu 18.04.2 LTS Release: 18.04 # apt-cache policy systemd systemd: Installed: 237-3ubuntu10.22 # apt-cache policy netplan.io netplan.io: Installed: 0.97-0ubuntu1~18.04.1 A paste of systemd-networkd's debug log when I run "netplan apply" and the interface already has the static IP configured from DHCP. It seems like upon a restart, systemd-networkd will allways add whatever IP config it had before the service stopped, and then apply changes (if any). Since my new config has the same IP as it already had, it does nothing even though the new config has static configuration. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1833193/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp