Scan a range of IP addresses

Another post from SHELL-FU! (with some input from me too)

You may want to know which IP addresses have devices connected to them on a network segment. The following one-liner will ping scan a given range.

for IP in 192.168.1.{1..10}; do if ping $IP -c 1 > /dev/null; then echo $IP alive; else echo $IP dead; fi; done

Or, better still, how about this?

$ for i in `seq 1 255`; do ping -c 1 10.10.10.$i | tr n ' ' | awk '/1 received/ {print $2}'; done

But then you could do the same thing with NMAP, if you have it installed.

$ nmap -sP 192.168.1-255

And if you are not command line comfortable there are tools for PC’s, Mac’s, Linux etc out there. Just search google for ping sweep applications.

Feel free to share:
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Furl
  • LinkedIn
  • StumbleUpon
  • Technorati
  • TwitThis
  • Digg
  • MySpace
  • Ping.fm
  • Slashdot

Filed Under: Tech

Tags:

About the Author: I am the I.T. Director and Information Security Officer for an ecommerce / production company. I'm also a graphic designer; musician; martial arts instructor; pilot and all around creative genius.

RSSComments (0)

Trackback URL

Leave a Reply

You must be logged in to post a comment.