Garbage collection?

Simon Hobson dhcp1 at
Wed Sep 9 07:09:29 UTC 2009

Peter Laws wrote:

>With the students back (all of whom apparently have iPhones!) we're 
>getting very close to the WiFi pool's max size.
>While we work on a long-term fix for that, what can I do to get that 
>cleanup process to run more frequently so that we aren't as likely 
>to run out of addresses?

As Glenn says, this is only a cleanup of the leases file, it does 
nothing whatsoever to the number of available leases. The only way to 
have more available leases is to change your address range and/or 
management policy.

Examples of changes you might make :

1) The most obvious is to add more addresses, though I realise this 
may be difficult.

2) Shorten lease times. If you have a high churn rate, then it's 
quite likely that you have a lot of leases that are active but the 
client has walked away. There is nothing the server can do about this 
- it cannot reclaim the lease before it expires*. However, if you 
have a long lease time then shortening it will mean that unused 
leases will expire more quickly and be available for re-use - at the 
expense of active clients renewing more often.

To put this in perspective, if you have 8 hour lease times, then 
every person that walks through with their iPhone set to 
automatically connect will then tie up a lease for anywhere up to 8 
hours after it's no longer on the network. The minimum 'dead time' 
should be about 4 hours since clients will normally renew at half the 
lease time. In practical terms then, it means leases tied up all day.

If you cut lease times to (say) 2 hours, then you cut that dead time 
down to between 1 and 2 hours. That means you have a lease available 
for up to four different people who walk through during a day 
(assuming this is a 'working day', yeah I know, students and 'working 
day' ...). Potentially this means doing with one address what was 
previously done with four. OK, this is a bit contrived and extreme, 
but it illustrates the point.

* You wrote :
>it appears that this is DHCPD going through and expiring leases that 
>it otherwise assumed were in use

You must erase this idea from your head, lease expiration is an 
ongoing task. When a lease reaches it's end time then it's expired - 
that's it (apart from some extra stuff if running failover, but we'll 
ignore that). The server cannot look around, decide a client has gone 
away, and expire it's lease - the client could come back at any time 
and continue using the lease it's got. The server and client have a 
'contract', the server is not allowed to break that. This does mean 
that you can have 'unused' address tied up for days or weeks when a 
client goes away - that's part of the tradeoff between stability from 
longer leases and quick reuse from short leases.

Simon Hobson

Visit for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

More information about the dhcp-users mailing list