Cloning Linux guests on Hyper-V

Most of the current linux distros use UDEV to map NIC to names (like eth0), that is based on MAC or PCI Ids. When you clone a virtual machine in Hyper-V, you’ll get a new PCI ID and MAC Address, so a new name will be assigned.

The easy way to fix this issue is editing /etc/udev/rules.d/z25_persistent-net.rules
Original (Debian 4.0):
SUBSYSTEM=="net", DRIVERS="?*", ATTR{address}=="00:11:22:33:44:55", NAME="eth0"
SUBSYSTEM=="net", DRIVERS="?*", ATTR{address}=="00:11:22:33:44:56", NAME="eth1"

Edited:
<remove first entry>
SUBSYSTEM=="net", DRIVERS="?*", ATTR{address}=="00:11:22:33:44:56", NAME="eth0"
So MAC ending in :55 was the NIC in the original install, and the one ending in :56 is the NIC on the cloned VM; now mapped to eth0 as one could expect.

Advertisements