Ping Every IP in a Subnet
0
Updated over 10 years ago (30 Dec 2008 at 01:54 PM)
recent activity
In Brief | Pings every IP in the 192.168.xxx.xxx subnet; the particular subnet to ping can be changed of course.... more |
Language | (Ba)sh |
# 's
1for ((i=0;i<255;i+=1)); do
2 for ((j=0;j<255;j+=1)); do
3 #echo "ping -a -c 3 192.168.$i.$j"
4 if ping -a -t 1 192.168.$i.$j > /dev/null; then
5 echo "Success: 192.168.$i.$j"
6 else
7 echo -n "*"
8 fi
9 done
10done
Pings every IP in the 192.168.xxx.xxx subnet; the particular subnet to ping can be changed of course.
Waits 1 second for reply. (To change use the -t argument to ping.) Prints a success message if pingable, otherwise a '*'.
Comments
There's also a broadcast ping: `ping -b 192.168.1.255` which doesn't seem to work too well =)
Virtually nothing (except for macs!) responds to broadcast pings for some reason, although it's probably more secure that way.
It will probably crash but hey... it's cool++