how to know how many ip are assigned

Simon Hobson dhcp1 at thehobsons.co.uk
Fri Jan 19 22:49:42 UTC 2007


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.



More information about the dhcp-users mailing list