#!/bin/bash
echo " 该文本是正常IP" > pingzcpro.txt
echo " 该文本是异常IP" > pingbtpro.txt
read -p "请输入网段:(例:10.1)" WD
read -p "请输入SIP1(范围1-254)" WD3
read -p "请输入SIP2(范围1-254)" WD4
read -p "输入结束地址EIP1(范围SIP1-254)" WD5
read -p "请输入结束地址EIP2(范围SIP2-254)" WD6
for WD3 in $(seq $WD3 $WD5)
do
for WD4 in $(seq $WD4 $WD6)
do
ping -c 3 -i 0.2 -W 2 $WD.$WD3.$WD4 &> /dev/null
if [ $? -eq 0 ]
then
echo "该IP: $WD.$WD3.$WD4 可正常使用!"
echo "该IP: $WD.$WD3.$WD4 可正常使用!" >> /root/pingzcpro.txt
else
echo "该IP: $WD.$WD3.$WD4 异常!"
echo "该IP: $WD.$WD3.$WD4 异常">> /root/pingbtpro.txt
fi
done
done
自动测试IP
最新推荐文章于 2024-11-03 12:02:27 发布