Fixing Networking Problems with a Cloned Linux VM

Often when cloning virtual Linux boxes (or using VMWare converter to deploy a virtual appliance) I find that the networking simply doesn't work. eth0 will exist but will not find a network even after checking and double checking /etc/networking/interfaces. The problem is that Linux has associated eth0 with the previous machines mac address for that interface.

/etc/udev/rules.d/70-persistent-net.rules (on ubuntu anyway)

This file will contain the associations such as...

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:36:xx:xx", ATTR{type}=="1", NAME="eth0"

# PCI device 0x1022:0x2000 (vmxnet)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:75:xx:xx", ATTR{type}=="1", NAME="eth1"

The first (eth0) will be from the original machine, and the second (currently eth1) is from the new VM.

To Fix

First stop udev and networking...

/etc/init.d/udev stop
/etc/init.d/networking stop

Edit /etc/udev/rules.d/70-persistent-net.rules, remove the original interface and rename the new interface from eth1 to eth0. Restart networking...

/etc/init.d/udev start
/etc/init.d/networking start

All being well, your Linux box should now have networking back

Hope this help

Chris

Author Chris Pont

Comments

xvision said:

I ran into the same issue with a cloned ubuntu image.

deleting /etc/udev/rules.d/70-persistent-net.rules and rebooting will install the correct configuration also..

25/Sep/2012 15:28 PM

Add Comment

Name
Comment
 

Your comment has been received and will be shown once it passes moderation.