Your interface names such as eth0 are assigned to a physical interface, specifically the MAC address of that interface. So when your MAC address changes the system thinks it’s a new network card and assigns the next free name, lets say eth1.
However your network configuration file is still referring to the old name eth0. So basically you end up trying to apply configuration to a NIC that doesn’t exist, while there is a new NIC with no configuration. The ultimate result is you lose all network connectivity…
So how do you fix it? well there is a few ways depending on how much of a mess your in. However remember which ever method you use, ensure that once complete your no longer using dynamic MAC addresses and the below fix should be permanent.
1. Ok so you remember the original MAC address?
Hyper-V sometimes logs this in the job’s trail, so if you can find it that’s great, otherwise it’s going to get a bit more technical in option 2.
Power down the virtual machine and just apply a static MAC address to the interface using the original MAC, boot it back up and you should be on-line.
2. Don’t know what the old MAC was?
This one actually isn’t too hard, so I normally do this anyway.
Power on the virtual machine if its not already, make a backup of the following file.
sudo cp /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.backup
Now you have a backup, delete the file.
sudo rm /etc/udev/rules.d/70-persistent-net.rules
reboot the machine
So basically that just deleted all of the old MAC address to name (eht0) mappings, so when the system boots these should be correctly created again.
Don’t forget to do a final power off and set the NIC to static MAC’s, so you don’t end up with this problem again.
If you have no console access to the virtual machine or server, this can be risky!
3. Manually edit.
I am not going into it here, however you can try to manually update the above file you removed. However I find it easier just to let the OS do the work for you…