how to count IPs in use

John Hascall john at
Mon Oct 5 12:28:25 UTC 2009

> I'd like to find out how many IPs are in use (from the point of view of
> my dhcp server). First I thought it would just be a matter of counting
> the leases that have "binding state active" in dhcpd.leases. However
> there are quite a few leases that have this line, but also have the
> "ends" date in the past. So, I'm a bit confused. 

[See previous replies about dhcpstatus]

If you are of a mind to 'roll your own' (we do because
we have it report into Zymon (nee hoBBit (nee BB))),
you need to know that a lease can be in 4 states:

   free - not mentioned in lease file at all
   abandoned - binding state abandoned
   expired - binding state active/free & end is in the past
   leased - binding state active & end is not in the past

note that multiple lease records for an ip address can
be found in the lease file - only the last one matters.


More information about the dhcp-users mailing list