Oracle Virtualbox

Configure Host-Only Networking in Oracle VirtualBox

Learn how to configure VirtualBox host-only networking for host-to-guest and isolated guest-to-guest communication, including IP addressing and multi-VM designs.

Host-only networking creates a private virtual network shared by the host computer and selected virtual machines. It is useful for labs, private service networks, multi-VM appliances, and host-to-guest administration.

Guests attached to the same host-only network can communicate with one another. The host can also communicate with those guests through a software network interface called a host-only interface. Host-only networking alone does not provide direct access to a physical LAN or the Internet.

How Host-Only Networking Works

VirtualBox creates a software network interface on the host operating system. This interface is the host-side connection to the private network. In VirtualBox Manager, a VM's virtual network adapter can be attached to that host-only network by selecting Host-only Adapter.

Every guest adapter attached to the same host-only adapter joins the same private Layer 2 network. The host-side interface is also a member of that network, so traffic can flow between the host and guests and between participating guests.

  • Host-only interface: The software-created network interface on the host.
  • Virtual network adapter: A configurable virtual network device assigned to a VM.
  • Host-only Adapter: The VirtualBox attachment option that connects a VM adapter to a selected host-only network.

The host-side interface and the adapter configured inside a guest are different devices. Both must be present and correctly configured for communication to work.

Host-Only Compared with Other Network Modes

ModeGuest-to-host communicationGuest-to-guest communicationPhysical LAN or Internet accessHost interface usedTypical use case
Host-only AdapterYes, through the host-only interfaceYes, when guests use the same host-only adapterNot by itselfVirtualBox-created host-only interfacePrivate labs, administration, and backend networks
Bridged AdapterUsually, through the physical networkUsually, through the physical networkYes, subject to the physical networkExisting physical host interfaceMaking a guest appear on an existing LAN
Internal NetworkNo host access through that networkYes, for guests using the same internal network nameNoNo host-side interface for guest trafficGuest-only isolated networks

Bridged networking attaches a guest to an existing host network interface and the physical network behind it. The guest may receive an address from the physical LAN and can be visible to other systems on that LAN.

Internal networking also isolates guests from external networks, but it is guest-to-guest only through that network. The host does not participate in the internal network as it does with host-only networking.

Host-only traffic is visible on the host-side virtual interface. This makes that interface useful for inspecting addresses, testing connectivity, and observing traffic with suitable host operating-system tools.

Configure an Existing VM in VirtualBox Manager

  1. Open Oracle VM VirtualBox Manager.
  2. Select the target virtual machine.
  3. Open the VM's Settings dialog.
  4. Open the Network section.
  5. Choose the adapter slot you want to configure, such as Adapter 1 or Adapter 2.
  6. Enable Enable Network Adapter.
  7. Set Attached to to Host-only Adapter.
  8. Use the Name field to select the intended host-only adapter. This choice matters when multiple host-only adapters exist.
  9. Select OK to save the configuration.
  10. Start the VM, or restart its guest networking if the VM was already running and the change was applied while powered on.

The host-only adapter must already exist on the host. If the expected adapter does not appear in the Name list, create or manage host-only interfaces in VirtualBox's host network management controls before configuring the VM.

Command-Line Equivalent

You can configure a VM with VBoxManage instead of the graphical manager:

VBoxManage modifyvm "<vm-name>" --nic1 hostonly --hostonlyadapter1 "<host-only-adapter-name>"

Use the appropriate adapter number when configuring another virtual NIC. For example, replace --nic1 and --hostonlyadapter1 with the corresponding options for Adapter 2 or another slot. The named host-only adapter must already exist.

Configure Guest IP Addressing

Selecting Host-only Adapter connects the virtual NIC to a network, but it does not by itself complete the guest's IP configuration. Each guest needs an address compatible with the host-only subnet.

Depending on the host-only network configuration, guests can receive addresses through DHCP, a service that automatically assigns IP settings, or they can use static addresses.

  • With DHCP enabled, inspect each guest to find the address it received.
  • With static addressing, assign unique addresses from the host-only subnet.
  • Use the same subnet and compatible subnet masks for guests that must communicate directly.
  • Do not assign duplicate IP addresses.
  • Configure the host-side host-only interface with an address in the same subnet when host-to-guest access is required.

IP addressing is separate from the VirtualBox attachment mode. A correctly selected host-only adapter can still fail to communicate if the guest has no address, an incompatible subnet mask, an incorrect route, or a blocking firewall.

Verify Connectivity

  1. Find the host-only address on the host and the assigned address on each guest.
  2. From the host, test the guest's host-only address.
  3. From one guest, test the host-only address of another guest on the same adapter.
  4. Test the actual service, not only basic reachability. For example, verify that a web or database service is listening on the host-only address and permitted by the guest firewall.

Use the guest operating system's normal IP inspection and connectivity tools. A successful address assignment does not guarantee that a particular service accepts connections.

Multi-Adapter Designs

A VM can have more than one virtual network adapter. This lets one adapter provide private communication while another provides controlled external access.

Virtual machineAdapterAttachment modeNetwork purposeExternal exposure
Web server VMHost-only adapterHost-only AdapterPrivate communication with the database VM and host administrationOnly to the host-only participants
Web server VMExternal-facing adapterNAT or Bridged AdapterOutside access, updates, or client traffic as requiredDepends on NAT rules or physical LAN exposure
Database VMHost-only adapterHost-only AdapterPrivate database traffic from the web serverUnavailable through the host-only network to external systems

In this two-tier pattern, attach both the web server VM and database VM to the same host-only adapter. Give the web server a second NAT or bridged adapter if it must communicate beyond the host. Keep the database VM on only the host-only network when it should not be directly reachable from external networks.

Multiple adapters can introduce routing decisions. Configure the guest so private database traffic uses the host-only address and the default route is provided by the adapter intended for external access. Review route priorities if traffic uses the wrong interface.

Common Use Cases

  • Training labs: Connect several lab VMs privately while allowing the host to administer and test them.
  • Preconfigured virtual appliances: Connect application, database, and supporting VMs on a private service network.
  • Private service networks: Keep backend services off the physical LAN while allowing approved frontend VMs to use them.
  • Host-to-guest administration: Provide stable host access for management, testing, and troubleshooting.
  • Isolated application testing: Prevent test guests from appearing directly on the physical network.

Host-only networking is useful when VMs must cooperate without being directly exposed through a physical LAN interface. However, isolation depends on the complete design: adapter assignments, guest firewall rules, routing, listening services, and any additional NAT or bridged adapters.

Troubleshooting Host-Only Networking

The Host-only Adapter Option Is Unavailable

  • Confirm that a host-only interface has been created in VirtualBox host network management.
  • Check whether the VM is powered off or whether its current power state prevents editing the adapter setting.
  • When several adapters exist, verify that the intended host-only adapter is selected.

The Host Cannot Reach the Guest

  • Confirm that the VM adapter is enabled and attached to the intended host-only adapter.
  • Check that the guest received a DHCP address or has a correct static address on the host-only subnet.
  • Check the guest firewall and confirm that the tested service permits inbound traffic.
  • Verify that the service listens on the host-only address rather than only on a loopback address.

Two Guests Cannot Communicate

  • Verify that both guests use the same host-only adapter, not merely the same attachment type.
  • Verify compatible addresses and subnet masks.
  • Check for duplicate IP addresses.
  • Review guest firewall settings and confirm that the service listens on the expected interface.

The Guest Needs Internet Access

Host-only mode is private to the host and attached guests. It does not provide Internet access by itself. Add and configure a separate NAT or bridged adapter when external connectivity is required, then review the guest's routing priorities.

Key Points

  • Host-only networking connects the host and selected guests on a private virtual network.
  • Guests using the same host-only adapter can communicate with one another.
  • Host-only mode does not directly connect a guest to a physical LAN or the Internet.
  • Guest IP configuration, DHCP, static addressing, firewalls, and routes must be handled separately.
  • A second NAT or bridged adapter can provide controlled external access while the host-only adapter protects private backend traffic.

For related configurations, see VirtualBox network modes, bridged networking, internal networking, and NAT networking.