Fix Missing eth0 When Cloning Ubuntu VMware Virtual Machines

by Chris on 25 July 2010

I ran into an annoyance trying to clone some Ubuntu LAMP virtual machines that I was using for website development. Every time I cloned the virtual machine, eth0 would go missing, and ifconfig would show only the loopback device, lo.

It turns out that when you clone a VMware virtual machine, the cloned virtual machine’s network interface gets a new MAC address (which, of course, it must to work on the same LAN). But Ubuntu, and many other Linux distributions, cache the old MAC address in a configuration file.

In Ubuntu, the file is /etc/udev/rules.d/70-persistent-net.rules. After cloning, it will contain a reference to the old network interface as eth0:

The easiest way to fix this problem is to simply delete the file. Ubuntu will regenerate it properly the next time it boots up.

sudo rm /etc/udev/rules.d/70-persistent-net.rules

After deleting the file, you need to reboot. After rebooting, ifconfig should show eth0 and everything should just work.

If you’re feeling less adventurous, you can rename the file to *.old so that you can restore it if something doesn’t work:

sudo mv /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.old

You can also edit the file to remove the old reference to eth0, and rename the new eth1 reference to eth0. But deleting the file and rebooting seems more convenient.

The relevant filename is slightly different in other Linux distributions. For example, in Debian, the filename is /etc/udev/rules.d/z25_persistent-net.rules.

{ 11 comments… read them below or add one }

Juan October 9, 2010 at 10:56 pm

I used your method to delete the file from my master VM. After shutting it down, I cloned from that state. Every clone would then generate its own udev rule on “first” boot.

Chris October 9, 2010 at 10:58 pm

@Juan: That’s quite a useful tip.

p_dude October 13, 2010 at 9:47 am

many thanks :)

Chris October 13, 2010 at 11:33 am

You’re welcome. :-)

Lee October 15, 2010 at 12:25 am

Thanks. this may be the only place on the web where this solution is noted.

kklo December 2, 2010 at 8:28 pm

I’ve added a link in my blog to this page.
There is an errata at file path, the full filename is /etc/udev/rules.d/70-persistent-net.rules

Another tip, if you also wish to change the hosname then edit /etc/hostname and /etc/hosts files and replace the old name wuth a new one.

Thanks a lot,

Chris December 3, 2010 at 11:07 pm

@kklo: Quite right about the filename. I can’t believe It’s been like that so long, and I hadn’t noticed. Now fixed. Thanks!

CyberDude April 15, 2011 at 5:58 pm

Thank you very much for the usefull tip. Its worked for me.

::jubilo::haku:: June 9, 2011 at 11:20 am

thanks a lot! great tip

Sathish November 1, 2011 at 11:21 am

Many Thanks.

I was baffled to see the eth0 and other interfaces gone when I copied the vmware image. This saved my day.

TJ November 28, 2011 at 10:41 pm

Ave!

Fantastyczna podpowiedź – zaoszczędziłeś mi tym wpisem mnóstwo żmudnej i mało ciekawej roboty polegającej na sprawdzaniu sieci na systemach gospodarza / gościa jak również samych ustawień VM.

Piękne Ci dzięki. No i super nazwa: “Orzeszek”. :-)

Leave a Comment

{ 2 trackbacks }