Nethsec and Dynamic leases

Hi, I have a question about dynamic leases on DHCP. After restarting NethSecurity, I found the table empty. Is it possible to keep the DHCP table filled until the leases time out even if I reboot?
Could be a problem for local DNS resolv.
Thank you

1 Like

Yes, it’s possible: Persistent lease file - #3 by vevere - Network and Wireless Configuration - OpenWrt Forum

Still, it should not be a real problem: dhcp clients try to renew the lease once a in while.

You’re right that NethSecurity shouldn’t be restarted, but if I lose the dynamic leases, I can’t resolve the names until clients ask for DHCP renewal. A solution can be set up with a short renewal time, but in a structured environment there can still be problems.
An example could be connections between IoT devices or RDP connections in the company network. Could it be a solution, if I add storage to NethSecurity, to save to storage and restore dynamic leases on boot?

You do not need to: just follow the instruction on the linked post and set the path of the lease file within a persistent directory, like:

uci dhcp.@dnsmasq[0].leasefile='/etc/dhcp.leases'
uci commit dhcp
service dnsmasq restart

If you want to preserve it also across reboot, add the file to the backup:

echo '/etc/dhcp.leases' >> /etc/sysupgrade.conf
1 Like

Thank you, mine was a suggestion for a future feature.
I will this after our production nethbox migration. Not now.
Thank you for support.

1 Like