Home > network > VirtualBox: accessing the guest from the host

VirtualBox: accessing the guest from the host

In a VirtualBox guest machine I wanted to set up a web server for testing purposes. How to access the guest’s web server from the host?

In the guest’s network settings, normally you already have a NAT network adapter. This way the guest can access the Internet.

But how to establish a network communication between the host and the guest? In the guest’s network settings, select the tab “Adapter 2”. At home “Bridged Adapter” worked for me.

However, at my workplace “Bridged Adapter” didn’t work. After some research I wanted to try “Host-only Adapter”, but I ran into a difficulty. I couldn’t add a host-only adapter, I got the following error message: “no host-only network adapter selected”. And the GUI didn’t offer anything in the dropdown list :(


Fortunately I found the solution here. The image above was also borrowed from askubuntu.com.

For future references, I quote the steps here:

Probably, the virtual host-only network wasn’t set up yet. Here’s is how you can fix this:

  1. From the main menu, select File > Preferences (Ctrl+G) – NOT the settings of a single vm
  2. Select Network in the list on the left
  3. You should see an empty white box with “Host-only Networks” at the top. On the right, there are three buttons to manage them. Click the topmost one (with a green plus symbol). A new Host-only network will be created and added to the list.

Normally, the settings of the new network will be ok, but for completeness, I give the default values here. You can access the settings for the host-only network through the screwdriver button on the right.

  • Adapter:
    • IPv4 address:
    • IPv4 Network Mask:
  • DHCP server:
    • Enable server: checked
    • Server Address:
    • Server Mask:
    • Lower Address Bound:
    • Upper Address Bound:

You can change these settings to your liking, as long as they’re consistent.

Thanks to Bert Van Vreckem for this great answer.

Guest’s IP address
Executing “ifconfig” in the guest, you’ll get its IP address. Mine is under “eth1”, next to “inet addr:”. Try to ping the guest from the host and vice versa. They should work :)

Categories: network Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: