Using VirtualBox.

There's two Virtual Machines, Ubuntu 10.04 and Windows 7.

On Ubuntu:

There's two ethernet interfaces.

  • Bridge interface (eth0) who can access the internet. ping www.google.com works ok.
  • NAT interface (eth1) configured as Internal Network who have ip, netmask and gateway who can ping Windows 7 in

On Windows

  • A interface who have ip and can ping Linux in ok, but can't ping www.google.com.

So, how can I configure Windows to have access to the internet using my Linux machine?

  • Can you ping from Windows? If so, you just need a DNS server set in windows. Do you have a DHCP server running on the Ubuntu VM, or are the addresses on eth1 and windows static?
    – Azendale
    Oct 8, 2011 at 16:09
  • Pingin I got Request timed out. I dont have a DHCP server running on Ubuntu. The Ubuntu in eth1 and Windows in its interface are static. Thanks about the suggestion.
    – GarouDan
    Oct 8, 2011 at 16:37
  • So, your problem is not not having a DHCP server then. If you get addresses with DHCP, then a DNS server is automatically set up. If you do not have a DNS server, then pinging google.com will not work since you cannot find what address it points to. Getting Request timed out on the actual address means you need to set up the Ubuntu VM to share the connection. (Luis Alvarado's answer should tell you how to do this)
    – Azendale
    Oct 8, 2011 at 18:00

1 Answer 1


Ok it works like this, when you are INSIDE the virtual environment just forget about virtualbox. Assumming you have the following setup, it should all work out:

MAIN HOST (The one where you are running virtualbox with both guess insides) - It should have an internet access. Does not matter if it through a proxy, inside an intranet or a normal connection to your ISP. It should have access to the internet.

VIRTUALBOX - VIRTUAL HOST (UBUNTU) - It should have one network connection to your MAIN HOST which provides internet and one network connection (Called by default Internal Network) which we will use to share the connection. It should be noted that after finishing the whole sharing explanation this can also work if the HOST is Windows.

VIRTUALBOX - VIRTUAL GUEST (WINDOWS) - It should have one network connection to the "Internal Network".

With all of this setup in that specific way you can do the following:


  1. In your Ubuntu 10.04 go to Connection Indicator in the Panel (Network Manager Applet)
  2. Go to Edit Connections.
  3. Select your INTERNAL NETWORK interface (Since you will see 2, example eth0 and eth1. One of them is the internal one that connects to the rest of the virtual guests and the other one connects to your MAIN HOST) and open it.
  4. Go to IPv4 Settings and in the Method field select "Shared with Other Computers".
  5. Apply and you are done with the VIRTUAL HOST (Ubuntu). Now for the VIRTUAL GUEST (Windows).

NOTE - Some people might suggest a little more complicated iptables, masquerade console commands. There is no need for this since (I think) Ubuntu 9.04 or higher. Since the Network Manager updated itself several years ago everything from Modem, Cellphones and shared wifi connections has been easier than ever.


Go to the "Network Manager" in Windows and select the only connection you have. Go to the Ipv4 TCP Protocol and verify that it has the IP set to Dynamic/Auto. It should now see the connection from the ubuntu box. IF by any case it does not work, since you have Windows 7 which includes a pretty nifty way of checking for internet acces you should run this tool from the network manager in windows and make it look for the internet. in this same manner I have made around 50 setups for windows xp, windows vista and windows 7. Most of which are for windows 7. So I might be going out of a limb here but for 50 tests am pretty sure this will work ^^.

NOTE - There is actually no need for a DHCP Server like in Ubuntu server to share. There is also no need for a DNS server in windows. The default setup that comes in ubuntu and windows can deal with a simple task like this. The thing to remember here is that, when inside the virtual environment just forget about the host. Imagine yourself in a lan party with 2 PCs which one has an internet connection and another connection to the lan and the other PC wants to have internet shared to. Eliminating the association between the virtual place and the real place (MAIN HOST) helps in solving several network problems.

NOTE 2 - Additional you NEED (Let me rephrase that, YOU REALLY REALLY!!! NEED) to use the version from VirtualBox and the Extension of Virtualbox to have everything working as it should. The latest version up to this moment which is the 4.1.4 version which came on October 3rd has many problems solved and since version 4.1.2 I can vouch that the horrible problems about random mouse movement and sharing virtual folders is gone.

The latest version can be found here: https://www.virtualbox.org/wiki/Linux_Downloads

And the extension for the latest here: https://www.virtualbox.org/wiki/Downloads

Why am I making such a big fuss over using the Virtualbox from the site and not a PPA or the OSE version. Because first Virtualbox will add after installing the package (Just double click it after downloading it) the ppa or repo to get the latest updates. Second the OSE has many less features than the one in the webpage (This difference started from when innotek was the main company and in those days OSE and virtualbox normal were the same). Now the virtualbox from the main page has way too many more things. Also many PPA out there are obsolete or not updated so fast as the main repo from virtualbox.

NOTE 3 - Since Virtualbox 4.1.4 there is no need to download the extension again. Virtualbox will automatically check to see if the extension is compatible or up to date with the latest version installed. But you still need to install it if you haven't yet done so. At least the first time. After that there is no more need to do it.

  • 1
    I would point out that "Shared with Other Computers" actually uses iptables and masquerade, and it sets up a DHCP server. However, it does it all for you, which makes it much easier. Windows doesn't need a DNS server running on it, but it needs one set, either by DHCP or manually, to look up names like google.com
    – Azendale
    Oct 8, 2011 at 18:05
  • Thanks you so much. Worked here. Really very simple... Thanks, aprecciate your time.
    – GarouDan
    Oct 8, 2011 at 18:47
  • 1
    Should be noted that what Azendale mentions is correct. But in the point about iptables it saves the time of doing it and the knowledge for it (iptables is really easy anyway once you get to using it) and the second part about windows is also VERY correct ^^. +1 for a nice add. Oct 8, 2011 at 19:42
  • 1
    Great answer, but I think that you get the OSE thing backwards. When VirtualBox was a Innotek thing, there were two VBox versions, an OSE (Open Source Edition) with less features and a closed source one with more. Now, there is only one open source version, there is no difference between the OSE and the VBox that you can download from Innotek page. They are the same, open sourced, and licensed under GPL v2. The extra-features have been moved to the closed source extension pack. You can check it from their downloads page(virtualbox.org/wiki/Downloads) Oct 10, 2011 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.