Suponha que você tenha 5 IPs (para reduzir apenas a resposta) e, em seguida, pode executar ping com
#!/usr/bin/bash
for i in xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx xxx.xxx.xxx.xxxx
do
ping -c 5 $i
done
Nota: Não enrolar os colchetes, Sem vírgulas (,) entre os IPs.
Espero que ajude.
Ex:
[raja @ scripts]$ cat ping.sh
for i in 74.125.236.70 98.139.183.24 65.55.206.228 91.189.94.156 198.252.206.24
do
ping -c 5 $i
done
[raja @ scripts]$ ./ping.sh
PING 74.125.236.70 (74.125.236.70) 56(84) bytes of data.
64 bytes from 74.125.236.70: icmp_seq=1 ttl=128 time=11.5 ms
64 bytes from 74.125.236.70: icmp_seq=2 ttl=128 time=11.0 ms
64 bytes from 74.125.236.70: icmp_seq=3 ttl=128 time=10.9 ms
64 bytes from 74.125.236.70: icmp_seq=4 ttl=128 time=16.5 ms
64 bytes from 74.125.236.70: icmp_seq=5 ttl=128 time=18.2 ms
--- 74.125.236.70 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4025ms
rtt min/avg/max/mdev = 10.966/13.682/18.291/3.120 ms
PING 98.139.183.24 (98.139.183.24) 56(84) bytes of data.
64 bytes from 98.139.183.24: icmp_seq=1 ttl=128 time=244 ms
64 bytes from 98.139.183.24: icmp_seq=2 ttl=128 time=253 ms
64 bytes from 98.139.183.24: icmp_seq=3 ttl=128 time=255 ms
64 bytes from 98.139.183.24: icmp_seq=4 ttl=128 time=251 ms
64 bytes from 98.139.183.24: icmp_seq=5 ttl=128 time=243 ms
--- 98.139.183.24 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4251ms
rtt min/avg/max/mdev = 243.511/249.623/255.275/4.674 ms
PING 65.55.206.228 (65.55.206.228) 56(84) bytes of data.
From 10.22.96.94 icmp_seq=5 Packet filtered
--- 65.55.206.228 ping statistics ---
5 packets transmitted, 0 received, +1 errors, 100% packet loss, time 14002ms
PING 91.189.94.156 (91.189.94.156) 56(84) bytes of data.
64 bytes from 91.189.94.156: icmp_seq=1 ttl=128 time=240 ms
64 bytes from 91.189.94.156: icmp_seq=2 ttl=128 time=240 ms
64 bytes from 91.189.94.156: icmp_seq=3 ttl=128 time=240 ms
64 bytes from 91.189.94.156: icmp_seq=4 ttl=128 time=240 ms
64 bytes from 91.189.94.156: icmp_seq=5 ttl=128 time=240 ms
--- 91.189.94.156 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4242ms
rtt min/avg/max/mdev = 240.060/240.222/240.309/0.626 ms
PING 198.252.206.24 (198.252.206.24) 56(84) bytes of data.
64 bytes from 198.252.206.24: icmp_seq=1 ttl=128 time=237 ms
64 bytes from 198.252.206.24: icmp_seq=2 ttl=128 time=237 ms
64 bytes from 198.252.206.24: icmp_seq=3 ttl=128 time=237 ms
64 bytes from 198.252.206.24: icmp_seq=4 ttl=128 time=237 ms
64 bytes from 198.252.206.24: icmp_seq=5 ttl=128 time=242 ms
--- 198.252.206.24 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4251ms
rtt min/avg/max/mdev = 237.600/238.575/242.291/1.933 ms