Fix Ubuntu 18.04 VM Guests All Getting The Same IP
For some reason, Ubuntu 18.04 is using a new "machine ID" concept instead of a MAC address for identifying itself to DHCP servers. KVM does not appear to set the machine ID to something new like it does with the MAC address when cloning guests. This means that if you clone an Ubuntu 18.04 instance that uses DHCP to get it's IP address, it and the clone will both get the same IP address, making your life "fun". The solution to this is to run the following commands in either VM and then rebooting, which results in the machine generating a new ID.
sudo truncate -s 0 /etc/machine-id && \ sudo rm /var/lib/dbus/machine-id && \ sudo ln -s /var/lib/dbus/machine-id /etc/machine-id
First published: 4th January 2019