Why You May Need a VirtualBox Host-Only Adapter
What is a Virtual Network / Adapter?
Setting Up a Virtual Host-only Network
Adding a Host-Only Adapter to a Virtual Machine
Find and Test your Host-Only Network IP

Why You May Need a VirtualBox Host-Only Adaptervirtualbox150

Sometimes you would like to be able to network between your host machine and your guest machine. These networks can be used for many different reasons, such as transferring files between the host and the guest, or to network between multiple virtual machines running on the same host. Different tasks require different methods. This page discusses virtual network adapters and how to set up a host-only adapter to communicate between the guest machine and the host.

Click here for a quick-start reference guide.

What is a Virtual Network / Adapter?

When you use a virtual machine, you must set up virtual hardware to interact with the machine. For example, you expose some of your physical memory to act as virtual memory and you can expose folders to act as virtual drives. Similarly, we can provide the guest machine with a virtual network adapter so that it can access the internet through our host’s network adapter. There are different types of virtual network adapters, including:

  • Network Address Translation (NAT) Adapters: NAT adapters are the simplest form of network adapter. The NAT adapter will give access to your guest as if it were the host, making use of the same address. This is similar to having multiple computers on a home network, which communicate with each other using different addresses (eg. 192.168.1.11 and 192.168.1.15) and all communicate with the internet using the same address (eg. 172.119.27.80)
  • Bridged Adapters: Bridged adapters lets the guest simulate being a distinct node on the network. This means that a guest machine will communicate externally using a different address than the host (eg. 172.119.27.80 and 172.119.27.85). It is unlikely you can use this adapter on home networks as they typically only allow one external IP address.
  • Host-Only Adapters: Host-Only adapters (as described in this article) network the host and guest directly. Any other guests running on the host will also be connected. These adapters are an easy way to communicate between guests and experiment with networked machines.

Setting Up a Virtual Host-only Network

Before you can start to use host-only adapters you will need to configure a virtual network on the host for them to communicate through. On the main VirtualBox window, click File > Host Network Manager. If the list is empty, you will need to set up a new network. You can do this by pressing Create. Make sure to enable the DHCP Server by clicking the checkbox on the right side of the network details.

At this point, you can click Properties to see the network settings. The default values may be fine, but if the network does not work you can use these properties:

  • Adapter Tab:
    • Check Configure Adapter Manually
    • IPv4 Address: 192.168.56.1
    • IPv4 Network Mask: 255.255.255.0
    • You can leave the IPv6 fields unchanged / empty
  • DHCP Server Tab:
    • Make sure Enable Server is checked
    • Server Address: 192.168.56.100
    • Server Mask: 255.255.255.0
    • Lower Address Bound: 192.168.56.3
    • Upper Address Bound: 192.168.56.254
  • IMPORTANT: On windows the VirtualBox Host-Only Adapter may not immediately reflect these changes. It is recommended you either restart Windows or go into:
    Windows Control Panel -> Device Manager -> Network Adapters and disable and then enable the VirtualBox Host-Only Ethernet Adapter.

Adding a Host-Only Adapter to a Virtual Machine

Once you have set up the virtual host-only network you can add a new adapter to a Virtual Machine so that it can communicate over that network. You can set up each guest to communicate differently, so adapters are set up on a per-guest basis.

  • Click on the guest you would like to add the host-only adapter
  • Select Settings > Network
  • From here you will see four tabs, each representing a possible virtual network adapter. You may see one that says Attached To: NAT; this is the default NAT adapter which gives the machine access to the internet. If you would like the machine to access the internet, leave this adapter unchanged.
  • Add the Host-Only Adapter to the next available adapter, usually Adapter 2 tab.
    • Click Enable Network Adapter
    • Changed Attached to: drop down menu to Host-only Adapter
  • Click OK to save the settings.

Your host-only network should now be setup for use on the guest Virtual Machine.

Find and Test your Host-Only Network IP

Launch the Virtual Machine and (on a Linux guest) run the ifconfig command. The output will show the configuration of all the networks. You should see one that has an IP on the 192.168.56.x subnet that you defined for the host-only network. This will be the IP you can use to connect to that Virtual Machine from your host machine or from another guest.
For instance, if you are using one of our standard Virtual Machine images, you should now be able to ssh to the guest from your host:

  • On Windows using a tool like putty.
  • On Linux or Mac you can just use a terminal, eg: ssh student@192.168.56.3
  • On Windows using powershell, eg: ssh student@192.168.56.3