LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   How to get list or count of unleased ips from dhcpd3? (https://www.linuxquestions.org/questions/linux-networking-3/how-to-get-list-or-count-of-unleased-ips-from-dhcpd3-657667/)

matiasquestions 07-23-2008 07:14 AM

How to get list or count of unleased ips from dhcpd3?
 
Is there any way to know how many IPs are available (or have been leased to clients) on an ISC dhcp server?

I'm looking at the dhcpd.leases file, but it is just a log file... I think...


Thanks a lot!

zer0python 07-23-2008 07:44 AM

Kind of a hack!
 
This is kind of a hack, but it should work (presuming your not blocking ICMP pings)

Code:

list=$( grep -e 'lease .* {' dhcpd.leases | cut -f2 -d' ')
for ip in $list; do
  ping -c1 $ip >/dev/null 2>&1 && echo "$ip is taken"
done

As far as I know there is no way to actually get which ip addresses have actually been leased, and being used currently in the ip address pool.

matiasquestions 07-24-2008 02:57 AM

Finally, I found this great tool:

http://dhcpstatus.sourceforge.net/


Maybe it helps somebody else.


All times are GMT -5. The time now is 05:10 PM.