ISC DHCP Load Balancing
DHCP server load balancing can be configured in conjunction with failover. Load balancing enables two DHCP servers to share responsibility for one or more address pools. Each server must be configured with either (not both) a split or hba declaration to define unique partitioning of the address pool being load balanced. These statements enable each server to identify which clients it will serve, and which it will allow its peer to serve. This determination is made by evaluating a hash ( of the client identifier within the DHCP packet, or if not present, the hardware address field, and the split or hba value.
The load balance max seconds parameter defines a threshold value enabling a server to provide a lease to a client that normally would be served by the other server. The number of seconds defined in this parameter is compared against the Secs parameter in the DHCP message header, which is populated by the DHCP client as an indication of the number of seconds that the client has been attempting to contact a DHCP server. Even if the originally “intended” server and the backup server both respond with Offers to the client, the client will select one and issue one Request to the selected server.
The ISC DHCP server provides a scheduled mechanism to analyze the available IP addresses on both servers to maintain balance among them. The schedule is loosely defined between the bounds of min-balance and max-balance parameters, which are used to define the minimum number of seconds between load balance analysis and the maximum number of seconds respectively. The analysis itself compares the number of free addresses on a given server against those on its peer and identifies variances from a 50/50 split. As lease bindings are communicated among the peers, each can track its own available lease pool as well as its peer’s. The difference between a server’s free IP addresses and its peer’s divided by two yields a measure of lease balance. ISC calls this measure leases to send (lts).
If the number of leased IP addresses is the same on both servers, lts = 0, indicating balance. If my server has more leased IP addresses than my peer, lts > 0 and I have “leases to send” potentially to my peer to balance out the leases count. Conversely, if lts < 0, my server has fewer leased IP addresses and I can receive leases from my peer to approach balance. Generally a small positive or negative quantity is normal; to prevent overcompensation, the max-lease-misbalance parameter defines a percentage threshold, beyond which lease transfer among the peers will commence to achieve balance. Thus if max-lease-misbalance is set to 5, then no rebalancing is attempted if lts is within 5% of the total of both peers’ leases. If lts is above 5%, leases are transferred from the server with positive lts to its peer until the peer has more leases than a percentage specified by the max-lease-ownership parameter.