Tuesday, August 18, 2009

Linux / UNIX: Ping a Block of Hosts (netblock)

SkyHi @ Tuesday, August 18, 2009
Q. How do I ping a block of hosts such as

A. You can use ping or fping. The -g option generate a target list from a supplied IP netmask, or a starting and ending IP. Specify the netmask or start/end in the targets portion of the command line.
fping command

To ping the class C, the specified command line could look like either:
$ fping -g
$ fping -g
ping command

You can also use ping command, enter:

for i in {1..254}; do ping -c1 192.168.1.$i; done

Reference: http://www.cyberciti.biz/faq/linux-unix-ping-a-block-of-hosts-netblock/