Ping Multiple Hosts At Once

fping is a command-line tool to send ICMP (Internet Control Message Protocol) echo request to network hosts, like ping. However, much higher performing when pinging multiple hosts. fping completely differs from ping therein you’ll be able to define any number of hosts on the command line or specify a file with the list of IP addresses or hosts to ping.

 

Installing fping

The package fping is available to install from the default package repositories using package management tool in most Linux versions.

On Debian/Ubuntu
 

sudo apt install fping

 
On CentOS/RHEL
 

sudo yum install fping

 
Alternatively, you can download and install it from package.
 

wget https://fping.org/dist/fping-4.0.tar.gz
tar -xvf fping-4.0.tar.gz
cd fping-4.0/
./configure
make && make install

 

Multiple IP Address

fping <ip1> <ip2> <ip3> <ip4>

You can check the connectivity of multiple hosts at once. Just type in the addresses separated by space.

 

$ fping 192.168.1.1 192.168.1.2 192.168.1.3 192.168.1.24

192.168.1.1 is alive
192.168.1.24 is alive
192.168.1.2 is unreachable
192.168.1.3 is unreachable

 

Multiple Domains

fping <domain1> <domain2> <domain3>

You can check the connectivity of multiple domains at once. Just type in the domain names separated by space.

 

$ fping google.com yahoo.com test.com

google.com is alive
yahoo.com is alive
test.com is unreachable

 

Range of IP Address

fping -s -g <ip1> <ip2>

This will fping a specified range of IP addresses. A cumulative result will be shown after exit (-s option). The option -g is to generate a target list from our input.

 

$ fping -s -g 192.168.1.20 192.168.1.25
192.168.1.20 is alive
192.168.1.21 is alive
192.168.1.22 is alive
192.168.1.24 is alive
192.168.1.25 is alive
192.168.1.23 is unreachable

6 targets
5 alive
1 unreachable
0 unknown addresses

1 timeouts (waiting for response)
9 ICMP Echos sent
5 ICMP Echo Replies received
4 other ICMP received

0.04 ms (min round trip time)
0.25 ms (avg round trip time)
0.37 ms (max round trip time)
4.167 sec (elapsed real time)

 

Complete Network

fping -g -r 1 <IP subnet>

With the above command, it will ping the complete network and repeat once (-r 1). With options -q and -s the individual results will be omitted and only a summary of results is displayed.

 

$ fping -g -r 1 192.168.1.0/24

192.168.1.1 is alive
192.168.1.4 is alive
192.168.1.5 is alive
192.168.1.6 is alive
.....

192.168.1.249 is unreachable
192.168.1.251 is unreachable
192.168.1.254 is unreachable

 

Reads the List of Targets From a File

fping -s < iplist.txt

We have created a file called iplist.txt having IP address 192.168.1.24 and 192.168.1.25 to fping.

 

$ fping -s < iplist.txt

192.168.1.24 is alive
192.168.1.25 is alive

2 targets
2 alive
0 unreachable
0 unknown addresses

0 timeouts (waiting for response)
2 ICMP Echos sent
2 ICMP Echo Replies received
0 other ICMP received

0.08 ms (min round trip time)
0.15 ms (avg round trip time)
0.22 ms (max round trip time)
0.025 sec (elapsed real time)

 

Ping only Alive Host

fping -s -r 1 -a <ip1> <ip2> <ip3>

Using this, we can list only the IPs that are alive and omit that are unreachable.

 

$ fping -s -r 1 -a 192.168.1.2 192.168.1.24 192.168.1.25

192.168.1.24
192.168.1.25

3 targets
2 alive
1 unreachable
0 unknown addresses

1 timeouts (waiting for response)
4 ICMP Echos sent
2 ICMP Echo Replies received
0 other ICMP received

0.09 ms (min round trip time)
0.16 ms (avg round trip time)
0.24 ms (max round trip time)
1.277 sec (elapsed real time)

 

Display Targets by Address Instead of DNS Name

fping -A <domain1> <domain2> <domain3>

We will get the IP output instead of the domain name.
 

$ fping -A google.com yahoo.com test.com

172.217.194.101 is alive
72.30.35.10 is alive
69.172.200.235 is unreachable

 

Display Summary only

fping -s -q <ip1> <ip2> <ip3>

This will show a summary output instead of each IP output
 

$ fping -s -q 192.168.1.2 192.168.1.24 192.168.1.25

3 targets
2 alive
1 unreachable
0 unknown addresses

1 timeouts (waiting for response)
6 ICMP Echos sent
2 ICMP Echo Replies received
4 other ICMP received

0.09 ms (min round trip time)
0.21 ms (avg round trip time)
0.33 ms (max round trip time)
4.090 sec (elapsed real time)

 

These are some of the common examples of command fping. You can include additional examples from the man page at https://fping.org/fping.1.html.

Leave a Reply

Your email address will not be published. Required fields are marked *

Add to cart