Host-only Networking in VirtualBox

If difficulties arise trying to use the more functional bridged networking, host-only networking may work and allow you to connect the host to the virtual machine


Host-only Networking Description

With host-only networking, virtual box doesn't try to use a physical network adapter on the host. Instead in VirtualBox you can create one or more (up to 8) virtual adapters for connections between the host and virtual machines created in VirtualBox on the host.

A VirtualBox host-only adapter can also function as a DHCP server to assign ip addresses to VirtualBox virtual machines. The host machine (and other virtual machines if any) can then connect to the virtual machines using these ip addresses using ssh or sftp (provided an ssh server is running on the virtual machine).

This does mean virtual machines using host-only can't access the outside world, but in particular, the host should be able to use ssh to login to a virtual machine (with an ssh server running) and sftp to transfer files between the host and the virtual machine.

Setup requires

Select Host-only Adapter

After creating a virtual machine, you need to set up networking.

Open the Networking section for your virtual machine and enable Adapter 1 and select Host-only Adapter: and select a host-only adapter from the drop down list.

Now host-only networking has been setup and this virtual machine should be on the network attached to this adapter.

If the adapter is also setup to be a DHCP server, it will assign an ip address to the virtual machine when it runs.

(Under Advanced, click an Adapter type appropriate for the guest os that will be running in the virtual machine.)

If there are no host-only adapters listed, create one (see next section).

Check that the host-only adapter selected (or the one you create) is setup as a DHCP server (see next section).

Creating/Editing a host-only adapter

You should only have to do the following steps if

Where

Under the File menu in VirtualBox, select Preferences.

Then select Networking and click on the Host-only Networks tab:

This example shows 2 existing host-only networks. You may only see one or maybe even none.

The icons on the right margin let you

Add a new host-only adapter

Click on the icon to add a new host-only adapter:

You may need to confirm permission to create the adapter. Then a new entry should appear in the list of howt-only adapters:

To configure this host-only adapter, select it and click on the edit icon.

This dialog opens and VirtualBox will have assigned an ip address to the adapter:

Click on the DHCP Server tab and fill in the address entries. (They may all be 0.0.0.0 initially)

In the example

So as DHCP server, these settings could assign addresses to 10 virtual machines.

This host-only adapter can now be assigned to a virtual machine as above. It should appear in the drop down list of available host-only adapters.