Q. How do I ping a block of hosts such as 192.168.1.0/24?
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 192.168.1.0/24, the specified command line could look like either:
$ fping -g 192.168.1.0/24
OR
$ fping -g 192.168.1.0 192.168.1.255
ping command
You can also use ping command, enter:
for i in {1..254}; do ping -c1 192.168.1.$i; done
There are other options like nmap, nbtscan, Windows NT / Server specific loop discussed here.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 6 comments… read them below or add one }
It should be like this command:
for i in {1..254}; do ping -c1 192.168.1.$i; done
Thanks for the heads up.
Perfect…thank you for the post.
I use Nmap
# nmap -sP 192.168.0.*
or
# nmap -sP 192.168.0.1-200
That is awesome. Also like the nmap version :)
what about the same procedure in RHEL 5