Flutterby™! : Ping lots

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

Ping lots

2006-01-03 03:23:33.031816+00 by Dan Lyke 7 comments

Because sometimes you just wanna find out what's out there...

perl -le 'for ($i = 1; $i < 255; $i++) { print "checking $i"; open I, "ping -t 1 -c 1 192.168.1.$i |"; while (<I>) { print if (/bytes from/); } close I; }'

(If this doesn't make sense to you, don't worry about it, there's a certain level of nerdliness you have to have to make this useful, and once you're there you'd understand it.)

[ related topics: Perl ]

comments in ascending chronological order (reverse):

#Comment Re: made: 2006-01-03 04:07:06.800508+00 by: dws

Is it nerdly to notice that your dollar variable got eaten, and to hypothesize that your blog code is doing macro expansions on your behalf?

#Comment Re: made: 2006-01-03 06:35:22.246534+00 by: Dan Lyke

Whoops. Yes. And dang it, that code shouldn't be routed through the output formatter that understands variable expansion. Hmmmm...

#Comment Re: made: 2006-01-03 13:53:44.096569+00 by: meuon

fping and nmap -sP do this well also,

#Comment Re: made: 2006-01-03 15:41:27.578089+00 by: Dan Lyke

Aha! That's the answer I was fishing for!


#Comment Re: made: 2006-01-03 20:02:48.288549+00 by: spc476

Gee, I generally do a "ping -b". Then again, I usually work in Linux environments where that works, wereas Window systems don't seem to reply to a broadcast ping (probably for the betterment of the Internet now that I think about it).

#Comment Re: made: 2006-01-04 00:28:07.129055+00 by: Dan Lyke [edit history]

Oh, and for the record neither nmap, fping, nor a ping that'll do a "-b" are installed by default on Mac OS/X[Wiki]. But fink came to the rescue.

(Ah: ping to the broadcast address works without the "-b".)

#Comment Re: made: 2006-01-04 06:02:34.962748+00 by: meuon

Note: On many Linux/*nix systems, the broadcast address is routed to "lo" and you'll have to change, or even add a route for the broadcast address of the network. Pinging the network address is useful as well. But many properly setup systems will not respond to a broadcast ping, or even a directed ping. In these cases, nmap is king.