The difference between ping and fping is that the fping tool can be used to send a ping (ICMP echo) request to several hosts at once. You can specify several targets on the command line, or you can use a file containing the hosts to be pinged.
In the default mode, fping works by monitoring the reply from the target host. If the target host sends a reply, it will be noted and removed from the target list. If the host doesn't respond within a certain time limit, it will be marked as unreachable. By default, fping will try to send three ICMP echo request packets to each target.
To access fping, you can use the console to execute the following command:
# fping -h
This will display the description of usage and options available in fping.
The following scenarios will give you an idea of fping usage.
If we want to know the alive hosts of 172.16.43.156, 172.16.43.150, and 172.16.43.155 at once, we can use the following command:
fping 172.16.43.156 172.16.43.150 172.16.43.155
The following is the result of the preceding command:
# fping 172.16.43.156 172.16.43.150 172.16.43.155
172.16.43.156 is alive
172.16.43.150 is alive
ICMP Host Unreachable from 172.16.43.150 for ICMP Echo sent to 172.16.43.155
ICMP Host Unreachable from 172.16.43.150 for ICMP Echo sent to 172.16.43.155
ICMP Host Unreachable from 172.16.43.150 for ICMP Echo sent to 172.16.43.155
ICMP Host Unreachable from 172.16.43.150 for ICMP Echo sent to 172.16.43.155
172.16.43.155 is unreachable
We can also generate the host list automatically without defining the IP addresses one by one and identifying the alive hosts. Let's suppose we want to find the alive hosts in the 172.16.43.0/24 network; we can use the -g option and define the network to check, using the following command:
# fping -g 172.16.43.0/24
If we want to change the number of ping attempts made to the target, we can use the -r option (retry limit) as shown in the following command line. By default, there are three ping attempts:
fping -r 1 -g 172.16.43.149 172.16.43.160
The result of the command is as follows:
# fping -r 1 -g 172.16.43.149 172.16.43.160
172.16.43.150 is alive
172.16.43.156 is alive
172.16.43.149 is unreachable
172.16.43.151 is unreachable
172.16.43.152 is unreachable
172.16.43.153 is unreachable
172.16.43.154 is unreachable
172.16.43.155 is unreachable
172.16.43.157 is unreachable
172.16.43.158 is unreachable
172.16.43.159 is unreachable
172.16.43.160 is unreachable
The cumulative statistics can be displayed by employing the -s option (print cumulative statistics), as follows:
fping -s www.yahoo.com www.google.com www.msn.com
The following is the result of the preceding command line:
#fping -s www.yahoo.com www.google.com www.msn.com
www.yahoo.com is alive
www.google.com is alive
www.msn.com is alive
3 targets
3 alive
0 unreachable
0 unknown addresses
0 timeouts (waiting for response)
3 ICMP Echos sent
3 ICMP Echo Replies received
0 other ICMP received
28.8 ms (min round trip time)
30.5 ms (avg round trip time)
33.6 ms (max round trip time)
0.080 sec (elapsed real time)