back | 2025-01-24
If you've ever cloned a Ubuntu Server VM on a DHCP network, you'll notice that they try to occupy the same address even though their MAC addresses are different. This guide explains how to resolve this conflict for Ubuntu Server versions 18.04–24.04.
dhcp-identifier
option to register itself with the DHCP server/var/lib/dbus/machine-id
and /etc/machine-id
To fix the issue, you can instruct Netplan to use MAC addresses instead of DUID.
Edit /etc/netplan/50-cloud-init.yaml
, and add dhcp-identifier: mac
:
network: ethernet: enp1s0: # This will vary by interface name dhcp4: true dhcp-identifier: mac # Add this line
Apply the configuration:
sudo netplan apply
Request a new address via DHCP:
sudo dhclient -r sudo dhclient
There are other solutions that will work. For example, you could edit the DUID at /etc/machine-id
to a unique value, preventing the conflict. However, the method in this guide works just as well.