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

Discussions about using Linux guests in VirtualBox.
Post Reply
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

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

Post 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.
dewittdale
Posts: 69
Joined: 22. Mar 2008, 00:59
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: ubuntu 8.04
Location: Kansas City Missouri

Post by dewittdale »

So is this for NAT or other since I can't remember ever not seeing the network with host interface setting.
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Post 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.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
whatdoesitwant
Posts: 19
Joined: 9. Jul 2009, 14:19
Primary OS: MS Windows 8
VBox Version: PUEL
Guest OSses: Debian 7, Windows 8

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

Post 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).
dbarthelemy
Posts: 2
Joined: 10. May 2010, 13:35
Primary OS: Mac OS X Leopard
VBox Version: PUEL
Guest OSses: Ubuntu Server

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

Post 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:
Post Reply