Skip to main content
RunBook Academy

OPNsenseXVII · DHCPDHCPv4 server

DHCP reservations and static mappings — when to use, MAC format gotchas

Foundation⏱ ~12 minarpifconfigdhclient

What you'll learn

  • Explain when a DHCP reservation is the right tool vs a static IP
  • Configure a DHCP reservation in OPNsense with the correct MAC format
  • Recognise MAC-format pitfalls and virtualisation randomisation
  • Document the host inventory alongside the reservations
  • Identify the failure modes of misconfigured reservations

Prerequisites

Verified against OPNsense 25.x · FreeBSD 14.x · PF (FreeBSD packet filter) FreeBSD 14.x · Unbound 1.20+ · Kea DHCP OPNsense 25.x plugin · WireGuard in-kernel + OPNsense plugin · strongSwan (IPsec plugin) OPNsense 25.x plugin · OpenVPN 2.6.x · Suricata 7.x · 2026-08-14

Not yet marked complete on this device.

A DHCP reservation is a permanent lease tied to a MAC address. The client still uses DHCP, but the server always gives it the same address. This pattern is the right tool when a host needs a stable IP — for firewall rules, monitoring, or DNS — without the operator configuring the host’s network stack manually. But reservations come with their own pitfalls: MAC-format typos, virtualisation randomisation, and the documentation discipline that keeps the host inventory from drifting.

This lesson covers when reservations are the right tool, how to enter MAC addresses correctly, and the operational discipline for keeping the host inventory accurate.

Reservations vs static addresses

Two ways to give a host a fixed IP:

  1. DHCP reservation: the host uses DHCP; the server always gives it the same address. The MAC is the key; the address is permanent in the DHCP database.
  2. Static IP on the host: the operator configures the IP, mask, gateway, and DNS on the host itself. The DHCP server is not involved.

The tradeoffs:

AspectReservationStatic
Configuration effortCentralised on the firewallPer-host
Configuration drift riskLow (DHCP is the source of truth)High (host can have anything)
Operator visibilityReservation list shows all reserved hostsMust inventory hosts separately
Host network failureIf DHCP fails, host gets no IPHost keeps its IP
DHCP server failureIf DHCP fails, host gets no IPHost keeps its IP

The reservation pattern is the right default for production. Centralised control means the operator can see and change every fixed IP from one place. The DHCP server dependency is acceptable in any environment where DHCP is reliable (which is the entire point of running DHCP).

The static pattern is appropriate when:

  • The host is the DHCP server itself (chicken-and-egg).
  • The host needs to boot before DHCP is available (PXE boot environments, network boot sequences).
  • The host is on a segment with no DHCP server.

Configuring a reservation in OPNsense

The configuration is under Services → DHCPv4 → [LAN] → Reservations. The fields:

  • MAC address: the host’s MAC, in the format OPNsense expects (colon-separated hex).
  • IP address: the address to assign.
  • Hostname: optional but recommended — makes the reservation list self-documenting.
  • Description: optional — additional context.

The reservation is saved; OPNsense regenerates dhcpd.conf and signals the daemon. The next time the host requests a lease, it receives the reserved address.

MAC address format gotchas

The most common production mistake with reservations: the MAC address format. OPNsense expects the colon-separated hex format (e.g. aa:bb:cc:11:22:33). The common errors:

  • Hyphens instead of colons (aa-bb-cc-11-22-33). The reservation does not match. Fix: use colons.
  • Dots instead of colons (Cisco format, aabb.cc11.2233). The reservation does not match. Fix: convert to colon format.
  • Spaces (aa bb cc 11 22 33). The reservation does not match. Fix: remove spaces.
  • Uppercase vs lowercase (AA:BB:CC:11:22:33 vs aa:bb:cc:11:22:33). OPNsense normalises case, but some operators report issues. Best practice: use lowercase consistently.
  • Extra characters (a typo, a stray digit). The reservation does not match. Fix: copy the MAC from the host’s network configuration.

The verification step: every reservation should be testable. After saving the reservation, force the host to renew (dhclient -r; dhclient on Linux; reboot on most systems). Verify the host received the reserved IP.

Read-only / Safeverify reservation
$ arp -an | grep 192.168.1.50
? (192.168.1.50) at aa:bb:cc:11:22:33 on igb0 expires in 1198 [ethernet]

Illustrative output

Virtualisation randomisation

Some virtualisation platforms (VMware, VirtualBox, some KVM configurations) generate a new MAC address for a virtual NIC on every boot. The “reservation” does not survive the reboot because the host’s MAC has changed.

The fix depends on the virtualisation platform:

  • VMware: set the MAC manually in the VMX file. The MAC is persistent across reboots.
  • VirtualBox: set the MAC manually in the network adapter settings.
  • KVM/libvirt: set the MAC manually in the domain XML.
  • Cloud platforms (AWS, Azure, GCP): MAC addresses are random by default; reservations cannot be tied to MAC. Use DHCP option 82 (relay agent information) or a different identity mechanism.

The operator who deploys a VM with DHCP reservation must verify the MAC is stable across reboots before relying on the reservation. If the MAC is randomised, the reservation is useless.

The host inventory

Reservations are only useful if the operator maintains the host inventory. Three things to track for every reservation:

  1. MAC address (the key).
  2. IP address (the value).
  3. Hostname and owner (the context).

The OPNsense reservation list shows hostname and description fields; the operator should fill them in. The list becomes the inventory of every host with a fixed IP. When a host is decommissioned, the operator removes the reservation; when the host’s IP needs to change, the operator updates the reservation.

For larger estates, an external inventory system (NetBox, phpIPAM, custom spreadsheet) tracks MAC, IP, hostname, owner, location, and purpose. The OPNsense reservation list exports to CSV for import into the inventory system.

Common reservation failure modes

Five failure modes appear repeatedly:

  1. Wrong MAC format. The reservation does not match. The host gets a pool address. Fix: correct the MAC format.

  2. MAC changed (virtualisation). The host was rebooted and now has a different MAC. The reservation does not match. Fix: pin the MAC in the virtualisation configuration.

  3. Reservation in the wrong subnet. The reservation is configured under the LAN interface but the host is on the DMZ. The reservation does not apply. Fix: move the reservation to the correct interface’s DHCP service.

  4. Duplicate reservation. Two reservations for the same MAC with different IPs. The DHCP server picks one arbitrarily. Fix: delete the duplicate.

  5. Reservation for a decommissioned host. The host is gone but the reservation remains. The IP is permanently wasted. Fix: regular review of the reservation list against the host inventory.

Reservation vs static for production hosts

The decision rule:

  • Use a reservation when the host is on a segment with a DHCP server and the operator wants centralised control.
  • Use a static IP when the host must boot before DHCP is available, or when the segment has no DHCP server.

For most production hosts (servers, printers, VoIP phones, network gear), use a reservation. The DHCP server is the source of truth for the IP; the operator can see and change every fixed IP from one place.

Summary

  • A DHCP reservation ties a MAC address to a fixed IP; the host still uses DHCP.
  • Reservations are the right default for production hosts with fixed IPs.
  • MAC format pitfalls are the most common reservation failure: hyphens, dots, spaces, typos all break the match.
  • Virtualisation platforms may randomise MACs; pin the MAC before relying on a reservation.
  • Cloud VMs cannot use MAC-based reservations; use option 82 or accept dynamic addresses.
  • Document the host inventory: MAC, IP, hostname, owner. Review regularly.

Knowledge check · 4 questions

  1. Q1. An operator creates a DHCP reservation for a printer with MAC aa-bb-cc-11-22-33 (hyphenated) at 192.168.1.50. The printer continues to get 192.168.1.123 from the pool. What is the most likely cause?

  2. Q2. For production hosts that need fixed IP addresses, DHCP reservations are generally the right tool because the operator maintains a central inventory of all fixed IPs from the firewall.

  3. Q3. Which of the following are valid MAC address formats that OPNsense accepts in a DHCP reservation? Select all that apply.

  4. Q4. You deploy an OPNsense VM in a public cloud and want a fixed internal IP via DHCP reservation. The VM's MAC changes on every boot. What should you do?

Passing score: 75%. Answers are checked in this browser.