Wednesday, March 6, 2013

How to configure Virtual Box with internet and host access

I have had such a hard time locating the information I needed to get a VirtualBox VM to use both NAT and Host networks so that the VM could see the internet and the host could see the VM with a known IP address that I decided to write this post.

The configuration in this post is as follows:
·         Host O/S is Windows 7 (64 bit)
·         VirtualBox is version 4.2.6 r82870
·         Guest O/S is Oracle’s Enterprise Linux 5 (64 bit)
·         Guest has a web server installed and running.

To make this work requires the following steps:

Setup the Host Network Adapter in VirtualBox

1.       Start VirtualBox
2.       Select the File menu and Preferences
3.       On the left side, select Network

4.       In the network dialog, select the  to add a new host only network

5.       Follow the prompts for locating the driver for the new network. On my machine, the file is located at “C:\Program Files\Oracle\VirtualBox\drivers\network\netadp”
6.       Double click on the new adapter; “VirtualBox Host-Only Ethernet Adapter #3” in this example.

7.       Change the settings as shown here

8.       Select OK to close the Host-Only Network Details
9.    Select OK to close the VirtualBox – Settings dialog.

Set up the VirtualBox VM

1.       With the VM shutdown, select the Settings for the VM and open the Network dialog and set Adapter 1 as shown here and refresh the MAC Address. No Port Forwarding is required.

2.       Set Adapter 2 as seen here and refresh the MAC Address as well

3.       Select OK to close the settings dialog.
4.       Start the VirtualBox VM

Set the Network in the VirtualBox VM

1.       Log in as root
2.       Select System -> Administration -> Network

3.       It should look similar to the following

4.       Select the eth0 device and Edit. Verify that it looks like the following. If not then change it.
eth0 is set for DHCP

There are no static routes defined

and the hardware matches the VirtualBox Adapter 1 hardware and MAC address.

5.       Select OK to save any changes
6.       Select the eth1 device and Edit. Verify that it looks like the following. If not then change it.
Set the IP Address and Subnet mask

There are no static routes defined

and the hardware matches the VirtualBox Adapter 2 hardware and MAC address.

7.       Select OK to save the changes
8.       Add your new IP Address and host name to the hosts file

9.       Save and exit the network configuration
10.   Open a terminal and restart the network

11.   Restart the VirtualBox VM

Update the Windows Hosts File

1.       Edit the hosts file (c:\windows\system32\drivers\etc\hosts). Note that Windows hides the etc folder so you will need to either show all hidden folders or type the path in.
2.       To the hosts file add dev
3.       Save and close the host file.

Verify Virtualbox VM can reach the internet and itself

1.       When the VirtualBox VM is restarted, log in as a non-root user
2.       Start the web browser
3.       Verify internet connection by selecting a known site such as
4.       Verify the local web server by http://dev (or whatever your VirtualBox VM hostname is)

Verify the Windows Host can connect to the VirtualBox VM

1.       Open a web browser
2.       Verify internet connection by selecting a known site such as
3.       Verify the local web server by http://dev (or whatever your VirtualBox VM hostname is)

In this configuration, your host can access the VirtualBox VM and the VirtualBox VM can access the internet but the VirtualBox VM is not visible to others.


  1. Thank You very much. This helped. Now I can get my mom to try linux and maybe get her to install opensuse 13.1 as her default.

  2. Thanks for the post. I am trying it with VirtualBox 4.3 and the network adapter menus don't give the option to set up the IPs trough the GUI anymore :S

  3. Thank you very much. Can you please explain the difference between the ipaddress of the adapter to that is set on the guest I'm a newbie and don't have a good grasp on networking.

  4. Thanx for the post man it really help get our of the problem which i was suffering from last you

  5. Hi! what would i do if i need to connect to other PC but i don't have internet connection

  6. I need to internet connection to checkout files from the net that's why i need internet conenction in my VM...thanks

  7. Might be helfull vor Oracle VM virtual box # 4.3.30 still fighting to have internet connection
    from my guest WIN XP (32 bits)on my external HD. My host system is WIN 7 64 bits

  8. Making money on the Internet is not as hard as many people believe, because the only thing you need to start making money on the internet is to start an internet business. charge gmail username

  9. I have recently started a blog, the info you provide on this site has helped me greatly. Thanks for all of your time & work. dish internet

  10. I love smoothies and this one looks so yummy!

  11. And it is true! Landline phone services have been relegated to the past--it is Voice over Internet Protocol now (VoIP). You save on costs and save on time!

  12. I have configure $1 website hosting as the best web hosting. I visited this Blog thank you so much.

  13. Thanks for such a great information and to provide us. We have the finest I mcafee certified technicians and If you're facing trouble in your mcafee antivirus software then just go through the link here. Click Here:-

  14. Wow! I am amazed to read the content here on this site, i will come back for future posts. Also check out this cool similar site i found recently.
    the best carding forum

  15. Please check out my site as well and let me know what you think.
    the best carding forum

  16. I found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious...

  17. The use of internet nowadays has really upstaged all the habits in the world that we used to know. In fact, it already became a part of the daily routine for most people to the point that their day is incomplete without even checking their emails, updating Facebook status, browsing for the latest news and trends, or even playing a single online game. Indeed, it has greatly influenced today's lifestyles.

  18. are going to handover your device to that support provider thereby, you need to find the reliable support vendor.Techwitty

  19. The thinking and method of reasoning behind this online journals makes it a splendid read.IP checking - Ip address

  20. Even the words like appealing and captivating can't do full equity with regards to portraying this blog. Whois lookup

  21. There is a great deal of time and attendance tracking software available on the Internet and whether it's time and attendance tracking software or employee productivity software or employee time tracking software..

  22. Sometimes your hardware works well but technical problems may occur with software also. For this, the issues may be installation problem, virus attack, downloading issues, etc. Tor Guide