OPNsense Forum

Archive => 16.1 Legacy Series => Topic started by: unquietwiki on February 06, 2016, 04:19:40 am

Title: Easiest way to delete expired DHCP leases? Or feature request for that ability?
Post by: unquietwiki on February 06, 2016, 04:19:40 am
It seems despite DHCP being set to have leases on a 6-12h period, I have a backlog of leases going back to August. Just updated to 16.1 from 15.7, so curious to see if there's a safe way to purge the old expired leases, or if a feature could be added to wipe out all expired or offline leases. Thanks!
Title: Re: Easiest way to delete expired DHCP leases? Or feature request for that ability?
Post by: jstrebel on February 10, 2016, 09:22:38 am
I have seen this as well in the 8.4 BSD version using in monowall. After some investigation I came to the conclusion this is how the DHCP Server works. It seems he has no aging built in.
Any comments to this from the experts?
Jakob
Title: Re: Easiest way to delete expired DHCP leases? Or feature request for that ability?
Post by: weust on February 10, 2016, 11:58:23 am
Might it not be that an expired lease may stay in the log until all addresses in the pool have been issued, and then it will overwrite expired ones?
Would need to look deeper into it, but that sounds plausible to me.
A way to avoid duplicate IP addresses, just in case, etc.
Title: Re: Easiest way to delete expired DHCP leases? Or feature request for that ability?
Post by: smajor on February 14, 2016, 03:57:19 pm
Many DHCP services work like this by design, they won't start re-issuing used DHCP addresses if there are previously unused ones in the IP range given to it EVEN IF those leases have expired.

The simple answer is if that same device comes back onto the network at some point in the future it'll get (re)assigned the address it had before, even if its lease had expired. This can have some benefits both for logging and for devices that are really aggressive about getting the same address as they did once-upon-a-time.

Typically, once the never-used leases have been issued, it'll probably start from the bottom of the range and re-issue the oldest ones in a round-robin sort of fashion.

I've not hit the top of the range I assigned with my OpnSense install yet, but this seems to be the pattern it is following.
Title: Re: Easiest way to delete expired DHCP leases? Or feature request for that ability?
Post by: franco on February 15, 2016, 07:40:48 am
Looks like you've been on the right track... https://lists.isc.org/pipermail/dhcp-users/2012-March/015052.html