Fping es un comando para enviar peticiones ICMP a muchos host. Es más eficiente que el tradicional ping. fping difiere totalmente de ping en que puede definir cualquier número de hosts en la línea de comando o especificar un archivo con la lista de direcciones IP o hosts para hacer ping.
Uso
- Uso básico, confirmar si la ip 8.8.8.8 sea alcanzable.
[aurlen@monitor expect]$ fping 8.8.8.8
8.8.8.8 is alive
- Enviar 5 paquetes icmp ( -c 5) a la ip 8.8.8.8 y a yahoo.com , que no muestre el nombre solo la IP (-A), que muestre un timestamp (-D), enviar un paquete cada 500 ms (-i 500) y que imprima las estadisticas al final (-s)
[aurlen@monitor expec]$ fping -c 5 -AD -i 500 -s 8.8.8.8 yahoo.com
[1607224630.257646] 8.8.8.8 : [0], 84 bytes, 35.8 ms (35.8 avg, 0% loss)
[1607224630.813328] 98.137.11.164 : [0], 84 bytes, 91.3 ms (91.3 avg, 0% loss)
[1607224631.257806] 8.8.8.8 : [1], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[1607224631.813392] 98.137.11.164 : [1], 84 bytes, 91.2 ms (91.2 avg, 0% loss)
[1607224632.257983] 8.8.8.8 : [2], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[1607224632.813742] 98.137.11.164 : [2], 84 bytes, 91.3 ms (91.3 avg, 0% loss)
[1607224633.258162] 8.8.8.8 : [3], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[1607224633.813727] 98.137.11.164 : [3], 84 bytes, 91.1 ms (91.2 avg, 0% loss)
[1607224634.258364] 8.8.8.8 : [4], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[1607224634.814044] 98.137.11.164 : [4], 84 bytes, 91.2 ms (91.2 avg, 0% loss)
8.8.8.8 : xmt/rcv/%loss = 5/5/0%, min/avg/max = 35.7/35.7/35.8
98.137.11.164 : xmt/rcv/%loss = 5/5/0%, min/avg/max = 91.1/91.2/91.3
2 targets
2 alive
0 unreachable
0 unknown addresses
0 timeouts (waiting for response)
10 ICMP Echos sent
10 ICMP Echo Replies received
0 other ICMP received
35.7 ms (min round trip time)
63.5 ms (avg round trip time)
91.3 ms (max round trip time)
4.592 sec (elapsed real time)
[aurlen@monitor expec expect]$
- Para poder cambiar el formato de timestamp a fecha y hora, se puede usar el siguiente script con awk:
fping -AD -i 500 -t 100 -s -c 10 8.8.8.8 yahoo.com | while read row;
do
awk '{ sub(/[0-9]{10}/, strftime("%Y-%m-%d %H:%M:%S", substr($0,2,10))) }1' <<< "$row";
done
Salida:
[2020-12-05 21:23:55.898346] 8.8.8.8 : [0], 84 bytes, 35.8 ms (35.8 avg, 0% loss)
[2020-12-05 21:23:56.503783] 74.6.143.26 : [0], 84 bytes, 141 ms (141 avg, 0% loss)
[2020-12-05 21:23:56.898868] 8.8.8.8 : [1], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[2020-12-05 21:23:57.504495] 74.6.143.26 : [1], 84 bytes, 140 ms (141 avg, 0% loss)
[2020-12-05 21:23:57.899722] 8.8.8.8 : [2], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[2020-12-05 21:23:58.505260] 74.6.143.26 : [2], 84 bytes, 141 ms (141 avg, 0% loss)
[2020-12-05 21:23:58.900355] 8.8.8.8 : [3], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[2020-12-05 21:23:59.505739] 74.6.143.26 : [3], 84 bytes, 140 ms (140 avg, 0% loss)
[2020-12-05 21:23:59.900740] 8.8.8.8 : [4], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[2020-12-05 21:24:00.506260] 74.6.143.26 : [4], 84 bytes, 141 ms (141 avg, 0% loss)
[2020-12-05 21:24:00.901334] 8.8.8.8 : [5], 84 bytes, 35.8 ms (35.7 avg, 0% loss)
[2020-12-05 21:24:01.506814] 74.6.143.26 : [5], 84 bytes, 141 ms (141 avg, 0% loss)
[2020-12-05 21:24:01.901827] 8.8.8.8 : [6], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[2020-12-05 21:24:02.508029] 74.6.143.26 : [6], 84 bytes, 141 ms (141 avg, 0% loss)
[2020-12-05 21:24:02.902356] 8.8.8.8 : [7], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
[2020-12-05 21:24:03.507888] 74.6.143.26 : [7], 84 bytes, 141 ms (141 avg, 0% loss)
[2020-12-05 21:24:03.902775] 8.8.8.8 : [8], 84 bytes, 35.6 ms (35.7 avg, 0% loss)
[2020-12-05 21:24:04.508356] 74.6.143.26 : [8], 84 bytes, 141 ms (141 avg, 0% loss)
[2020-12-05 21:24:04.903351] 8.8.8.8 : [9], 84 bytes, 35.7 ms (35.7 avg, 0% loss)
8.8.8.8 : xmt/rcv/%loss = 10/10/0%, min/avg/max = 35.6/35.7/35.8
74.6.143.26 : xmt/rcv/%loss = 10/10/0%, min/avg/max = 140/141/144
2 targets
2 alive
0 unreachable
0 unknown addresses
1 timeouts (waiting for response)
20 ICMP Echos sent
20 ICMP Echo Replies received
0 other ICMP received
35.6 ms (min round trip time)
88.5 ms (avg round trip time)
144 ms (max round trip time)
9.650 sec (elapsed real time)
[2020-12-05 21:24:05.512014] 74.6.143.26 : [9], 84 bytes, 144 ms (141 avg, 0% loss)
[aurlen@monitor expec expect]$
Otras opciones comunes son:
-l Envía de manera indefinida paquetes, similar a la opción -t de ping de Windows.
-f lee la lista de IPs desde un archivo.