I moved the odhcpd lease file to a permanent storage.
But the lease file gets reset/deleted every reboot.
How to make the lease file persistent/survive a reboot?
uci show dhcp
- Do you need persistent lease file or static DHCPv6 leases?
- Does the lease file persist after you restart odhcpd?
- What happens when you stop the service, unmount the file system, and perform soft reboot?
uci show dhcp
dhcp.odhcpd=odhcpd dhcp.odhcpd.maindhcp='1' dhcp.odhcpd.leasefile='/mnt/sda1/odhcpd/dhcp.leases' dhcp.odhcpd.leasetrigger='/usr/lib/unbound/odhcpd.sh' dhcp.odhcpd.loglevel='3' dhcp.lan=dhcp dhcp.lan.interface='lan' dhcp.lan.dhcpv4='server' dhcp.lan.dhcpv6='server' dhcp.lan.ra='server' dhcp.lan.ra_default='1' dhcp.lan.ra_management='1' dhcp.lan.force='1' dhcp.lan.start='100' dhcp.lan.limit='99' dhcp.lan.leasetime='8d' dhcp.lan.domain='lan' dhcp.wan=dhcp dhcp.wan.interface='wan' dhcp.wan.ignore='1' dhcp.@host=host dhcp.@host.name='Host 1' dhcp.@host.mac='xx:xx:xx:xx:xx:xx' dhcp.@host.duid='00000000000000000000' dhcp.@host.ip='10.0.0.1' dhcp.@host.hostid='1' dhcp.@host=host dhcp.@host.name='Host 2' dhcp.@host.mac='xx:xx:xx:xx:xx:xx' dhcp.@host.ip='10.0.0.10' dhcp.@host=host dhcp.@host.name='Host 3' dhcp.@host.mac='xx:xx:xx:xx:xx:xx' dhcp.@host.duid='00000000000000000000' dhcp.@host.ip='10.0.0.50' dhcp.@host.hostid='50' dhcp.@host=host dhcp.@host.name='Host 3' dhcp.@host.mac='xx:xx:xx:xx:xx:xx' dhcp.@host.ip='10.0.0.250'
Haven't tried this yet.
I’m curious about the need for a persistent lease database. DHCP practice is generally to reserve IP addresses for hosts that need stable IPs, and use the pool for the rest.
A well-behaved client will ask to renew its IP address and a well-behaved server will grant the request unless it has been reassigned already.
odhcpd doesn't retain state. Yes, you can move the file around, but as far as odhcpd is concerned, the file is write-only - it never reads it back.
The real solution is still the same as the previous answer for dnsmasq, if you want static lease, then define them properly - instead of relying on the perceived persistency of dynamic leases.
The static leases work fine.
The "problem" is after reboot some devices (the ones that aren't directly connected, because their interfaces don't go into disconnect state and request a new lease immediately) don't show up on the overview page.
If a long lease time is used it takes a good amount of time until the devices send a renew request and showing up on the overview page again. Using a shorter lease time of 1h for example works but having odhcpd just read the lease file again would be great.
Why is ip6hint removed from luci in latest trunk?
Not intentionally, will look