Skip to main content
RunBook Academy

OPNsenseXVII · DHCPDHCP operations

DHCP troubleshooting — common failure modes, log analysis, packet capture

Intermediate⏱ ~15 mintcpdumpdhcpdumpdhclientpfctl

What you'll learn

  • Read the OPNsense DHCP logs to identify lease events and failures
  • Capture DHCP exchanges with tcpdump to find protocol-level issues
  • Diagnose the common failure modes: missing service, scope mismatch, firewall rules, reservation errors
  • Apply the diagnostic discipline that distinguishes client-side from server-side failures
  • Recover from DHCP outages with minimal disruption

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.

DHCP failures are the source of a disproportionate share of “the network is down” incidents. A host that cannot get an IP address is a host that cannot reach anything. The diagnostic discipline is fast: read the logs, capture the wire, identify which side is broken, fix it. The mistakes that waste hours are the opposite: guessing without evidence, changing the wrong configuration, or assuming the client is at fault when the server is.

This lesson covers the diagnostic tools, the common failure modes the operator runs into, and the discipline that finds the cause in minutes rather than hours.

The diagnostic order

A DHCP failure produces one of these symptoms:

  • Client has no IP at all. Link-local only (169.254.x.x or fe80::...).
  • Client has wrong IP. Lease came from the wrong scope.
  • Client has correct IP but cannot reach the Internet. Lease is fine; routing or DNS is broken.

The diagnostic order:

  1. Verify the client sent a Discover. Capture on the client’s segment; look for the DHCP Discover.
  2. Verify the server received the Discover. Look at the firewall logs or capture on the server interface.
  3. Verify the server sent an Offer. Look for the Offer in the capture.
  4. Verify the client received the Offer. Look for the Offer at the client.
  5. Verify the Request and Acknowledge. Complete the four-step exchange.

The first packet that is missing tells the operator where the failure is. No Discover from the client → client-side issue. Discover received but no Offer → server-side issue. Offer sent but not received by client → relay or segmentation issue.

Reading the DHCP logs

OPNsense exposes DHCP logs under System → Log Files → DHCP. The log entries include:

  • DHCPDISCOVER from client (chaddr = MAC).
  • DHCPOFFER from server (yiaddr = offered IP, siaddr = server IP).
  • DHCPREQUEST from client (requested IP).
  • DHCPACK from server (lease confirmed).
  • DHCPNAK from server (lease denied, e.g. wrong subnet).
  • DHCPRELEASE from client (lease given up).

A healthy lease shows the four-step exchange. A failed lease shows the gap:

  • DHCPDISCOVER without DHCPOFFER → the server did not respond.
  • DHCPOFFER without DHCPREQUEST → the client did not see or did not accept the offer.
  • DHCPREQUEST followed by DHCPNAK → the server rejected the request (wrong subnet, no scope, conflict).
Read-only / SafeDHCP log
$ grep -E 'DHCPOFFER|DHCPACK|DHCPNAK' /var/log/dhcpd.log | tail -10
Jan 15 12:34:56 firewall dhcpd: DHCPOFFER on 192.168.1.50 to aa:bb:cc:11:22:33 (printer-lobby) via igb1
Jan 15 12:34:57 firewall dhcpd: DHCPACK on 192.168.1.50 to aa:bb:cc:11:22:33 (printer-lobby) via igb1
Jan 15 12:35:01 firewall dhcpd: DHCPDISCOVER from aa:bb:cc:11:22:33 (printer-lobby) via igb1
Jan 15 12:35:01 firewall dhcpd: DHCPOFFER on 192.168.1.123 to aa:bb:cc:11:22:33 (printer-lobby) via igb1
Jan 15 12:35:02 firewall dhcpd: DHCPACK on 192.168.1.123 to aa:bb:cc:11:22:33 (printer-lobby) via igb1
Jan 15 12:35:03 firewall dhcpd: DHCPDISCOVER from aa:bb:cc:11:22:33 (printer-lobby) via igb1
Jan 15 12:35:03 firewall dhcpd: DHCPNAK on 192.168.1.50 to aa:bb:cc:11:22:33 (printer-lobby) via igb1
Jan 15 12:35:08 firewall dhcpd: DHCPREQUEST for 192.168.1.123 from aa:bb:cc:11:22:33 (printer-lobby) via igb1
Jan 15 12:35:08 firewall dhcpd: DHCPACK on 192.168.1.123 to aa:bb:cc:11:22:33 (printer-lobby) via igb1

Illustrative output

The DHCPNAK in the capture is the diagnostic gem: the server explicitly rejected the request. The reason is in the log context. Common reasons: the MAC is on a reservation that has been deleted; the requested IP is not in any scope; the host is on a subnet the server does not serve.

Capturing DHCP on the wire

The diagnostic capture:

tcpdump -nei <interface> port 67 or port 68 -vvv

The -vvv flag prints each option. The operator sees:

  • The DHCP message type (Discover, Offer, Request, Ack).
  • The client MAC (chaddr).
  • The offered IP (yiaddr).
  • The server IP (siaddr).
  • The relay IP (giaddr), if relayed.
  • The options (53 = message type, 54 = server ID, 61 = client ID, etc.).

For DHCPv6:

tcpdump -nei <interface> port 546 or port 547 -vvv

The diagnostic question: which of the four messages is missing?

Read-only / SafeDHCP capture
$ tcpdump -nei igb1 -c 4 -vvv port 67 or port 68
12:34:56.789012 0.0.0.0.68 > 255.255.255.255.67: DHCP, length 308
12:34:56.789012   message-type 1 (discover)
12:34:56.789012   client-id option 1, length 7: ether aa:bb:cc:11:22:33
12:34:56.789012   DHCP option 55, length 8: 1 3 6 15 28 51 58 59
12:34:56.789020 192.168.1.1.67 > 192.168.1.50.68: DHCP, length 308
12:34:56.789020   message-type 2 (offer)
12:34:56.789020   your-ip 192.168.1.50
12:34:56.789020   server-ip 192.168.1.1
12:34:56.789020   DHCP option 53, length 1: 2
12:34:56.789020   DHCP option 1, length 4: 255.255.255.0
12:34:56.789020   DHCP option 3, length 4: 192.168.1.1
12:34:56.789020   DHCP option 6, length 4: 192.168.1.1

Illustrative output

Common DHCP failure modes

The diagnostic cheat sheet:

SymptomMost likely causeVerificationFix
Client gets 169.254.x.xNo DHCP response reached the clientCapture on the client segment; check for DHCPDISCOVERVerify DHCP service is running on the firewall interface
Client gets no IP at allDHCP service not running or wrong interface`sockstat -lgrep :67`
Client gets wrong IPScope is bound to wrong interfaceCheck the scope’s interface in GUIMove the scope to the right interface
Reservation doesn’t workMAC format wrongCompare GUI MAC to arp -anCorrect the format
DHCP works for some VLANs, not othersRelay not configured on the VLAN`sockstat -lgrep :67`
DHCPNAK in the logServer rejected the requestRead the log context (no scope for the subnet)Add the scope or fix the reservation
Pool exhaustionMore devices than pool sizedhcpd.conf pool vs active leasesExpand pool or add subnet
Existing clients don’t see new optionsThey have old leasesdhclient -r; dhclient on a clientReduce lease time or force renewal
Gateway in DHCP is wrongFirewall address changed but scope didn’tifconfig + DHCP option 3 in captureUpdate the scope’s gateway option
DNS in DHCP is wrongDNS server changed but scope didn’tDHCP option 6 in captureUpdate the scope’s DNS option

Common root causes

Five root causes account for most DHCP failures:

  1. DHCP service not enabled on the interface. The service is configured globally but not bound to the right interface. Fix: enable on the interface under Services → DHCPv4 → [Interface].

  2. Firewall rule blocking DHCP. A custom firewall rule on the LAN interface blocks UDP 67/68. Fix: add a permit rule for DHCP before the deny rule.

  3. Scope bound to wrong interface. The scope exists but is associated with the wrong VLAN. Fix: rebind the scope to the correct interface.

  4. Reservation mismatch. The reservation has a typo in the MAC, or the host has a different MAC (virtualisation). Fix: correct the MAC or pin it on the host.

  5. Lease time too long for change propagation. A configuration change takes up to the lease time to reach clients. Fix: reduce the lease time or force a renewal.

The diagnostic discipline

The discipline that finds the cause in minutes:

  1. Capture first. Before changing anything, capture the DHCP exchange on the wire. The capture shows where the failure is.
  2. Read the logs. The OPNsense DHCP log has the answer in most cases. Look for DHCPDISCOVER, DHCPOFFER, DHCPNAK, and the reason.
  3. Identify the side. Client-side (no Discover from the host) or server-side (no Offer from the firewall) or relay-side (no unicast forwarding).
  4. Fix one thing at a time. Change the scope, save, verify. Change the firewall rule, save, verify. Don’t make multiple changes at once; you will not know which one fixed it.
  5. Verify with a fresh lease. Force the client to release and renew. The new lease shows the fix worked.

The temptation is to skip the capture and guess. The cost of guessing is hours of changing the wrong thing. The cost of the capture is 30 seconds.

Recovering from a DHCP outage

When DHCP has been broken for a while, clients have stale or missing leases. The recovery:

  1. Fix the root cause. Restore the service, fix the rule, correct the scope.
  2. Force a renewal. Either reduce the lease time (so clients renew faster) or run dhclient -r; dhclient on each affected client.
  3. Verify. Confirm leases are being granted; confirm the gateway, DNS, and other options are correct.
  4. Document. Add the incident and the root cause to the runbook.

For an estate with many clients (more than can be touched by hand), reducing the lease time is the right approach. Clients renew within the new lease time; the operator does not need to touch each client.

Summary

  • DHCP failures show up as missing IP, wrong IP, or correct IP with broken routing/DNS.
  • Capture with tcpdump -nei <iface> port 67 or port 68 -vvv to see the full exchange.
  • Read the OPNsense DHCP log; the message sequence (Discover → Offer → Request → Ack/NAK) tells the story.
  • DHCPNAK is the diagnostic, not the problem; the reason is in the log context.
  • Five root causes: service not bound, firewall rule, wrong scope, reservation mismatch, lease time.
  • The discipline: capture first, read logs, identify the side, fix one thing at a time, verify.

Knowledge check · 4 questions

  1. Q1. A host on the LAN cannot get an IP address. It has 169.254.x.x. You capture on the LAN interface and see DHCPDISCOVER from the host but no DHCPOFFER. Where is the most likely fault?

  2. Q2. A DHCPNAK in the firewall log means the server actively rejected the request; the reason is logged alongside and is the diagnostic for the operator.

  3. Q3. Which of the following are common root causes of DHCP failures? Select all that apply.

  4. Q4. An operator changes the DNS server in the DHCP scope and applies the change. Two hours later, multiple clients still report the old DNS server. What is the most likely explanation?

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