On Fri, Feb 11, 2022 at 08:32:27PM +0100, Matus UHLAR - fantomas via 
Dnsmasq-discuss wrote:
> > > On 2/10/22 22:33, Chris Green wrote:
> > > > As per the subject when does dnsmasq [re]read the leases file?
> 
> > On Fri, Feb 11, 2022 at 12:16:52AM +0100, Petr Menšík wrote:
> > > When it starts. It has own data stored in-memory and just rewrites lease
> > > file. It would not read any new leases from it if some other service
> > > pushed them there. If dnsmasq is restarted, it starts a new process. It
> > > has to read all configuration all again, which has to be done for leases.
> 
> On 11.02.22 09:01, Chris Green wrote:
> > So does that mean there's no way to 'warm start' an instance of dnsmasq
> > with a set of leases?
> 
> as Petr said, when dnsmasq starts, it reads the leases file.
> not after.
> 
> > > > I am experimenting with my backup DHCP/DNS strategy and I have just
> > > > stopped my dnsmasq server and started another listening on the first
> > > > dnsmasq server's IP address.  It's working OK'ish.  However the new
> > > > dnsmasq server doesn't (of course) know the name/IP pairs that the old
> > > > dnsmasq server had in its memory.
> > > >
> > > > If I had copied the dnsmasq.lease file across from the old server to
> > > > the new one would that help?  Is there some way to tell dnsmasq to
> > > > reload its memory from the file?  If dnsmasq is restarted (e.g. by
> > > > systemd) does it read the dnsmasq.leases file?
> 
> > Surely when dnsmasq is stopped and then started it reads it's previous
> > leases file so that it still knows the names/IPs of systems that it
> > has provided IPs for.  So if I copy that leases file to another system
> > and start a copy of dnsmasq there (with same configuration as the one
> > it's replacing) won't it read that leases file?
> 
> since it reads leases file on start, copying them to second system and
> starting dnsmasq there would cause reading the leases file.
> 
> however, copying it to system with running dnsmasq would cause losing that
> file.
> 
> If you want dhcp synchronization, better use isc-dhcpd or kea-dhcpd.
> 
> for manual (or semi-automatic) transition copying leases file could work.

Yes, thanks all, I think I understand (the bits I need anyway).

-- 
Chris Green

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to