Tuesday, October 01, 2024

Re: dhcpd with failover

On Tue, Oct 01, 2024 at 12:34:31PM +0300, Kapetanakis Giannis wrote:

>
> On 01/10/2024 08:36, Otto Moerbeek wrote:
> > On Mon, Sep 30, 2024 at 10:50:06PM +0300, Kapetanakis Giannis wrote:
> >
> >> How did you solve the problem of initial sync?
> >>
> >> Suppose one server goes down for maintenance. When it comes up it does not
> >> know what new leases have been given by the other server which was all the
> >> time up.
> >>
> >> There are chances that later it gives an IP already given by the other dhcp
> >> server. The leases (while down) were not synced.
> >>
> >> I don't think there is an option for initial sync (like pfsync) and even if
> >> you scp the lease file you can't be 100% sure since you might miss something
> >> while copying and starting service.
> >>
> >> This is the primary reason I've sticked with isc-dhcpd and failover peer.
> >>
> >> G
> >>
> > IIRC on dhcpd statup all leases from the lease db are advertized to
> > the other dhcpds.
> >
> > -Otto
>
> Didn't know about this but I don't think it solves the problem.
> The starting server is behind and missing entries from the lease file.
>
> Does the starting server also request a full lease advertisement from the other server?
>
> What happens with the other server (which is NOT restarting) and how will it notify the starting server that there are new leases (without a restart)?
>
> Unless a server startup triggers full advertizement on all sides.
>
> G
>

Look in src/usr.sbin/dhcpd/sync.c, on receiving a lease, dhcpd checks
if the other deamon has old info:

/*
* our partner sent us a lease
* that is older than what we have,
* so re-educate them with what we
* know is newer.
*/

So if the starting dhcpd daemon sends out info that is known to be
outdated, it wil be corrected by the others.

I'm not 100% sure that will cover all cases though.

-Otto

No comments:

Post a Comment