Ubuntu eth0 missing after reboot.

ifconfig ubuntu outputI have seen this problem a lot on hyper-visors that use dynamic MAC addresses over the past few weeks, such as hyper-v.

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

reboot

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…

Technology enthusiastic with many ongoing online projects one of which is this personal blog PingBin. While also working full time within a data center designing and maintaining the network infrastructure.

4 comments On Ubuntu eth0 missing after reboot.

  • Thanks for provided this article,Thank you for sharing the report.I admire it very much.it is very useful for me.

  • Tom, thanks a lot. This helped me solve the problem of rebooting from a USB drive on a different machine (so the MAC address are different from last time). Appreciate your contribution.

  • Thanks, helped me 🙂

  • Thank you for your insight. I was wondering why my eth0 interface would not appear after creating a linked clone in VirtualBox. (I had chosen to reinitialize the MAC addresses when creating the clone, and that explains why it “disappeared”.)

Leave a reply:

Your email address will not be published.