Host-only networking can be thought of as a hybrid between the bridged and internal networking modes. As with bridged networking, the virtual machines can talk to each other and the host as if they were connected through a physical Ethernet switch. As with internal networking, a physical networking interface need not be present, and the virtual machines cannot talk to the world outside the host since they are not connected to a physical networking interface.
When host-only networking is used, Oracle VM VirtualBox creates a new software interface on the host which then appears next to your existing network interfaces. In other words, whereas with bridged networking an existing physical interface is used to attach virtual machines to, with host-only networking a new loopback interface is created on the host. And whereas with internal networking, the traffic between the virtual machines cannot be seen, the traffic on the loopback interface on the host can be intercepted.
Host-only networking is particularly useful for preconfigured virtual appliances, where multiple virtual machines are shipped together and designed to cooperate. For example, one virtual machine may contain a web server and a second one a database, and since they are intended to talk to each other, the appliance can instruct Oracle VM VirtualBox to set up a host-only network for the two. A second, bridged, network would then connect the web server to the outside world to serve data to, but the outside world cannot connect to the database.
To enable a host-only network interface for a virtual machine, do either of the following:
-
Go to the Network page in the virtual machine's Settings dialog and select an Adapter tab. Ensure that the Enable Network Adapter check box is selected and choose Host-Only Adapter for the Attached To field.
-
On the command line, use VBoxManage modifyvm
"vmname
--nicx
hostonly. See Section 8.8, "VBoxManage modifyvm".
For host-only networking, as with internal networking, you may find the DHCP server useful that is built into Oracle VM VirtualBox. This is enabled by default and manages the IP addresses in the host-only network. Without the DHCP server you would need to configure all IP addresses statically.
-
In the VirtualBox Manager you can configure the DHCP server by choosing File, Host Network Manager. The Host Network Manager lists all host-only networks which are presently in use. Select the network name and then use the DHCP Server tab to configure DHCP server settings.
-
Alternatively, you can use the VBoxManage dhcpserver command. See Section 8.42, "VBoxManage dhcpserver".
Note
On Linux and Mac OS X hosts the number of host-only interfaces is limited to 128. There is no such limit for Oracle Solaris and Windows hosts.