I cloned an Ubuntu 20.04 VM and was frustrated to see both boxes kept getting the same DHCP IP address despite having different network MAC addresses. I finally found on this helpful post which states Ubuntu 20.04 uses systemd-networkd for DHCP leases which behaves differently than dhclient. As wickedchicken states,
systemd-networkduses a different method to generate the DUID than
dhclientby default uses the link-layer address while
systemd-networkduses the contents of
/etc/machine-id. Since the VMs were cloned, they have the same
machine-idand the DHCP server returns the same IP for both.
To fix, replace the contents of one or both of
/etc/machine-id. This can be anything, but deleting the file and running
systemd-machine-id-setupwill create a random
machine-idin the same way done on machine setup.
So my fix was to run the following on the cloned machine:
sudo rm /etc/machine-id
That did the trick!
For the systems that registered their hostnames under the wrong IPs, I had to take the following action for my Ubuntu 20.04 desktop as well as my Ubiquiti USG-Pro 4
Ubiquiti: Clear DHCP lease
clear dhcp lease ip <ip_address>
Ubuntu desktop: Flush DNS
sudo systemd-resolve --flush-caches