Page 1 of 1

[Solved]: Network stops working after a CloneVDI / VM

Posted: 7. Jul 2008, 12:54
by TerryE
I cloned an Ubuntu machine, and I've come across this "feature" before, but doing this fix prompted me to raise this note just in case anyone else has this problem.

A feature of all Debian derivative OSs including Ubuntu is that it uses the udev to build the /dev tree during bootup. See man udev for more details. udev uses the files in /etc/udev/rules.d/ to tell it how to build the device tree. The file that we're interested in is 70-persistent-net.rules. When you first configure your VM, a MAC address is generate, say 08:00:27:12:34:56, and the following lines get automatically added to the file during the first boot sequence:

Code: Select all

# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:12:34:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
So you now clone your Image, register it, create a new VM and set the VM's disk to be the clone. However the new VM now has a different MAC address , say 08:00:27:23:45:67, so the first time you boot this "new" NIC card gets added to the list:

Code: Select all

# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:12:34:56", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:23:45:67", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
The only trouble with this is that the VM is presenting 08:00:27:23:45:67 as the first NIC so udev gets confused and when your machine boots you end up with no network visible.

The solution is to edit this file (in sudo) to delete the first entry and rename the second to eth0. You'll find that eth0 is then recognised properly on reboot.

Posted: 20. Jul 2008, 00:07
by dewittdale
So is this for NAT or other since I can't remember ever not seeing the network with host interface setting.

Posted: 20. Jul 2008, 01:37
by TerryE
Yes this is primarily for NAT but you get this latching problem whenever you allow VBox to auto-generate a new NIC address.

Re: [Solved]: Network stops working after a CloneVDI / VM

Posted: 10. May 2010, 09:58
by whatdoesitwant
Thank you. I confirmed this solution for an Ubuntu server 9.10 guest, both in nat and bridged mode. Don't forget to use sudo and make sure to disable the other 3 network adapters in the (external) virtualbox settings to be safe, or adjust the settings for each of these accordingly as well in 70-persistent-net.rules. With regard to the (external) virtualbox settings, you have to let virtualbox generate the mac-addresses. Manually setting them causes a freeze (VirtualBox 3.1.6).

Re: [Solved]: Network stops working after a CloneVDI / VM

Posted: 11. May 2010, 21:51
by dbarthelemy
Thanks a lot... I spent almost one day with exactly the same problem but I was thinking of a host issue... not a guest one. :mrgreen: