Questions about handling DHCP leases

Hello

In my opinion DHCP lease should be deleted when the device disconnects. I know it is no problem but it would be easier to find active devices in the overview.

So why OpenWrt do not erase unactive leases from /tmp/dhcp.leases.

And another question to DHCP handling ... Why are DHCPv6 leases with unlimited time?

Thank U :slight_smile:

Does the client send a DHCP Release before disconnecting? If not, the dhcp server cannot know and has to wait for the lease to expire.

You can have it use the same time as DHCPv4.
uci set dhcp.lan.ra_useleasetime=1; uci commit dhcp; service odhcpd restart

2 Likes

That's not how DHCP works. When a lease is granted to a client it stays in the leases file until the lease is not renewed by the client and expires, not when the client disconnects. DHCP shouldn't be used to try and track active clients at a timeframe lower than your lease time.

The default lease time on openwrt is 12 hours. You can set it lower than this (up to a minimum of 2 minutes) to clear them out quicker when devices are disconnected if you really want to.

12 hours I believe.

1 Like

Ah, my bad, I was going on the standard dhcpd config, not whatever is bundled in OpenWrt. Apologies.

1 Like

Thank U.

No, the clients probably do not send a message that they are disconnecting. I did not think of that. I leave all settings as they are. It will all have its meaning.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.