Today's Question:  What does your personal desk look like?        GIVE A SHOUT

Create host only network on VirtualBox

  Pi Ke        2015-12-01 09:29:13       10,624        1    

Previously we showed how to install Ubuntu in VirtualBox. What if we want to communicate with the host OS from within the Guest OS on VirtualBox? There are a few ways to do this. For example, bridged network, Host only networks. Today we will show you how to enable network communication between host OS and guest OS using host only networks.

A host only network will not need to access the physical network interface of the host OS. It will create a network between different virtual machines and the host machine. This is very useful if you want to set up a network of machines which just need to communicate with each other. For example, when want to run tests of server-client applications.

To set up the host only network, you first need to create a host only adapter for virtual box so that it has a gateway to access all virtual machines created on the box. To create the host only network adapter, open VirtualBox, go to File -> Preferences... -> Network -> Host only networks.

On right side, click "Add host-only network", after a few seconds, you should see an adapter with name similar to "VirtualBox Host-Only Ethernet Adapter" created. 

Now you can click the adapter and start the setup wizard. At the Adapter tab, you will see the IPv4 address and IPv4 Network Mask. Use the default and no need to change the value here.

On tab DHCP Server, if you want your virtual machines to have a fixed range of IP addresses to choose, you may want to enable server and give the range of IPs you want. The Server Address must be in the same sub network as the adapter.

In this demo, we set the lowest allowed IP to be 192.168.56.101 and the highest allowed IP to be 192.168.56.255. Next, when you start a virtual machine, the IP address of the virtual machine will start at 192.168.56.101.

Click OK and complete the setup. Now we will enable Host only network for the virtual machine. Right click on one virtual machine and click Setting...->Network->Adapter 2.  Then do following.

Click OK. Now start the virtual machine, Then run ifconfig/ipconfig at the command line. You should see below.

On your host OS, you need to confirm that the host-only adapter has obtained the IP address 192.168.56.1. Otherwise, this IP is taken by other adapters and you need to resolve it first. Run ipconfig/ifconfig on host OS. You should see something similar to below.

Then ping the virtual machine at 192.168.56.101 from host OS, 

All done! 

VIRTUALBOX  NETWORK  VIRTUAL MACHINE  HOST-ONLY 

Share on Facebook  Share on Twitter  Share on Weibo  Share on Reddit 

  RELATED


  1 COMMENT


mohan.b02@gmail.com [Reply]@ 2016-05-12 13:34:58

Great! 

Very helpful article.