
fping is an ICMP command line utility to verify ICMP reponses from any number of targets. fping is a better choice than ping for scripting tasks as it is able to check a list or range of IP addresses in numerical order to discover ICMP response. I’ll show you some basic info on using fping!
For rpm distros, fping is available in EPEL. Debian and Ubuntu, just sudo apt-get install fping.
Identify active hosts
Tack a is to identify hosts that are active. Here is a command I will often use. Tack s provides a summary at the end, and use tack g to specify a range.
$ fping -a -s -g 172.16.1.0/24
172.16.1.1
172.16.1.124
172.16.1.135
172.16.1.145
[snip]
254 targets
7 alive
247 unreachable
0 unknown addresses
247 timeouts (waiting for response)
995 ICMP Echos sent
7 ICMP Echo Replies received
928 other ICMP received
0.04 ms (min round trip time)
42.6 ms (avg round trip time)
149 ms (max round trip time)
26.654 sec (elapsed real time)
Identify offline hosts
Tack u for unreachable provides hosts that are unreachable.
$ fping -u -s -g 172.16.1.0/24
I like to send the results to a text file:
$ fping -u -g 172.16.1.0/24 > offline_hosts.txt $ fping -a -g 172.16.1.0/24 > online_hosts.txt
ICMP monitoring
fping is also good for monitoring. Response time statistics are possible with tack capital C against a target.
Here I am measuring the response time for scottlinux.com from my home workstation:
$ fping -C 5 173.230.156.66 173.230.156.66 : [0], 96 bytes, 88.6 ms (88.6 avg, 0% loss) 173.230.156.66 : [1], 96 bytes, 90.2 ms (89.4 avg, 0% loss) 173.230.156.66 : [2], 96 bytes, 87.6 ms (88.8 avg, 0% loss) 173.230.156.66 : [3], 96 bytes, 97.7 ms (91.0 avg, 0% loss) 173.230.156.66 : [4], 96 bytes, 86.5 ms (90.1 avg, 0% loss) 173.230.156.66 : 88.69 90.27 87.67 97.70 86.59
Or tack lower case c to output the summary in a different format:
$ fping -c 5 173.230.156.66 173.230.156.66 : [0], 96 bytes, 86.3 ms (86.3 avg, 0% loss) 173.230.156.66 : [1], 96 bytes, 87.3 ms (86.8 avg, 0% loss) 173.230.156.66 : [2], 96 bytes, 91.6 ms (88.4 avg, 0% loss) 173.230.156.66 : [3], 96 bytes, 92.0 ms (89.3 avg, 0% loss) 173.230.156.66 : [4], 96 bytes, 86.0 ms (88.6 avg, 0% loss) 173.230.156.66 : xmt/rcv/%loss = 5/5/0%, min/avg/max = 86.0/88.6/92.0
Unreachable looks like the following:
$ fping -C 5 172.16.1.201 ICMP Host Unreachable from 172.16.1.202 for ICMP Echo sent to 172.16.1.201 ICMP Host Unreachable from 172.16.1.202 for ICMP Echo sent to 172.16.1.201 ICMP Host Unreachable from 172.16.1.202 for ICMP Echo sent to 172.16.1.201 172.16.1.201 : - - - - -
Hack on,