[Dnsmasq-discuss] Copying dnsmasq.leases, any issues to be aware of?

Simon Kelley simon at thekelleys.org.uk
Sat Feb 5 11:06:02 UTC 2022


It could work; there's a whole IETF standard for DHCP failover and it's 
implemented beautifully by ISC dhcp. If that's your niche, then ISC is 
the way to go.

Simon.
rent instances of dnsmasq on the
> network
>    - use UDP to 'copy' each new lease  to the other instance
>    - on startup, use UDP to request a sync of known leases from the 
> other instance
>    - maybe sync local DNS entries as well (though it might be less 
> desirable for folks
>      like me who have 850k 'undefined' entries for ads, pron, warez, etc.)
> 
> Could this even work? Would it be worth the effort?
> 
> N
> ------------------------------------------------------------------------
> *From:* Dnsmasq-discuss 
> <dnsmasq-discuss-bounces at lists.thekelleys.org.uk> on behalf of Simon 
> Kelley <simon at thekelleys.org.uk>
> *Sent:* Friday, February 4, 2022 4:28 PM
> *To:* dnsmasq-discuss at lists.thekelleys.org.uk 
> <dnsmasq-discuss at lists.thekelleys.org.uk>
> *Subject:* Re: [Dnsmasq-discuss] Copying dnsmasq.leases, any issues to 
> be aware of?
> 
> 
> On 04/02/2022 18:16, Chris Green wrote:
>> I'm looking at ways to provide backup DHCP/DNS with dnsmasq.  This is
>> on a small, fairly 'quiet' home LAN so there aren't dozens of clients
>> connecting and disconnecting every second.  Also if DHCP/DNS is not
>> available for a few minutes the world won't end! :-)
>> 
>> So, I'm proposing to have dnsmasq installed on two systems, one (say
>> dns1, 192.168.1.2) is the live DHCP/DNS server, the other (say dns2,
>> 192.168.1.3), both with static IP.
>> 
>> If dns1 dies or needs to be turned off I just copy the dnsmasq
>> configuration (stored elsewhere as well of course) to dns2 and also
>> copy the dnsmasq.leases file and [re]start dnsmasq on dns2.  Will this
>> work reasonably OK?  I.e. if/when a system on the LAN broadcasts a
>> DHCP request will it get the same IP again?
>> 
>> It's not a disaster if a system gets a different IP anyway, if
>> something *really* needs a fixed IP I can add a dhcp-host in the
>> dnsmasq configuration.
>> 
>> I can even have dnsmasq running on dns2 all the time with it
>> configured to provide only local DNS and no DHCP, then it's just 'copy
>> dnsmasq configuration, copy dnsmasq.leases, restart dnsmasq.
>> 
>> (All my systems run syncthing so it's very easy to have pretty much
>> live copies of files synchronised across systems)
>> 
> 
> To be honest, even if you didn't bother copying the leases file, most
> systems would get the same address. The clients try to renew the lease
> on the exiting DHCP server and when they get no response they broadcast
> the renewal to try and find a new server. As long as there's no reason
> not to, the new server will accept the client's request for the address
> it already had.
> 
> 
> Cheers,
> 
> Simon.
> 
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss 
> <https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss>



More information about the Dnsmasq-discuss mailing list