How to let a VirtualBox guest (running Windows) access the Internet?

Setting Up NAT

NAT is not an option for Adapter Type. Rather, it's an option for Attached to.

Click where it currently says Bridged Adapter and you should be able to select NAT.

By the way, the reason changing it to NAT sometimes helps is not specific to Windows guests. Rather, if your physical (host) PC is on a LAN, Bridged Adapter (as well as NAT) usually works fine. If your physical PC has a network connection for just one computer--as is often the case if it's plugged directly into a cable/DSL/ISDN modem that only has one Ethernet port on it--then there is no local network to bridge to, so then you must use NAT.

If you use Bridged Adapter and your host machine is on a physical LAN, your guest machine will automatically be able to see and be seen by computers on the LAN. If you use NAT on a LAN, the guest machine will be able to see the other computers on the LAN but the other computers on the LAN (besides the virtualization host) will not be able to see it.

If you're interested in more details, see these articles on network bridging and network address translation.

If that works, great. Otherwise...

Check the Guest's Network Configuration

In the virtual machine, open the Network Connections configuration (from the Control Panel or in Start Menu > Settings). Unless you've manually configured multiple interfaces for the guest machines in VirtualBox (or have actual network adapters attached to it with USB forwarding), you'll see just one, and unless you've changed its name, it will be called Local Area Connection (perhaps with a number after it).

Right-click on that and click Properties.

guest machine, Windows XP Network Connections: this is the first place to click "Properties"

Under The connection uses the following items, click Internet Protocol (TCP/IP) and click Properties.

guest machine, Windows XP "Local Area Connection" showing protocols and services list

Make sure the configuration is correct.

For Bridged Connections

If you kept the VM's network adapter bridged in VirtualBox, rather than switching it to NAT, then it is as if there is a layer 2 network switch connecting three devices:

  • The virtual machine.
  • The physical host machine.
  • Whatever the physical host machine is connected to (on the particular host network adapter that was bridged). For example, if your computer is plugged into a router, it's like the switch is plugged into the router. If it's connected wirelessly to an access point, it's like the switch is a wireless bridge.

So, your VM is "networkologically" equivalent to your host machine. Whatever settings it has (except its IP address of course), your virtual machine should have.

For NAT Connections

If you selected NAT for Attached to in VirtualBox, then it's like your real computer is acting like a small home/office router. Your host machine runs a DHCP server that is accessible only to VirtualBox virtual machines, and the guest gets all its network configuration information from it.

The VirtualBox DHCP server will provide both an IP address and DNS information to the guest, so both of these two options should be selected:

  • Obtain an IP address automatically
  • Obtain DNS server address automatically

guest machine, Windows XP TCP/IP settings, General tab

This is the key.

This is the particular problem, for the system in this question. If this is the only problem with the configuration, then fixing this should solve the matter entirely.

You have manual settings, rather than DHCP.

That can work, but the manual settings would need to be correct, and you'd also want to make sure the IP was not in the range of IP addresses that your router assigns from (or there could be a collision with another device on the network).

In this case, the manual settings are not correct at all, because:

  1. The host machine's IP address on the network interface through which it provides an Internet connection to the guest is not the same as its IP address on the physical network. Even if your computer's IP address is 192.168.1.1 "in real life," the guest cannot access it that way.

    • More likely, if you set it up this way yourself, you may have been thinking that you should put your real-life home/office router's IP address (which is often 192.168.1.1) in as the default gateway and the primary DNS server.

    But the guest cannot directly access the physical NAT router on your desk (or wherever), because any data transmitted between the VM and the real router must go through the VM's router, and the VM's router is your computer (accessed through that special virtual network interface).

  2. Since the default gateway is wrong, no routing occurs and the VM cannot access any physical network devices outside your computer.

  3. Since the VM's IP address is outside the correct range (which is usually 10.2.2.*) and the subnet mask is 255.255.255.0, it cannot access the correct range. (The subnet mask is correct, but together with the IP it identifies the wrong subnet.)

  4. The DNS server must also be fixed or no hosts can be accessed through their domain names (like askubuntu.com).

If for some reason you need to use a "static IP," i.e., not use DHCP, then you'll have to get the correct information from VirtualBox and input it. Please let me know if you need help with that (I can expand this to include instructions).

Assuming DHCP is okay with you, you can solve the problem by making your Internet Protocol (TCP/IP Properties), General tab settings look like the screenshot above.

Still No Internet Connection? Time to Troubleshoot

It may help to gather some more information from the guest side. In the virtualized Windows XP system that is mysteriously not connecting to the Internet, install the VirtualBox guest additions (by clicking Devices > Install Guest Additions; see the manual for more information). Reboot, and see if you can connect to the Internet. If you cannot, you've still accomplished something useful, because now you can copy and paste between the guest and host clipboards.

So open the Command Prompt in Windows. One way to do that is to run:

Start > Run... > cmd.exe

Now run this command to get information about the Windows guest system's network interfaces and connections.

ipconfig /all

Then copy all the text in the command prompt to the clipboard. This functionality is accessible in the contextual menu raised by right-clicking anywhere inside the command prompt window. You can then edit your question on your Ubuntu host system where you have a working Internet connection, and paste it in.

  • More generally, for people other than the asker of this question:

    You can then paste it into applications in your Ubuntu host system, permitting you to refer to it when your Windows VM is suspended/off. You can provide it to whoever is trying to help you. You can include it in your own question here on Ask Ubuntu

    (However, if your network problem is in the virtual installation, rather than the virtual hardware or the VirtualBox software--for example, if your VM accessed the Internet fine until you installed some Windows software other than the guest additions--then your problem would likely be considered off- topic for Ask Ubuntu. It would likely be on-topic for Super User though.)


This solution has worked just perfectly for me (Host OS: Ubuntu 14.04; Guest OS: Windows XP SP3):

Select "PCnet-PCI II (Am79C970A)" at 'NAT'->'Advanced'->'Adapter Type'.


NAT is in the Attached to drop-down list.

The adapter type is advanced and does not have to be changed in most cases..

Bridged should work fine too, but you have to adjust the network interface. Name has to be set to your internet interface on your host machine (very likely wlan for wireless, eth for ethernet).