One of my Raspberry Pi’s runs Ubuntu Server 20.04 (Focal) and has a static IP interface configuration using systemd. The Pi is configured in the same way as in the previous post on this topic, “Linux interface config with systemd“.
The previous post describes how systemd can be configured for network interface IP configuration, instead of plain old interface files. One of issues I had while writing that post was that my host had a static IP and a second dynamic IP by DHCP. Even when DHCP was disabled in the systemd network config for that interface. On the Debian host mentioned in the post it was solved as described.
Now I’m using Ubuntu Server 20.04 (Focal). Out of the box buntu uses Netplan for IP configuration. Netplan is a YAML based frontend for IP interface config that passes the configuration to systemd or networkmanager.
Anyway, in my case I removed Netplan and cloud-init (which is fully support in vSphere 7 Update 3 by the way), simply because of not needing both. Afterwards I statically configured the IP adresses of my Ubuntu host with systemd using my post above and explicitly disabled dhcp there with the “DHCP=no” parameter. When the host came online after a reboot, the interface had static and dynamic (DHCP) assigned IPv4 address. Very much unwanted…
After digging into this issues it seemed that the default installed DHCP daemon, dhcpcd could cause this.
user@host:~$ dpkg -l | grep dhcp ii dhcpcd5 7.1.0-2build1 arm64 DHCPv4, IPv6RA and DHCPv6 client with IPv4LL support
The dhcpcd manpage describes an option to disable DHCP for certain interfaces with the denyinterfaces parameter in the /etc/dhcpcd.conf file. In my case the eth0 interface of my Pi
user@host:~$ cat /etc/dhcpcd.conf # A sample configuration for dhcpcd. # See dhcpcd.conf(5) for details. denyinterfaces eth0
After adding “denyinterfaces eth0” parameter to the dhcpcd.conf config file and reboot of the host, the second (dynamic) IPv4 address was finally gone.