Saturday, October 24, 2009

Let us ping range of IPs machine

Hi How to check the range of IPs with script

#!/bin/bash
#Author:- Deepak G Ghule
#Date :- 25/10/2009
#Subject :- Let us ping range of IPs to know the status of machine (UP/DOWN)
for i 192.168.1.{1..255}; //checks 192.168.1.x class of IPs
do
ping -c2 $i > /dev/null;
[ $? -eq 0 ] && echo $i is up
trap "exit" SIGINT //To force exit when Ctrl+c keystroke is applied
done

now save it as net.sh

now give the execute persmission with following command
[crackmind@crakmind.com~]#chmod +x /netsh.sh


thanks for visit my blogs