[Dnsmasq-discuss] Howto reclaim all dhcp leases after router reboot

Petr Menšík pemensik at redhat.com
Tue Sep 29 09:29:20 BST 2020


Hi,

wouldn't it be more proper to fix occasional sync of leases to flash or
sdcard? Especially if you reboot your device on your command, I think it
should save leases to permanent store and restore it after boot.

It is not really dnsmasq specific to create such script. dhcp-leasefile
is supposed to be permanently stored. Rewriting in /tmp might be good
enough, but it should be synchronized to permanent storage occasionally.
It should be done definitely on reboot. DHCP server is the authority, it
should not fetch leases from client, but tell them instead.

Cheers,
Petr

On 9/25/20 10:17 AM, Tuxo wrote:
> Hi list,
> 
> I'm trying to find better ways to reclaim all active dhcp leases on my
> local subnet after my home router running dnsmasq occasionally has to
> reboot.
> 
> Usually after a reboot the lease file set with dhcp-leasefile= is empty
> and will remain empty until the client renews or rebinds it's lease (T1
> lease and T2 lease time).
> 
> I thought the dhcp-authoritative could be of help here, but that seems
> not to be the case for the dhcp-leasefile: it stays empty until the
> client does renew or rebind it's lease.
> 
> So my clumsy fix for the matter was a short lease time of 1h to make
> sure it would renew the lease after 30 minutes (T1 time) upon my router
> reboots.
> 
> I'd like to improve the server configuration, but don't know what else
> to try.
> 
> So without further ado here's my /etc/dnsmasq.conf file as it stands:
> 
> listen-address=127.0.0.1
> listen-address=192.168.10.1
> interface=br0
> dhcp-leasefile=/tmp/dnsmasq.leases
> dhcp-lease-max=20
> dhcp-range=192.168.10.10,192.168.10.90,255.255.255.0,1h
> dhcp-option=3,192.168.10.1
> dhcp-authoritative
> log-dhcp
> domain=MyDomain
> no-resolv
> stop-dns-rebind
> server=my.dns.provider.ip
> 
> Thanks for some enlightening input ...
> 
> Tuxo
> 
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss at lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
> 

-- 
Petr Menšík
Software Engineer
Red Hat, http://www.redhat.com/
email: pemensik at redhat.com
PGP: DFCF908DB7C87E8E529925BC4931CA5B6C9FC5CB




More information about the Dnsmasq-discuss mailing list