According to section 6 of RFC 3074, it seems that the process for selecting a load balancing server in ISC DHCP is as follows:
- The client broadcasts a discover message, which either directly reaches the DHCP servers in active-active state, or which is relayed to both servers (we're ignoring the possibility of section 5.4 "HBA Intended for a Forwarder" for this example).
- The servers assign a Service Transaction ID (STID) to the transaction for internal(?) use. The client's hardware address (
chaddr
) is hashed using the Pearson hashing algorithm, which loops over the key (chaddr
) and performs a bitwise NOT against the previous iteration, and sets the result as the number found at that value's index in a pseudorandom table of 256 numbers from 1 - 255.
- The result of the hash, a number from 1 - 255, is compared to the HBA, which in the case of an ISC DHCP server with only the
split
field defined in the HA configuration, is a bitmap where the number of 1's starting from the left (or right, on the secondary server) matches the value of the split
configuration field. For example, a split
of 100 would correspond to an HBA on the primary as FF FF FF FF FF FF FF FF FF FF FF FF F0 00 00 00 00
and on the secondary as 00 00 00 00 00 00 00 00 00 00 00 00 0F FF FF FF FF ...
. If the HBA has a 1 at the bit at the given index (from the hash result), then the server serves the DHCP offer message to the client.
According to my understanding, as long as the HBA has no overlap between the servers, it's not possible for both servers to ultimately decide to serve the client.
TL;DR: the DHCP load balancing algorithm guarantees that only one DHCP server will respond to a given client.
My question now, is why I have a client that's getting an offer from both servers. In fact, I see that the number of offers shown on my router interface is close to double the number of requests, which implies that this is not just an issue for the one client I have (but I have not confirmed this). My only idea was that since the load balance max seconds
field in my servers' HA section is 3, maybe this client is too slow to accept and so the partner DHCP server jumps in.
Under what conditions would two load balancing DHCP servers offer a client an address?
Here is where this process happens in ISC Kea:
Where the server decision is made:
https://gitlab.isc.org/isc-projects/kea/-/blob/master/src/hooks/dhcp/high_availability/query_filter.cc#L330
The function that hashes the chaddr:
https://gitlab.isc.org/isc-projects/kea/-/blob/master/src/hooks/dhcp/high_availability/query_filter.cc#L384
I don't know where the code is for standard ISC DHCP.