Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Pinging IP Address Range

by neuhru (Novice)
on Mar 22, 2013 at 23:40 UTC ( #1024992=perlquestion: print w/ replies, xml ) Need Help??
neuhru has asked for the wisdom of the Perl Monks concerning the following question:

Hello PerlMonks,

What is the best way to ping a range of IP addresses to determine if they are active? Ranges include "172.31", "192.168", and "10.254".

Please help get me started down the path to achieving this. Let me know if any additional information is required.

Thanks in advance,


Comment on Pinging IP Address Range
Replies are listed 'Best First'.
Re: Need Help Determining DHCP IP Address Range
by NetWallah (Abbot) on Mar 23, 2013 at 06:13 UTC
    You need to know the MAC address of the switch, or , at least the MAC prefix (The first three octets of a six-octet ethernet address uniquely identifies the hardware vendor - This is called the "Organizationally Unique Identifier" (OUI)) of the manufacturer.

    You can look this up for your vendor at

    If you have access to your DHCP server, you should be able to match this MAC prefix or address with the list of DHCP-distributed addresses, and determine the IP address.

    If you do not have access to DHCP, but are on the same unrouted subnet as the switch, you can ping the entire subnet range, then look at your arp table, then find the mac for the Infiniband switch, and trace back to the IP.

                 "I'm fairly sure if they took porn off the Internet, there'd only be one website left, and it'd be called 'Bring Back the Porn!'"
            -- Dr. Cox, Scrubs

Re: Need Help Determining DHCP IP Address Range
by hdb (Prior) on Mar 23, 2013 at 10:52 UTC

    Hmm: This is not really a Perl question...

    You could run some network scanning tool such as nmap. I got the following from

    nmap -O -oX test.xml

    which runs a very aggressive test on all machines and gives you a lot of information such as Vendor, OS, MAC, etc. On my machine you need to run this as root. Unless you own the network, this might be seen as an aggression.

    UPDATE: As always, you can probably do it within Perl as well as there is an Nmap::Scanner module in Perl which might achieve similar feats...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1024992]
Approved by Lotus1
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2015-11-27 13:35 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (729 votes), past polls