How to sync a Linux secondary DHCP server?

Simon Hobson dhcp1 at thehobsons.co.uk
Mon Jul 30 14:28:22 UTC 2018


Sandra Schlichting <littlesandra88 at gmail.com> wrote:
> In this article [1] they don't explain how the secondary DHCP server
> gets synced and in this one [2] they sync the files with home made
> scripts.
> 
> **Question**
> 
> Having a secondary DHCP server is good practice I'd say, so can it
> really be correct, that DHCP on Linux doesn't have an official a way
> to sync config, leases and reservations to the secondary?
> 
>  [1]: https://www.lisenet.com/2018/configure-dhcp-failover-with-dynamic-dns-on-centos-7/
>  [2]: https://steronius.blogspot.com/2015/10/dhcp-failover-on-rhel-7.html

config - no, there's no official way
leases and reservations are handled automagically by the failover protocol

In both cases, they are configuring the failover protocol (the "failover-peer" definitions and statements in the relevant pools), but I agree do not say how it works.
It's not as simple as this, but in effect, the two servers communicate with each other so that each has a list of leases given out by the other. When a new lease is issued by one server, it tells the other so that both leases files can be updated.
If there's a failure, then once the remaining server is put into partner down mode (which is not automatic by default because there are failure modes where it could go wrong) then it will take over the entire set of pools.
By default, both servers are active, so it's not really master & slave, and they will automatically rebalance things so that both have roughly half the free addresses in each pool.

You should find better descriptions in the list archives.

The two config files need to be identical apart from the failover-peer declaration. This can be in a separate file which is pulled in wioth an include statement in the main config file. That way, you can keep the two config files in sync by editing one and copying it to the other machine (either manually or automagically) or machine generate both copies of the config file by some configuration management system.



More information about the dhcp-users mailing list