灌溉梦想,记录脚步
« »
2011年5月25日技术合集

简单PING测试脚本

这里介绍两个在linux下用脚本进行连通性(ping)测试的脚本。
1,基于连续IP的ping脚本

1
2
3
4
5
6
7
#!/bin/sh
#
ip="192.168.3."
for i in `seq 1 13`
do
ping -c 2 $ip$i | grep -q 'ttl=' && echo "$ip$i OK" || echo "$ip$i NOT OK"
done

保存为ping.sh,然后添加权限并执行。
#chmod +x ping.sh
#./ping.sh
脚本ping判断成功与否以是否出现ttl值为准。

2、基于文件中IP列表的测试

首先创建一文本文件,这里命名为iplist,每行有一个IP地址。

1
2
3
192.168.3.1
192.168.3.11
192.168.3.111

脚本内容

1
2
3
4
5
6
#!/bin/sh
#
for i in `cat iplist`
do
ping -c 1 $i | grep -q 'ttl=' && echo "$i OK" || echo "$i NOT OK"
done

保存为ping.sh,然后添加权限并执行,注意要和iplist在同一目录中。
#chmod +x ping.sh
#./ping.sh

日志信息 »

该日志于2011-05-25 21:52由 kevin 发表在技术合集分类下, 你可以发表评论。除了可以将这个日志以保留源地址及作者的情况下引用到你的网站或博客,还可以通过RSS 2.0订阅这个日志的所有评论。

13 条评论

  1. cheap androxal cheap pharmacy

    buy androxal generic pharmacy in canada

  2. buying enclomiphene canada mail order

    discount enclomiphene generic real

  3. cheapest buy rifaximin canada purchase

    buying rifaximin canadian sales

  4. get xifaxan generic is it legal

    buy xifaxan generic no prescription

  5. cheap staxyn generic alternatives

    discount staxyn no prescription mastercard

  6. purchase avodart usa discount

    avodart online pharmacy canada cheap

  7. order dutasteride lowest price

    buy cheap dutasteride generic health

  8. buying flexeril cyclobenzaprine usa cheap

    buy flexeril cyclobenzaprine cheap generic uk

  9. buy gabapentin buy japan

    buy cheap gabapentin without prescriptions uk

  10. fildena without a prescription or doctor

    cheapest buy fildena cheap wholesale

  11. get itraconazole cheap online no prescription

    get itraconazole australia discount

  12. kamagra přenocování cod bez lékařského předpisu

    nákup kamagra v mexiku

  13. sans ordonnance kamagra pharmacie gratuit comprime acheter en ligne

    sans ordonnance kamagra envoyer buy online

发表回复