When does ISC dhcpd expire leases

dhcpdhcp-serverisc-dhcp

When exactly does ISC dhcpd forget a lease that is not explicitly freed by the client?

Context: I am running an installation with many small pools (3 address) and it does not seem to cope well when all three leases are taken. Nevertheless I see entries in dhcpd.leases-file whose end date has passed. Also, these entries are counted towards the number of used leases for the adaptive lease time feature. Shouldn’t these be considered unused?

Best Answer

The lease expires when its expiration time arrives.
ISC dhcpd does not remove the leases until it "needs" to (e.g. it ran out of IPs to assign, so now it will assign one from an expired lease).

This is to support an often-overlooked feature of DHCP -- the DHCP server will DHCPOFFER a given client (MAC address) the same address it's used previously, even if the lease for that address expired.
(Similarly many clients will DHCPREQUEST the last IP they had, on the off chance the network they're on now will let them have it again).


This is a separate problem from many small pools (3 address) and it does not seem to cope well when all three leases are taken -- If all the addresses are taken (have valid, unexpired leases using them) the DHCP server cannot hand out any more leases for that network.
Much like you would be very cross with your landlord if they let someone else sign a lease for the apartment you're living in while you're still there, your computers would be most displeased to find that their valid DHCP lease has a squatter claiming that address.

Related Topic