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
10.88.12.4  dev.example.com 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 www.google.com
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 www.google.com
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.

59 comments:

  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.

    ReplyDelete
  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

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

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

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

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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

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

    ReplyDelete
  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!
    showboxdownloadsapp.com

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

    ReplyDelete
  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:- http://mcafeetechsupport.com/

    ReplyDelete
  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

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

    ReplyDelete
  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...
    jio.local.html

    ReplyDelete
  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.http://www.assignmentsynonym.eu/

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

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

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

    ReplyDelete
  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.. http://www.iphonetrackingapps.com/

    ReplyDelete
  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

    ReplyDelete
  23. Support for Gmail Mail
    Gold Standard Consulting provides industry leading technical support to home and business clients. Our techs are friendly, professional, well experienced and based in the US. We work with the goal to provide quick and efficient solutions to all your problems with the technology. Over the years of experience, we have met a lot of happy customers and have helped them with their computer and peripheral issues.We provide many services as mail technical support, support for gmail, yahoo mail technical support, Facebook customer care etc. Visit: http://consultgoldstandard.com/ For more information call us 775-557-6060

    ReplyDelete
  24. Nice Information about the virtul box my sincere thanks for sharing this post Please Continue to share this post
    Cloud Computing Training in Chennai

    ReplyDelete
  25. But glitches can occur in the best of devices too, HP is not being an exception. The top tech support services in USA should ensure that their technical team diagnosis any issue that users face with their HP devices and fix the problem in the shortest time. Mike Wallace

    ReplyDelete
  26. nice blog has been shared by you. before i read this blog i didn't have any knowledge about this but now i got some knowledge. so keep on sharing such kind of an interesting blogs.
    android training in chennai
    "

    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. Nice blog has been shared by you. before i read this blog i didn't have any knowledge about this but now i got some knowledge. McAfee Antivirus software then just go through the link here. Click Here:- McAfee Antivirus Helpline Number

    ReplyDelete
  29. "Very Nice Blog I Read Your Post Its Amazing It Is Very Interesting post Thank You For Post then just go through the click here :- Buying a Used Car


    "

    ReplyDelete
  30. Thanks for such a great information and to provide us. We have the finest Intuit certified technicians and If you're facing trouble in your QuickBooks accounting software then just go through the link here. Click Here:- QuickBooks Technical Support

    ReplyDelete
  31. this is the field where you can work with passion only as Monday to Friday shifts are common. But, sometimes you may have to work on weekends. http://www.techwarn.com/securepubads-g-doubleclick-net-how-to-remove-it/

    ReplyDelete
  32. Small Internet exchange points (IXPs) were also funded, allowing the large networks taking over NSFNet assets, as well as their own commercial Internets to connect and share Internet traffic.find my ip address

    ReplyDelete
  33. This article sums up all of the major features that should be mandatory when selecting a cloud backup solution.https://iturbu.com

    ReplyDelete
  34. Internet has become a major part of almost everyone's life that without it, we will surely face a hard time managing our work and enjoying our personal activities that require internet usage.http://www.electricalshop.net/

    ReplyDelete
  35. Welcome to MS office support service. We provide solution regarding MS office support number. Visit us to know more.

    ReplyDelete
  36. If you are facing any problem regarding the your laptop, just visit the given link to get your problem solved- 
    Dell Customer Support

    ReplyDelete
  37. Hi! This is my first visit to your blog! We are a collection of volunteers and Your blog provided us valuable information to work on. You have done a outstanding job! Acer Support

    ReplyDelete
  38. These services are provided by Lenovo to run their products efficiently. Toshiba Support

    ReplyDelete
  39. nice post I enjoyed it a lot keep sharing like this Epson Tech Support Number

    ReplyDelete
  40. Your blog posts are more interesting and impressive. I think there are many people like and visit it regularly, including me. I actually appreciate your own position and I will be sure to come back here. Yahoo Support Number

    ReplyDelete
  41. I like your post its very useful for me and I follow your all post .I am waiting for your next essential article. Chrome Customer Care

    ReplyDelete
  42. It's very informative Blog, it's more helpful to us thanks for sharing keep it up!!! Opera Tech Support

    ReplyDelete
  43. A grasping magnificently composed blog. Really a present for its gathering of people.
    jio broadband

    ReplyDelete
  44. This is amazing post i really like this interesting article the webhostingonedollar.com is one of the best way to create your own website.

    ReplyDelete