Page 1 of 2

Linux guest cloning - clones cannot get internet access

Posted: 9. Dec 2008, 22:15
by Mathiasdm
I'm running Ubuntu 8.10 (64-bit), and have a 32-bit Ubuntu Server guest (have been using it for a while, it's running Ubuntu 8.04) using hardware virtualisation.

Now I'd like to run multiple instances of this guest on the same pc. I used 'VBoxManage clonevdi' to create new HD images, and the new guest VM's boot fine. However, they don't get any internet access!

I've tried using different virtual interfaces, but it didn't work. I noticed the internal network interface changed to eth1 of 2 (changing on reboot) instead of eth0 like the original guest. So I tried to change '/etc/network/interfaces', followed by 'sudo /etc/init.d/networking restart', but without any luck.

Sadly, I don't know what to do :(

Posted: 9. Dec 2008, 23:22
by Sasquatch
What did you change in /etc/network/interfaces? What if you let it be how it was, remove everything that mentions an interface from /etc/udev/rules.d/70-persistent-net.rules and reboot? Your interfaces file should only have 4 lines of configuration, two for the loopback and two for the actual interface. Should look like this:

Code: Select all

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Posted: 9. Dec 2008, 23:30
by Mathiasdm
I have those 4 lines, I only changed eth0 to eth1.
Changing it back and restarting networking gives eth0: ERROR while getting interface flags: no such device.

Posted: 9. Dec 2008, 23:35
by Sasquatch
Did you change the udev rules file like I told you? It will look something like this:

Code: Select all

# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.

# PCI device 0x11ab:0x4362 (sky2)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="MAC", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x10de:0x0057 (forcedeth)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="MAC", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
And you need to make it like this:

Code: Select all

# This file was automatically generated by the /lib/udev/write_net_rules
# program run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single line.
Now there are no interfaces defined here. Reboot the Guest so udev will create a new one.

Posted: 10. Dec 2008, 02:07
by Mathiasdm
Sorry, I overlooked that.

I've removed them now, and after reboot one line was regenerated.
eth0 is now up, but there's still no connectivity.

(And thank you for your help!)

Posted: 10. Dec 2008, 02:19
by Sasquatch
Does the Guest have the IP of 10.0.2.15, as it should with NAT? Does your primary DNS server work on the Host? See the VirtualBox FAQ for some help getting your internet working.

Posted: 10. Dec 2008, 02:44
by Mathiasdm
Sasquatch wrote:Does the Guest have the IP of 10.0.2.15, as it should with NAT? Does your primary DNS server work on the Host? See the VirtualBox FAQ for some help getting your internet working.
It does not have a 10.0.2.15 IP, even though I've set the Virtualbox configuration to NAT.
The primary DNS server works on the host, and on other guests.
The Virtualbox FAQ seems to talk about not being able to access the internet from guests in general. However, I can access the internet fine from the original virtual machine, just not from the clone.

Posted: 10. Dec 2008, 18:40
by Sasquatch
What IP do you get in the Guest? Is there a configuration somewhere that tells the OS to use a different IP (like a static one)?

Posted: 10. Dec 2008, 20:26
by Mathiasdm
It doesn't have an IP (well, only an IPv6 one.

I haven't set it to have a static address at all.

Posted: 10. Dec 2008, 23:20
by Sasquatch
That's really strange. Run sudo dhclient eth0 from a terminal. What do you get for output? The interface is attached to NAT? Exact same settings as with the original VM?

Silly question?

Posted: 11. Dec 2008, 14:29
by shmuelakam
I have a silly question (because you didn't specify):

Are you running multiple clones at the same time?
If so, did you go into the Network settings (in the VB GUI) and generate a new MAC address? Using the same MAC for two VMs won't work. :shock:

Re: Silly question?

Posted: 12. Dec 2008, 00:11
by Sasquatch
shmuelakam wrote:I have a silly question (because you didn't specify):

Are you running multiple clones at the same time?
If so, did you go into the Network settings (in the VB GUI) and generate a new MAC address? Using the same MAC for two VMs won't work. :shock:
As you can see from the responses, a new interface was created, and that only happens when a new MAC is detected. A new MAC address is automatically generated when you create a VM. Cloning a VM is a bit more work than just cloning the VDI ;).
Bit silly question, but still a possible cause, were it not that was already covered.

Re: Silly question?

Posted: 12. Dec 2008, 00:47
by shmuelakam
Sasquatch wrote:As you can see from the responses, a new interface was created, and that only happens when a new MAC is detected. A new MAC address is automatically generated when you create a VM.
Well yes, but until a True Clone Feature comes along, I have been known to clone VMs "wholesale", VDI, settings and all. If you were running two VMs with the same MAC, both guest OS would still create a new interface, right? But the host would most likely be FOOBAR with regard to [at least] one of them.

Not quite as silly a question now, is it? :wink:

Re: Silly question?

Posted: 12. Dec 2008, 23:07
by Sasquatch
shmuelakam wrote:
Sasquatch wrote:As you can see from the responses, a new interface was created, and that only happens when a new MAC is detected. A new MAC address is automatically generated when you create a VM.
Well yes, but until a True Clone Feature comes along, I have been known to clone VMs "wholesale", VDI, settings and all. If you were running two VMs with the same MAC, both guest OS would still create a new interface, right? But the host would most likely be FOOBAR with regard to [at least] one of them.

Not quite as silly a question now, is it? :wink:
As I said before, the Guest assigned a new interface name. That only happens when the MAC is changed. And the TS didn't mention that.

Posted: 14. Dec 2008, 14:43
by Mathiasdm
Sasquatch wrote:That's really strange. Run sudo dhclient eth0 from a terminal. What do you get for output? The interface is attached to NAT? Exact same settings as with the original VM?
Yes, exactly the same settings. I can't give you the output, because I deleted the clone and decided to go with from-scratch VM's instead.
However, I'll create another clone, repeat my steps and then run that command to see the output. Might take me some time though.
shmuelakam wrote:I have a silly question (because you didn't specify):

Are you running multiple clones at the same time?
If so, did you go into the Network settings (in the VB GUI) and generate a new MAC address? Using the same MAC for two VMs won't work. :shock:
Yes, I did.