How do I resynchronize a failover pair?
  • 25 Oct 2018
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

How do I resynchronize a failover pair?

  • Dark
    Light
  • PDF

Article Summary

There are various reasons for wanting to resynchronize a failover pair of DHCP servers.  These include:

  • Hardware failure - one server is offline for a long time while it is replaced

  • Configuration error (changes or migrations) causing issues such as both servers believing that they are the primary for one or more address ranges

  • Migration

If the requirement is (for whatever reason) to manually trigger a re-synchronization, then assuming that the primary server is correct, on the secondary (or vice versa):

  1. Stop dhcpd.

  2. Delete the leases file.

  3. Create an empty leases file, such as the example in the dhcpd.leases(5) manual: # touch /var/state/dhcp/dhcpd.leases.

  4. If the peer had been placed in partner-down state using OMAPI or through lease file editing, return the peer to normal state.

  5. Restart dhcpd.

This will cause the secondary to refresh the leases file entirely from the primary. (This is sometimes called "faulting the database.")

This will not resolve any duplicate IP addresses
Incorrect configurations may cause two servers to assign the same lease to different clients. Correcting the server configurations will not affect the clients who are already running with the same addresses. If you have two clients with the same IP address, you need to find the one that was served by the secondary and cause it to request a new lease. If you don't know which of the two clients obtained its lease from which server, then both will need to be made to request new addresses.

Use care if part of the lease database is not shared
You might not want to do this if the re-synchronizing server is serving one or more pools which is/are not shared with the peer. Our best recommendation in such a case is to edit the leases file manually, or for a large server, use awk, perl or another scripting tool of choice to remove only the leases from the shared pool(s).

Use care if you have reserved leases in your leases file
Reserved leases are leases that are permanently assigned to one client, who will always be granted this same lease and it will never be allocated to another client. These are not specified in dhcpd.conf but are maintained solely in the leases file (usually created there via direct edit or OMAPI, or possibly by the dhcpd.conf infinite-is-reserved option). Our best recommendation in such a case is to edit the leases file manually, or for a large server, use awk, perl or another scripting tool of choice to save and then restore the reserved leases before restarting the server whose lease database is to be 'faulted'.