Preserve lease database during reboot?

Is there a way to preserve the lease database (/tmp/dhcp.leases) during a reboot?

https://lede-project.org/docs/user-guide/dns_configuration
Just set the leasefile option to store it somewhere else except /tmp.

I recommend some cheap USB stick that you can replace as soon it got fried due to excessive write requests.

But I don't get why you would want this. If your LEDE device reboots quick enough, your clients shouldn't loose their leases and just ask to "reissue the old IP". If your LEDE device doesn't have a lease (because it rebooted), it should just issue a completely new lease that contains the IP address the client had before.

You will run into trouble if you set lease times to something like 2m, but as long as you have something between 30m and 12h, you shouldn't run in to troubles at all.

The lower you set your lease time (hence: The more likely you run into troubles with a non persistent lease file), the more likely to fry the USB stick storing the persistent version of the lease file early.


Here I tried to explain how DHCP renewals work. The leasetime directly influences T1 and T2, and T2 is the point where clients stop ask to reissue an existing lease and start asking for a new one.

Regards,
Stephan.

Thanks, Yeah I see it really doesn't make a difference as long as router/DHCP server reboots are quick.

I assign a static IP address to all the devices on my LAN in the DHCP file.

config host
option name '[device name]'
option mac '[MAC]'
option ip '192.168.XXX.XXX'

I started doing this as some device, at least in Windows, did not pass their name so it was tough to figure out who was on my LAN. I'm over 2 dozen leases

Anything else is on a guest AP.

I assign hostnames but not static IPs in the DHCP config file, precisely because some clients do not provide a hostname. I also do it for those clients that have both wifi and ethernet and send the same hostname on both (e.g. macos). The DHCP server still assigns them IP addresses, and also puts the hostnames into the DNS so you can access by name if needed. And, they show up in the status web pages with hostnames