The Phantom DHCP Failover: Why Kea HA Never Triggered Partner-Down
During disaster testing of our clustered Kea DHCP servers, 20 distinct clients went unserved without triggering automatic failover. The bug was in our synthetic test packets, not in Kea.

Key Architectural Takeaways
- Kea DHCP High Availability uses a two-stage failure detector: heartbeat loss followed by unserved client acquisition timers.
- Kea strictly requires the RFC 2131 'secs' field to exceed max-ack-delay before counting a client as unacknowledged.
- Our test tool (nmap broadcast-dhcp-discover) hardcoded secs to 0, preventing the HA state machine from advancing.
The promise of zero-downtime DHCP
Dynamic Host Configuration Protocol (DHCP) is the unsung backbone of local networking. If DNS goes down, existing connections persist; if DHCP goes down, every expiring lease and rebooted workstation is dead in the water.
To achieve enterprise resilience, we deployed ISC Kea DHCPv4 in a high-availability active-active load-balancing pair across two dedicated physical edge hosts. In normal operation, both nodes answer requests based on a hash of the client's MAC address. If one node fails, the surviving partner takes over the entire lease pool.
The failure drill that stalled
During routine resilience drills, we simulated a catastrophic power failure on Node 1:
- Node 1 was abruptly severed from the network.
- Node 2 immediately recognized the loss of heartbeats and entered
COMMUNICATION-INTERRUPTEDmode. - Under Kea HA rules, Node 2 should advance to
PARTNER-DOWNand take over all client allocations as soon as 5 unserved clients (max-unacked-clients: 5) request an address without receiving an answer.
To trigger the takeover, we launched synthetic DHCPDISCOVER requests across 20 distinct MAC addresses over several minutes. Inspecting Node 2's syslog showed:
kea-dhcp4: WARN HA_HEARTBEAT_FAILED heartbeat to partner failed: unable to forward command
kea-dhcp4: INFO HA_COMMUNICATION_INTERRUPTED_CLIENT4 [hwtype=1 de:ad:be:ef:00:01]
kea-dhcp4: INFO HA_COMMUNICATION_INTERRUPTED_CLIENT4 [hwtype=1 de:ad:be:ef:00:02]
...
kea-dhcp4: INFO HA_COMMUNICATION_INTERRUPTED_CLIENT4 [hwtype=1 de:ad:be:ef:00:20]Node 2 had logged 20 distinct clients pleading for addresses. But no state transition occurred. It remained stuck in COMMUNICATION-INTERRUPTED, refusing to allocate addresses for Node 1's share of the network.
The investigative trap: blaming the daemon
Our initial instinct was to question Kea's configuration:
- Was
max-ack-delay: 5000(5 seconds) too long? - Was inter-server REST API communication silently misconfigured?
- Was Kea ignoring unacked client thresholds due to a lease database lock?
None of the above. Re-reading Kea's developer documentation alongside RFC 2131 (Dynamic Host Configuration Protocol) revealed the true mechanism.
RFC 2131 and the forgotten `secs` field
RFC 2131 Section 2 defines the DHCP packet header. Byte offset 8 contains a 16-bit integer: `secs` (Seconds elapsed since client began acquisition or renewal process).
A real DHCP client (like dhclient or systemd-networkd) sets secs = 0 on its first discovery packet. If no server responds within its timeout, the client retransmits, incrementing secs = 4, secs = 8, and so on.
Kea's HA failure-detection algorithm is exquisitely RFC-compliant: > To prevent false-positive failovers from transient network glitches, Kea does not count every incoming discover packet as an unserved client. It only increments its unacked client counter if the packet's `secs` field is strictly greater than `max-ack-delay / 1000`.
In other words: Kea requires mathematical proof from the client that it has been waiting longer than the partner's permitted response window!
The test tooling bug
We had generated our synthetic test packets using:
nmap --script broadcast-dhcp-discover ...Inspecting broadcast-dhcp-discover.nse revealed the flaw: the script constructs a static DHCPDISCOVER frame and hardcodes the `secs` field to `0x0000` on every single packet.
No matter how many synthetic MAC addresses were generated, and no matter how many minutes the test ran, every packet arrived declaring that the client had been waiting for exactly zero seconds. Node 2 saw each request, logged it faithfully, checked whether secs > 5, evaluated 0 > 5 as false, and correctly discarded it from the failover count!
Verification with compliant clients
To verify the hypothesis, we ran test packets using a Python script that properly incremented the secs field on retransmissions (secs: 6):
kea-dhcp4: INFO HA_COMMUNICATION_INTERRUPTED_CLIENT4 [hwtype=1 de:ad:c0:de:00:05]
kea-dhcp4: NOTICE HA_STATE_TRANSITION from COMMUNICATION-INTERRUPTED to PARTNER-DOWN: partner considered offline after 5 unserved clientsThe moment the 5th client with secs >= 6 arrived, Node 2 seamlessly claimed the full lease scope and assigned IP addresses across all subnets in under 50 milliseconds.
Engineering takeaway
When a high-availability state machine fails to trigger under synthetic testing, look at the test generator before rewriting production configs. RFC-hardened server daemons enforce protocol nuances that simplistic test scripts casually omit.