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

Matus UHLAR - fantomas uhlar at fantomas.sk
Fri Sep 25 10:39:50 BST 2020


On 25.09.20 10:17, Tuxo wrote:
>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.

why the need to reclaim them?

>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).

that's because the lease file is stored in /tmp , which resides on transient
filesystem on most routers, The filesystem gets empty and dhcp server has no
idea who used what IPs before.

>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.

I give home machines static IPs (using /etc/ethers and /etc/hosts) outside
of dynamic range. That way they aren't in lease file after reboot, but it's
much more likely to avoid collisions.

>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


-- 
Matus UHLAR - fantomas, uhlar at fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
My mind is like a steel trap - rusty and illegal in 37 states.



More information about the Dnsmasq-discuss mailing list