Overcome libvirt problem of Ubuntu guests having same IP after cloning

After cloning the Ubuntu guest, the clone will have the same IP.
To overcome this I found 3 ways:

  1. On Ubuntu guest change /etc/machine-id and restart
  2. Edit /etc/dhcpcd.conf and change from:
    duid
    to:
    clientid
    and reboot:
    reboot
  3. Edit netplan config file, usually it is located at /etc/netplan/50-cloud-init.yaml and add dhcp-identifier: mac under network.ethernets.{{your_interface}} like this:
    network:
      version: 2
      ethernets:
        enp1s0:
          dhcp4: true
          dhcp-identifier: mac
    Apply the changes:
    netplan apply