VMware ESXi and vSphere Cluster Management
Configure Host-Only Networking in Oracle VM VirtualBox
Learn how VirtualBox host-only networking works, compare it with bridged and internal modes, attach VMs, configure IP addresses, and troubleshoot private guest networks.
What host-only networking does
Host-only networking is a VirtualBox network mode that creates a private, software-defined network shared by the physical computer and selected guest virtual machines. The physical computer is the host; each running VM is a guest virtual machine.
VirtualBox creates a host-only adapter, which is a virtual network interface on the host. A VM joins this network when its virtual network adapter is attached to that host-only adapter. The host-only adapter behaves like the host-side interface for the private subnet. It is sometimes described as a loopback-like software interface, but it is not the same as a conventional localhost-only loopback interface: it has a network address that can communicate with attached guests.
Guests attached to the same host-only adapter can communicate with one another and with the host. The host-only segment does not directly connect guests to the physical LAN, other physical hosts, or the Internet.
When to use host-only networking
- Local web development: A browser on the host can open a web server running inside a Linux VM through the VM's host-only IP address.
- Private application and database tiers: An application VM and a database VM can communicate over a private subnet without placing the database directly on the physical LAN.
- Client-server testing: A client VM and server VM can test protocols and services without exposing those services to the physical network.
- Training labs: Learners can practice remote access, name resolution, and service administration in a predictable isolated environment.
Host-only compared with other VirtualBox modes
A virtual network adapter is a configurable network interface presented to a guest VM. Its attachment mode determines where the guest's traffic goes.
| Mode | Guest-to-host communication | Guest-to-guest communication | External LAN or Internet access | Uses a physical host interface | Typical use |
|---|---|---|---|---|---|
| Host-only Adapter | Yes, through the host-only adapter | Yes, when guests use the same host-only adapter | No direct access | No; it is software-defined | Private development, testing, and labs |
| Bridged Adapter | Normally yes, subject to the external network | Normally yes, subject to the external network | Yes, if the physical network provides it | Yes; traffic uses an existing physical host adapter | Making a guest participate on the physical LAN |
| Internal Network | Ordinarily no direct host participation | Yes, among VMs using the same internal network name | No direct access | No | VM-only isolated networks |
Bridged networking attaches the guest to an existing physical host network interface. The guest may receive an address from the physical LAN and may be visible to other devices on that network. This is different from host-only networking, which attaches the guest to a VirtualBox-created software network.
Internal networking permits communication among participating VMs but ordinarily excludes the host. Host-only traffic is available through the host-side virtual adapter, allowing host tools and host firewall controls to observe or filter that traffic.
Typical host-only network architecture
A basic design contains the host, the VirtualBox host-only adapter, and one or more guest VMs. All of their interfaces belong to one private subnet.
- The host has an IP address on the host-only adapter.
- Each participating guest has a virtual adapter attached to the same selected host-only adapter.
- Each guest receives a unique IP address in the host-only subnet.
- A DHCP service may assign guest addresses automatically, or addresses may be configured manually.
For a multi-homed VM, use separate adapters for separate purposes. For example, a web server can use one host-only adapter for private application traffic and a second NAT or bridged adapter for controlled external access. Add an external-facing adapter only when the guest actually needs connectivity beyond the host-only segment.
Example multi-adapter design
| VM | Adapter | Attachment mode | Purpose | Connectivity scope |
|---|---|---|---|---|
| Web server VM | Private adapter | Host-only Adapter | Private web-to-database or host traffic | Host and selected VMs on the private subnet |
| Web server VM | External adapter | NAT or Bridged Adapter | Optional outbound or controlled external access | Depends on the selected external mode |
| Database VM | Private adapter | Host-only Adapter | Database service traffic | Private host-only subnet only |
Multiple adapters require deliberate interface, routing, and service-binding planning. A database service should normally listen on the private interface rather than an unnecessary external-facing interface.
Prerequisites and network planning
- Confirm that Oracle VM VirtualBox is installed.
- Power off the target VM, or place it in a state in which its network settings can be changed.
- Check whether a suitable host-only adapter already exists in VirtualBox network management. Create one there if necessary.
- Choose a private IPv4 subnet that does not conflict with the host's LAN, VPNs, or other virtual networks.
- Decide whether guests will receive addresses through DHCP or use static IP addresses.
- For a multi-VM design, list the VMs that need the private adapter and ensure every one selects the same host-only adapter.
A subnet is the address range shared by interfaces on the same logical network. For example, a private network might use an address range such as 192.168.56.0/24, provided that range does not conflict with another network in the environment. The exact address range and adapter names can vary by host operating system and VirtualBox release.
Attach an existing VM through VirtualBox Manager
- Select the target VM in Oracle VM VirtualBox Manager.
- Open Settings.
- Open the Network section.
- Select the adapter slot to configure, such as Adapter 1.
- Enable Network Adapter.
- Set Attached to to Host-only Adapter.
- Use the adapter-name selector to choose the intended host-only adapter.
- Confirm and save the settings.
- Start or restart the VM as appropriate.
- Repeat these steps for every VM that must join the same private network.
Do not confuse selecting Host-only Adapter with selecting an adapter name. The attachment mode identifies the networking method; the adapter name identifies the particular host-only network.
Configure the guest IP address
A guest must have a valid IP configuration on the host-only subnet. The configuration normally includes an IP address and subnet mask or prefix length. A default gateway is not normally needed on a host-only-only guest because the segment has no external router.
DHCP addressing
If DHCP is enabled for the selected host-only network, configure the guest interface to obtain its address automatically. The DHCP service supplies an address and related network settings from the host-only subnet.
DHCP is convenient for temporary labs, but the address can change. Use a static address, DHCP reservation where supported, or name resolution when a service must be reached consistently.
Static addressing
A static IP address is manually assigned to an interface. Choose an unused address within the host-only subnet, use the correct subnet mask or prefix, and avoid duplicate addresses. For a private-only guest, leave the default gateway unset unless another VM or device is deliberately acting as a router.
Guest operating system configuration tools differ. After configuring the interface, inspect its address and routes with commands appropriate to the guest:
ip addr
ip route
ping -c 4 <host-only-address-of-host>
ping -c 4 <host-only-address-of-peer>
curl http://<guest-host-only-address>:<port>On a Windows guest, equivalent checks commonly include ipconfig, route print, ping, and a suitable service test. The exact commands depend on the guest operating system.
Verify connectivity
- Inspect the host-side host-only adapter and record its IP address and subnet mask.
- Inspect the guest interface and confirm that it is up and has an address in the same subnet.
- Test host-to-guest reachability.
- Test guest-to-host reachability.
- For a multi-VM network, test guest-to-guest reachability.
- Test the intended application port, such as HTTP or a database listener, rather than relying only on ICMP ping.
For example, a host browser can connect to the web server's host-only address. A client VM can test a server port with an application-specific client or a TCP port testing tool available in its operating system.
Host-only configuration checklist
| Configuration item | What to select or verify | Why it matters |
|---|---|---|
| VM network adapter enabled | Enable Network Adapter in the selected slot | A disabled virtual adapter cannot carry traffic |
| Attachment mode | Host-only Adapter | Chooses the private host-participating network mode |
| Correct host-only adapter | Select the intended adapter name | Guests on different host-only adapters cannot use the same private segment |
| Guest IP configuration | Valid address, mask or prefix, and interface state | Allows devices to communicate on the same subnet |
| DHCP or static choice | Use DHCP when provided, otherwise plan unique static addresses | Prevents missing, changing, or duplicate addresses |
| Firewall and service port | Permit the intended protocol and confirm the service is listening | Network attachment alone does not open application ports |
| Connectivity tests | Test host-to-guest, guest-to-host, guest-to-guest, and service ports | Identifies whether the fault is network, firewall, or application related |
Security and exposure considerations
Host-only mode isolates guests from the physical network by default, but it does not isolate them from the host. Services bound to the host-only address can be reached by the host and by other VMs on that host-only segment.
- Use host and guest firewall rules as separate security controls.
- Bind private services to the host-only interface when possible.
- Avoid adding an unnecessary bridged adapter to a VM whose services should remain private.
- Do not assume that an isolated physical network segment means the guest is unreachable from the host.
Limitations and operational considerations
- A host-only adapter is local to one host computer. It is not a direct path to VMs or physical hosts on another computer.
- Host-only mode alone is not an Internet-access solution.
- Adding NAT or bridged connectivity changes the guest's routing and exposure; review which interface provides the default route.
- Multiple adapters can create ambiguous routes or expose services on the wrong interface.
- Host-only adapter names, creation workflows, DHCP behavior, and available address ranges vary by host operating system and VirtualBox release.
Troubleshooting host-only networking
The VM cannot communicate with the host
- Confirm that the VM adapter is enabled.
- Confirm that the attachment mode is Host-only Adapter and that the intended adapter name is selected.
- Compare the host and guest addresses, masks, or prefixes. They must belong to the same intended subnet.
- Check whether the guest received a DHCP lease or has a valid static configuration.
- Check host and guest firewall rules.
- Test an allowed application port as well as ICMP.
Two VMs cannot reach each other
- Confirm that both VMs select the same host-only adapter name, not merely the same attachment mode.
- Verify that both guests have unique addresses in the same subnet.
- Check guest firewall rules and confirm that the target service is listening on the host-only address rather than only on localhost.
The VM has no Internet access after switching to host-only mode
This is expected behavior. Host-only mode has no direct external network path. If external access is required, retain the host-only adapter for private traffic and add a separate NAT or bridged adapter as appropriate. After doing so, review the guest's routes and default gateway.
The host can reach the VM, but the service is unavailable
- Verify that the service process is running.
- Check the addresses on which the service listens. A service listening only on localhost will not accept connections through the host-only interface.
- Verify the guest's host-only IP address and the port being tested.
- Review the guest firewall policy.
- Test the service port from the host instead of relying only on ping.
Practical topologies
Single local development VM
Attach the host and one Linux web-server VM to the same host-only adapter. The host browser uses the VM's host-only IP address to reach the web service. Because the VM has no bridged or NAT adapter, the web service is not directly exposed through the physical LAN or Internet.
Private application and database tier
Attach a web-server VM and database VM to the same host-only adapter. If the web server needs external access, add a second NAT or bridged adapter to the web server only. Keep the database on the private adapter unless it has a specific, justified external connectivity requirement.
Two-VM training lab
Attach a client VM and server VM to the same host-only adapter. The host can access both machines, while the learners test name resolution, remote access, and service connectivity without using the physical LAN.
Summary
Host-only networking creates an isolated VirtualBox subnet shared by the host and selected guests. Select Host-only Adapter in each VM's Network settings, choose the same host-only adapter name, and provide valid guest IP configurations through DHCP or static addressing. Verify addresses, routes, firewalls, and service ports. Use a separate NAT or bridged adapter only when a guest needs connectivity beyond the private segment.
For related VirtualBox network configuration, see Configure Host Only Networks.