好的,费话不多说,直接看题。
vi sh17.sh
------------------------------------------------------------------------
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
network="192.168.190"
for sitenu in $(seq 1 254)
do
ping -c 1 -w 1 > /dev/null 2>&1 && result=0 || result=1
if [ "$result" == 0 ]; then
echo "server ${network}.${sitenu} is up."
else
echo "server ${network}.${sitenu} is down."
fi
done
----------------------------------------------------------------------------
这个程序就可以测试你的192.168.1900-255这个网段是有多少IP可以ping,多少Ping不通了。
阅读(6380) | 评论(0) | 转发(0) |