how to know how many ip are assigned

Glenn Satchell Glenn.Satchell at uniq.com.au
Sat Jan 20 05:59:12 UTC 2007


>X-Original-To: dhcp-users at webster.isc.org
>Date: Fri, 19 Jan 2007 22:49:42 +0000
>To: dhcp-users at isc.org
>From: Simon Hobson <dhcp1 at thehobsons.co.uk>
>Subject: Re: how to know how many ip are assigned
>X-archive-position: 2677
>X-ecartis-version: Ecartis v1.0.0
>X-original-sender: dhcp1 at thehobsons.co.uk
>List-software: Ecartis version 1.0.0
>X-List-ID: <dhcp-users.isc.org>
>X-list: dhcp-users
>
>Luc T. wrote:
>
>>how can I know how many IPs in a subnet have been assigned? by 
>>looking at the dhcpd.leases file? do I need to look at the 
>>dhcpd.leases~ file?
>
>Yes. But there are already a couple of scripts that will do it for 
>you - try the mail archives. IIRC there's at least one stand alone 
>script, and at least one cgi script so you can find out remotely with 
>your web browser.
>
>>   when an assigned IP is released by the client, will dhcpd delete 
>>the entry in the dhcpd.lease file? I mean if I can conclude that an 
>>IP is available if the IP can not be found in the dhcp.leases file.
>
>Two different questions there. To the first, no it does not delete 
>the record of a lease - it is left so as to allow the same address to 
>be allocated should the client return to the network. Expired leases 
>should be identified as such though.
>
>To the second, yes - with the proviso that you have to parse the 
>config file to know what addresses are included in pools before you 
>can work out which of them are free.
>
>
Have a look at the dhcpd.leases man page to see the format of the
entries and how they are stored.

Essentially this file is like a log, with new entries added to the end
of the file only. Thus a later record supercedes an earlier one for
that IP address. Periodically the system re-writes the file, with only
th elast record for each IP address stored in the new file.

One of many tools for querying the lease usage is dhcpstatus, available
from http://dhcpstatus.sourceforge.net/ There have been some comments
on the list about this, so a search will bring up those.

regards,
-glenn


More information about the dhcp-users mailing list