SHIDOU

1、
arp    i  指定网卡     a 查看arp表,显示主机名称和ip      n 查看arp表,并且用ip显示而不是主机名称
 
2、


119 ~/M2/image-installer-bak$ 脚本

 
3、

sdcm@sdcm:~$ cat ping.sh1
#!/bin/bash
IP=(
172.16.0.200
172.16.0.201
172.16.0.202
172.16.0.203
172.16.0.204
172.16.0.205
172.16.0.210
172.16.0.211
172.16.0.212
172.16.0.213
172.16.0.214
172.16.0.215
172.16.0.216
172.16.0.217
)
echo "Start ping at : "`date +%Y-%m-%d-%H:%M:%S`
for PING in ${IP[*]} ;do
CHECK=`ping -c 1 -w 1 $PING |grep "time="|awk '{print $4}'`
if [ "$CHECK" = "" ];then
echo ${PING}"---""OFFLINE..."`date +%Y-%m-%d-%H:%M:%S`
else
echo ${PING}"---""OK---OK..."`date +%Y-%m-%d-%H:%M:%S`
fi
done
echo "Finished ping at : "`date +%Y-%m-%d-%H:%M:%S`
sdcm@sdcm:~$ ./ping.sh1
Start ping at : 2014-10-30-11:53:03
172.16.0.200---OK---OK...2014-10-30-11:53:03
172.16.0.201---OK---OK...2014-10-30-11:53:03
172.16.0.202---OK---OK...2014-10-30-11:53:03
172.16.0.203---OK---OK...2014-10-30-11:53:03
172.16.0.204---OK---OK...2014-10-30-11:53:03
172.16.0.205---OK---OK...2014-10-30-11:53:03
172.16.0.210---OK---OK...2014-10-30-11:53:03
172.16.0.211---OK---OK...2014-10-30-11:53:03
172.16.0.212---OK---OK...2014-10-30-11:53:03
172.16.0.213---OK---OK...2014-10-30-11:53:03
172.16.0.214---OK---OK...2014-10-30-11:53:03
172.16.0.215---OK---OK...2014-10-30-11:53:03
172.16.0.216---OK---OK...2014-10-30-11:53:03
172.16.0.217---OK---OK...2014-10-30-11:53:03
Finished ping at : 2014-10-30-11:53:03
sdcm@sdcm:~$ ping -c 1 -w 1 172.16.0.200
PING 172.16.0.200 (172.16.0.200) 56(84) bytes of data.
64 bytes from 172.16.0.200: icmp_req=1 ttl=64 time=0.835 ms

--- 172.16.0.200 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.835/0.835/0.835/0.000 ms
sdcm@sdcm:~$ ping -c 1 -w 1 172.16.0.200 |grep time\=
64 bytes from 172.16.0.200: icmp_req=1 ttl=64 time=0.839 ms

 

 


arp -an -i br0 |grep -v incom |grep -v 172.16.0. |awk -F "(" '{print $2}'|awk -F ")" '{print $1}'|sort

 

 

 

 

4、

sdcm@sdcm:~$ ./td.sh 
Found AP:
172.16.0.200 172.16.0.201 172.16.0.202 172.16.0.203 172.16.0.204 172.16.0.205 172.16.0.206 172.16.0.207 172.16.0.210 172.16.0.211 172.16.0.212 172.16.0.213 172.16.0.214 172.16.0.215 172.16.0.216 172.16.0.217
Check AP...ping 3 times
16 AP:

172.16.0.200: time=0.943 ms
172.16.0.200: time=0.821 ms
172.16.0.200: time=0.820 ms

172.16.0.201: time=0.907 ms
172.16.0.201: time=0.815 ms
172.16.0.201: time=0.817 ms

172.16.0.202: time=0.437 ms
172.16.0.202: time=0.373 ms
172.16.0.202: time=0.367 ms

172.16.0.203: time=0.439 ms
172.16.0.203: time=0.366 ms
172.16.0.203: time=0.371 ms

172.16.0.204: time=0.449 ms
172.16.0.204: time=0.475 ms
172.16.0.204: time=0.375 ms

172.16.0.205: time=0.410 ms
172.16.0.205: time=0.297 ms
172.16.0.205: time=0.361 ms

172.16.0.206: time=0.915 ms
172.16.0.206: time=0.792 ms
172.16.0.206: time=0.732 ms

172.16.0.207: time=0.907 ms
172.16.0.207: time=0.832 ms
172.16.0.207: time=0.804 ms

172.16.0.210: time=0.928 ms
172.16.0.210: time=0.842 ms
172.16.0.210: time=0.843 ms

172.16.0.211: time=1.07 ms
172.16.0.211: time=0.974 ms
172.16.0.211: time=0.968 ms

172.16.0.212: time=1.09 ms
172.16.0.212: time=0.998 ms
172.16.0.212: time=1.00 ms

172.16.0.213: time=1.13 ms
172.16.0.213: time=1.00 ms
172.16.0.213: time=1.00 ms

172.16.0.214: time=0.971 ms
172.16.0.214: time=0.883 ms
172.16.0.214: time=0.847 ms

172.16.0.215: time=1.11 ms
172.16.0.215: time=0.980 ms
172.16.0.215: time=0.999 ms

172.16.0.216: time=0.977 ms
172.16.0.216: time=0.860 ms
172.16.0.216: time=0.797 ms

172.16.0.217: time=1.07 ms
172.16.0.217: time=1.06 ms
172.16.0.217: time=1.01 ms

Found client ip:
172.16.2.28 172.16.2.192 172.16.2.203 172.16.3.17 172.16.3.69 172.16.3.87

Check client ip...ping 3 times
6 client ip:

172.16.2.28: time=259 ms
172.16.2.28: time=82.7 ms
172.16.2.28: time=107 ms

ping 172.16.2.192 failed...

172.16.2.203: time=35.4 ms
172.16.2.203: time=48.9 ms
172.16.2.203: time=79.5 ms

172.16.3.17: time=56.2 ms
172.16.3.17: time=73.7 ms
172.16.3.17: time=90.9 ms

172.16.3.69: time=310 ms
172.16.3.69: time=205 ms
172.16.3.69: time=159 ms

172.16.3.87: time=93.1 ms
172.16.3.87: time=110 ms
172.16.3.87: time=31.7 ms

sdcm@sdcm:~$ 
posted on 2014-11-13 17:31  寒星12345678999  阅读(890)  评论(0编辑  收藏  举报