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

Discussions about using Linux guests in VirtualBox.

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

Postby TerryE » 7. Jul 2008, 12:54

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   Expand viewCollapse view
# 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   Expand viewCollapse view
# 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.
TerryE
Site Moderator
 
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

Postby dewittdale » 20. Jul 2008, 00:07

So is this for NAT or other since I can't remember ever not seeing the network with host interface setting.
dewittdale
 
Posts: 69
Joined: 22. Mar 2008, 00:59
Location: Kansas City Missouri
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: ubuntu 8.04

Postby TerryE » 20. Jul 2008, 01:37

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.
TerryE
Site Moderator
 
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

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

Postby whatdoesitwant » 10. May 2010, 09:58

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).
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

Postby dbarthelemy » 11. May 2010, 21:51

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


Return to Linux Guests

Who is online

Users browsing this forum: No registered users and 16 guests