VirtualBox – Wireless Network in VirtualBox

12.04networkingservervirtualboxwireless

I just installed my first Ubuntu Server (12.04) instance and immediately ran into the following problems:

  • Running apt-get install or update fails (see below)
  • Running ifconfig produces peculiar IP addresses starting with 10.x.x.x and my router does not see the server at all in its "Attached Devices" page (its a consumer grade Netgear)

When I run apt-get I get 50+ of the following errors:

Failed to fetch <some-http-url>. Temporary failure resolving <blah>.ubuntu.com

I read up on this error for 12.04, and found some similar posts on this forum and on server fault that recommended going into /etc/resolv.conf and adding an entry:

nameserver 8.8.8.8

To my surprise, I found that /etc/resolv.conf was a symlink pointing to somewhere else and I had to delete it first, then create a new one with the entry indicated above.

I restarted the server and tried running apt-get again, same results.

How do I start diagnosing the problem (I'm a relatively new Linux/Ubuntu user)?

Additional details that may help:

  • This is actually a virtual machine running as a VirtualBox guest OS
  • The physical host that is running this VM is my laptop which has a wireless connection; I'm wondering if (somehow) the laptop is getting the network wirelessly, but perhaps either the VBox VM and/or the Ubuntu server OS isn't configured for wireless and so nothing is "getting through"?

Thanks in advance for any pointers!

Edit:

Here is a snapshot of my VM's Network settings (only Adapter 1 has any information populating its fields, so I assume my VM has only 1 adapter):

enter image description here

Here is the output when I run ifconfig from the terminal:

enter image description here

And here is the output when I run route from the terminal:

enter image description here

Running ping google.com:

enter image description here

Best Answer

To make it a short answer: It's a network issue.

The way I see the scenario is like this:

enter image description here

Now to correctly see where the problem is, in this case, we need to first check from the outer networks to the inner networks.

  1. Make sure the router has internet. You can use the same host or another device connected to it to check this.

  2. Make sure the Host has internet via the Router or any other source. To check simply send a ping to google.com for example like so: ping google.com.

If Point 1 and 2 are good (Your router is working great and has internet and your host has internet) then we proceed with the Guest and Virtualbox. It may be good to read how Wireless support is handled in VirtualBox by reading Wifi card on an virtualbox's ubuntu

We need to know the following information first:

  • There is no wireless connection inside the virtualbox environment. All "virtual" connections are in reference to cable/wired connected ones. So when you enable a Network card in your virtual guest, it is a virtual wired connection you are creating not a virtual wireless one.

  • The virtual connection from Host to Guest is independent of the type of connection your Host is connected to (Physically connected). If the host is connected via a wired or wireless connection, it does not matter or affect the virtual connection made from the Host to Guest because wired and wireless connections are used in the same way inside the Guest. Something similar to the following image:

    enter image description here

  • If your host does not have internet access, your guest will not have it. The same goes that if your host has internet access and your connection from Host to Guest permits sharing the internet, then the guest will most probably have internet also (Default behavior with Virtualbox).

  • I will be using Virtualbox 4.1.20 which looks different from the one you are using (Might be same, I do not know). I will add the network image just to help and show the differences:

    enter image description here

  • I will be using Ubuntu 12.04 as host and as Guest (This works the same in 12.10 or 13.04). In cases where Windows is the host you need to make sure the firewall is not blocking a particular port the guest will be using.

  • I assume that the Host is not using a proxy, just connected directly to the router via a wireless/wired connection.

  • The output from the Guest is the following with ifconfig and route:

    enter image description here

Now to the points you want to solve:

  1. Configure the network for the VM Ubuntu Server
  2. Get VM to connect to internet
  3. Get router to see the VM

Let me first mention that point 3 will be impossible unless the Virtualbox guess supports port forwarding. Your router will only see transfers made from your Guest as if they were transfers made from the actual Host. So without forwarding (Which is somewhat supported on the latest version) the router will never see the VM, only the Host.

There are of course ways to go around this like telling the host to forward stuff to the guest via the virtualbox engine. Or configuring (Easier I think) the guest for port forward. For example this:

enter image description here

So with this in mind we do the following in the Guest:

  1. Test if the guest has Internet access with the common ping google.com approach.

    If ping works then we know that an internet connection exists. The problem might be resolving the destination site.

  2. Try the following:

    /etc/init.d/network restart and/or dhclient

  3. Verify that /etc/network/interface is correct. My example would be:

    enter image description here

  4. Change the Adapter Type in the Network Options in the Virtualbox Configuration Window.

  5. Test out if the Ubuntu Desktop client or another OS works correctly. (Right now I only have the Desktop iso image of 12.10 and 12.04).

Related Question