Ping Scan a Subnet – Simple

Linux Random

If you need to perform a Ping scan of a subnet, you can use the following command, its quick and dirty approach, although its not really that quick when it comes to actually running. The below will scan the subnet 192.168.1.0/24, from 192.168.1.1 to 192.168.1.254.

for ip in $(seq 1 254); do ping -c 1 192.168.1.$ip; done

If you want to speed things up a bit, you can add the “-t 1” timeout option, so it doesn’t wait for the default timeout, but you might reduce the accuracy of the results, if something doesn’t immediately respond which may be the case if those two hosts have not got each other’s MAC addresses in their ARP cache and need to learn it.

for ip in $(seq 1 254); do ping -c 1 -t 1 192.168.1.$ip; done

Leave a Reply

Your email address will not be published. Required fields are marked *