Linux guest cloning - clones cannot get internet access

Discussions about using Linux guests in VirtualBox.
Mathiasdm
Posts: 6
Joined: 20. Jun 2008, 11:06

Linux guest cloning - clones cannot get internet access

Post 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 :(
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post 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
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Mathiasdm
Posts: 6
Joined: 20. Jun 2008, 11:06

Post 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.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Mathiasdm
Posts: 6
Joined: 20. Jun 2008, 11:06

Post 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!)
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Mathiasdm
Posts: 6
Joined: 20. Jun 2008, 11:06

Post 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.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post 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)?
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Mathiasdm
Posts: 6
Joined: 20. Jun 2008, 11:06

Post 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.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Post 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?
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
shmuelakam
Posts: 9
Joined: 11. Sep 2008, 09:46
Location: Israel

Silly question?

Post 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:
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Silly question?

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
shmuelakam
Posts: 9
Joined: 11. Sep 2008, 09:46
Location: Israel

Re: Silly question?

Post 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:
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Silly question?

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Mathiasdm
Posts: 6
Joined: 20. Jun 2008, 11:06

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