LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-23-2008, 07:14 AM   #1
matiasquestions
Member
 
Registered: Sep 2005
Posts: 65

Rep: Reputation: 15
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!
 
Old 07-23-2008, 07:44 AM   #2
zer0python
Member
 
Registered: Sep 2003
Posts: 104

Rep: Reputation: 20
Cool 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.
 
Old 07-24-2008, 02:57 AM   #3
matiasquestions
Member
 
Registered: Sep 2005
Posts: 65

Original Poster
Rep: Reputation: 15
Finally, I found this great tool:

http://dhcpstatus.sourceforge.net/


Maybe it helps somebody else.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding your own IPs to socksify/torify Tor list? SentralOrigin Linux - Software 1 03-28-2008 06:05 PM
Block list of IPs with SuSEFIREWALL2 mephitic Linux - Security 1 12-05-2004 01:50 AM
Shell script for insert ip address into an ordered list of IPs inTrouble? Linux - Newbie 2 10-27-2003 02:21 AM
red hat linux 7.2 unleased book vs 9 ronss Red Hat 2 09-23-2003 08:55 PM
IPs list eduac Linux - Networking 6 08-14-2003 01:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration