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 04:23:33.031816+01 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 05:07:06.800508+01 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 07:35:22.246534+01 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 14:53:44.096569+01 by: meuon

fping and nmap -sP 192.168.0.0/24 do this well also,

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

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

Thanks!

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

Gee, I generally do a "ping -b 192.168.1.255". 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 01:28:07.129055+01 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 07:02:34.962748+01 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.

Comment policy

We will not edit your comments. However, we may delete your comments, or cause them to be hidden behind another link, if we feel they detract from the conversation. Commercial plugs are fine, if they are relevant to the conversation, and if you don't try to pretend to be a consumer. Annoying endorsements will be deleted if you're lucky, if you're not a whole bunch of people smarter and more articulate than you will ridicule you, and we will leave such ridicule in place.


Flutterby™ is a trademark claimed by

Dan Lyke
for the web publications at www.flutterby.com and www.flutterby.net.