[这个贴子最后由坏的刚刚好在 2005/10/10 08:08pm 第 1 次编辑]
platinum
代码:
for ((i=55;i<=58;i++));do ping -c 1 172.168.1.$i;done
==========================================
vi /bin/pingrange :
代码:
#! /bin/bash
if [ "$1" = "" ];then
echo -e "Example: pingrange 192.168.0.1-30\n"
exit
fi
IP1=`echo $1|awk -F[.-] ';{print $(NF-1)}';`
IP2=`echo $1|awk -F- ';{print $NF}';`
IP=`echo $1|awk -F[.-] ';{print $1"."$2"."$3"."}';`
for((i=$IP1;i<=$IP2;i++));do
if !(ping -c1 -w1 $IP$i|grep ';bytes from';);then
echo "$IP$i timed out."
fi
done
echo
==========================================
chmod a+x /bin/pingrange
[root@PT-LINUX root]# pingrange
Example: pingrange 192.168.0.1-30
[root@PT-LINUX root]# pingrange 172.17.39.1-3
172.17.39.1 timed out.
172.17.39.2 timed out.
172.17.39.3 timed out.
[root@PT-LINUX root]# pingrange 172.25.39.1-3
64 bytes from 172.25.39.1: icmp_seq=0 ttl=128 time=0.325 ms
64 bytes from 172.25.39.2: icmp_seq=0 ttl=128 time=0.358 ms
172.25.39.3 timed out.
[root@PT-LINUX root]#
|