[Dnsmasq-discuss] Howto reclaim all dhcp leases after router reboot
Tuxo
tuxoholic at hotmail.de
Fri Sep 25 13:39:04 BST 2020
Hi Matus,
Thanks for replying so quickly to my request.
On 25.09.20 11:39, Matus UHLAR - fantomas wrote:
>
> why the need to reclaim them?
>
Because I like to have a place (file) where I can see what leases have
been given out, to what IP address and what hostname is currently using
them.
It's all dynamically assigned, so it can change depending on what new
devices show up like mobile phones or tablets and what devices have
already left - some of them without properly signing off to the router.
I simply don't know a better way except monitoring syslog, which is more
cumbersome than just checking a single file with all the current leases
in it.
>
> 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.
>
Yes, that is true and I indeed completely forgot about that! If I change
it back to /var/lib/misc/dnsmasq.leases the file will survive a shutdown.
I hope dnsmasq will eventually clean up the "dead" leases from all the
devices that forgot to send a proper dhcp release request before the
client shuts down. IIRC all my Windows machines and my tablets forget to
do it.
I assume inactive devices will remain listed until the lease time
expires? If not, I end up with an untidy lease file, where most of the
entries are no longer actively in use. That would render the file
useless. I'll have to check that thoroughly, probably best to keep the
lease time short then.
Thanks, I guess that solves my issue for now, otherwise I'll report back
with new questions.
Regards,
Tuxo
More information about the Dnsmasq-discuss
mailing list