Configure HostOnly DHCP server parameters in VirtualBox for macOS

Abstract: Configure HostOnly DHCP server parameters in VirtualBox for macOS using VBoxManage to set IP ranges, lease times, and enable or disable the service.

Created: 2026-10-06 by
You can configure the HostOnly DHCP server parameters in VirtualBox for macOS by using the VBoxManage command-line utility. This tool allows you to set specific IP ranges, lease times, and enable or disable the DHCP service for isolated virtual networks without relying on the graphical interface.

Accessing the Command Line Interface

The primary method for managing VirtualBox network settings on macOS is through the terminal application. While the VirtualBox Manager GUI provides basic visibility into network adapters, it does not expose granular DHCP configuration options such as subnet masks, default gateways, or custom lease durations. The VBoxManage utility is installed automatically with the VirtualBox package and resides in your system path.

To begin, open the Terminal app located in your /Applications/Utilities folder. You do not need administrative privileges to view current settings, but you will require them to modify network configurations. Ensure that no virtual machines are currently running the specific HostOnly adapter you intend to modify, as some changes may require a restart of the virtual machine or the VirtualBox networking service to take effect.

Identifying Your HostOnly Network

Before modifying parameters, you must identify the exact name or UUID of the HostOnly network you wish to configure. VirtualBox typically creates a default HostOnly network named vboxnet0, but you may have created additional interfaces for specific projects. You can list all existing networks and their current states by running the following command:

VBoxManage hostonlyif ipconfig --list

This command outputs detailed information about each HostOnly interface, including its MAC address, IPv4 address, and whether the DHCP server is currently enabled. If you see multiple entries, note the name of the interface associated with the IP range you want to adjust. For most standard setups, vboxnet0 is the target. If the interface does not exist, you can create one using VBoxManage hostonlyif create, which will generate a new interface with default parameters.

Configuring DHCP Server Parameters

Once you have identified the interface, you can configure the DHCP server settings. The most common requirement is to define the pool of IP addresses that VirtualBox will assign to guest operating systems. By default, VirtualBox uses a small range, often starting at 192.168.56.101. You can expand this range or change the base address using the dhcpserver modify command.

VBoxManage dhcpserver modify --netname vboxnet0 \
  --ip 192.168.56.1 \
  --mask 255.255.255.0 \
  --lowerip 192.168.56.100 \
  --upperip 192.168.56.254 \
  --enable

In this example, the gateway IP is set to 192.168.56.1, which is also the IP address of the HostOnly adapter on the host machine. The --lowerip and --upperip flags define the boundaries of the DHCP pool. Adjust these values based on your network requirements. If you need to disable the DHCP server entirely, replace --enable with --disable.

Setting Lease Times and Advanced Options

For environments where virtual machines are frequently started and stopped, default lease times might cause IP conflicts or exhaustion. You can customize the lease duration using the --lease-time parameter. This value is specified in seconds. A shorter lease time ensures that unused IPs are returned to the pool more quickly, while a longer lease reduces DHCP traffic overhead.

VBoxManage dhcpserver modify --netname vboxnet0 \
  --lease-time 3600

This sets the lease time to one hour (3600 seconds). Additionally, you can specify domain names that will be sent to clients via the DHCP option. This is useful if your internal DNS requires specific suffixes for resolution within the isolated network.

VBoxManage dhcpserver modify --netname vboxnet0 \
  --domain-name "local"

These settings persist across reboots of the host macOS system. However, changes to the DHCP server configuration do not affect already leased IPs in guest VMs. Guests will receive updated network parameters only after they renew their DHCP lease, which typically happens upon reboot or when you manually trigger a release and renew process within the guest OS.

Verifying Configuration and Troubleshooting

After applying changes, verify that the configuration was accepted correctly. Run the hostonlyif ipconfig command again to inspect the active settings. If the output shows unexpected values, ensure that there were no typos in the previous commands. Common errors include invalid IP formats or overlapping ranges.

If guests are not receiving IP addresses despite the DHCP server being enabled, check the firewall settings on your macOS host. While VirtualBox HostOnly adapters generally bypass standard firewalls, certain security software or strict macOS firewall rules might block UDP ports 67 and 68, which are used for DHCP communication. Restarting the VirtualBox networking service by toggling the adapter off and on in the VirtualBox Manager GUI can also resolve transient connectivity issues.

For users looking to secure connections within these isolated networks, understanding how to handle certificate authorities is crucial. You might encounter situations where internal services use self-signed certificates. In such cases, configuring trust anchors becomes necessary. For more details on handling unknown certificates in network tools, see our guide on establishing TLS connections with unknown CAs.

Frequently Asked Questions

Can I assign static IPs to VMs on a HostOnly network?

Yes, you can configure static IP addresses within the guest operating system itself, independent of the DHCP server. Even if the DHCP server is disabled, you can manually set an IP address, subnet mask, and gateway in the guest's network settings. This is useful for servers that require consistent addressing for internal routing.

What happens if I delete the HostOnly adapter?

Deleting the HostOnly adapter removes the network interface from the host and invalidates any DHCP reservations associated with it. Any virtual machines using that adapter will lose network connectivity until you recreate the adapter and reconfigure the network settings in both the host and the guest VMs.

How do I reset DHCP settings to defaults?

There is no direct "reset" command, but you can achieve this by disabling the DHCP server and then enabling it again with default parameters. Alternatively, deleting the HostOnly adapter and creating a new one will restore the factory default IP range and settings, though this will disconnect all currently attached VMs.

Is it possible to run multiple HostOnly networks simultaneously?

Yes, VirtualBox supports multiple HostOnly adapters, typically named vboxnet0, vboxnet1, and so on. Each adapter operates as a separate isolated network segment. You can configure distinct DHCP pools and settings for each, allowing you to segregate different groups of virtual machines.

Why are my VMs getting IPs outside the configured range?

This usually indicates that another DHCP server is present on the network, such as your physical router or a conflicting virtualization software. Since HostOnly networks are isolated, this is rare unless you have bridged the adapter incorrectly. Check your VM's network adapter type to ensure it is set to "Host-only Adapter" and not "Bridged Adapter."

Tags: Linux MacOS

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More