[Dnsmasq-discuss] Questions about DHCP persistence and lease times

Chris Green cl at isbd.net
Fri Sep 3 12:20:49 UTC 2021

On Fri, Sep 03, 2021 at 12:08:20PM +0100, Ed W wrote:
> On 03/09/2021 11:31, Chris Green wrote:
> > Two questions really:-
> >
> >     Is the file /var/lib/misc/dnsmasq.leases the only place where
> >     dnsmasq keeps DHCP/IP/Name information across restarts?  I.e. if I
> >     delete that file will new DHCP requests get new IPs?  (or does the
> >     client have some memory of the last IP it got?)
> >
> >
> >     If a client's DHCP lease expires and it sends a new DHCP request
> >     out, which fails, will it continue to use the old values or will
> >     it just die?
> >
> >
> > I realise /var/lib/misc/dnsmasq.leases is not cast in stone and could
> > be a different file but I'm sure it's clear what question I'm asking.
> >
> My understanding is yes to this.
> Dnsmasq keeps it's database completely in ram while running. It updates 
> the disk "periodically" (ie 
> whenever the in ram changes), and calls some external events at the same time.
> To be precise I believe you need to first stop dnsmasq before erasing the disk cache (however, I
> regularly get away with doing so while it's running... ;-) )
I wasn't considering erasing/deleting the dnsmasq.leases file, I was
rather thinking of copying it to a non-running backup dnsmasq so that
if/when the running dnsmasq fails I can start the other and it will
give out the same IPs.

The only other issue is then how to tell 'everyone' that the DNS server has
changed address.

It's a pity that one can't associate an RJ-45 socket with a specific
IP address! :-)

Chris Green

More information about the Dnsmasq-discuss mailing list