Ping allows you to check if the IP address verify if the host is up or not. Ping is used by system administrators and even network security professionals. However, if you have a long list of IP addresses to be verified, it can turn out to be very annoying. Here scripts come to rescue!!
Using shell scripting a person can ping a range of IP addresses or even the whole subnet at the same time. Isn’t it a whole lot easier now?
You can do this using a simple script which we have shown below:
Note: We have written this script using sublime text and saved it with extension “.sh”
I would like to explain this script a little bit so that you can customize it according to your needs.
seq is used to indicate the range of IPs that you wish to scan ( I used seq 1 254, allowing me to scan the whole subnet) you can adjust it according to your requirements.
-c is used to set the count (I used it as -c 1, which limits me to ping each IP once). It is recommended to use count as 1 because it will create unnecessary ping requests.
$SUBNET.$IP combines the subnet which I have provided with the seq of IP. Again! You can be creative here according to your needs.
Author: Mohammad Usman Rais (IT Security Engineer)