After cloning a Debian/Ubuntu VM, the guest network is not working

When trying to bring up the interface I get the following error messages:

Reconfiguring network interfaces...SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
SIOCSIFNETMASK: No such device
SIOCSIFBRADDR: No such device
eth0: ERROR while getting interface flags: No such device
eth0: ERROR while getting interface flags: No such device
Failed to bring up eth0.
done.


This happens because when cloning a VM it will get a new UUID and MAC address. Debian stores the MAC address that it expects the interface to have in a file. If the mac address changes, it will no longer recognize the old NIC.
The solution is to delete the file /etc/udev/rules.d/rules.d/z25_persistent-net.rules (ubuntu: /etc/udev/rules.d/70-persistent-net.rules) and reboot the VM. This file will then be recreated with the new info.

If you change the NIC of a physical machine running debian, you will also have this exact same issue.