How to Ping Multiple Hosts at High Performance with fping on Linux

Linux TLDR
Last Updated:
Reading time: 4 minutes

First, letโ€™s talk about the traditional ping command, its shortcomings, and how fping can fill those gaps before discussing the fping command.

If you are only interested in knowing about the fping command, then click here.

So, letโ€™s begin.

Short Intro of Traditional Ping Command

The traditional โ€œpingโ€ (Packet Internet Groper) command is used to send ICMP echo probes to network hosts (either local or global) by specifying their IP address or domain name as an argument to the โ€œpingโ€ command.

Once you receive the request from the host machine, you can conclude that the host is active and is able to communicate with your machine.

The following is an example of pinging the two different hosts separately via their IP address and domain name.

$ ping
$ ping


Pinging two different hosts

Currently, both hosts are pinging separately, but the question is: can you ping them together in one command? Letโ€™s try

$ ping


Pinging two hosts separately using the ping command

As you can see from the above picture, the ping command has ignored the first host and started pinging the second (or last) โ€œ31.13.79.35โ€ host.

Now, itโ€™s normal that thereโ€™s nothing you can do here except execute two different ping commands using the โ€œ&&โ€ double ampersand and use the โ€œ-cโ€ flag to specify the number of ping requests to be sent to each host.

$ ping -c 2 && ping -c 2


Pinging two different hosts using the ping command in Linux

Congratulations on successfully pinging two different hosts with the ping command. Are you satisfied? Then you can leave this article here; however, I donโ€™t find this way of pinging multiple hosts relevant.

And in such occasions where pinging multiple hosts is required, I prefer to use the fping command.

Tutorial Details

DescriptionA More Powerful Ping that can Ping Multiple Hosts.
Difficulty LevelLow
Root or Sudo PrivilegesNo
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Internet RequiredYes

What is the Fping Command in Linux?

The fping command is the oldest networking program still in use today. Roland Schemers published it in 1992 with the goal of sending high-performance ICMP echo probes to multiple network hosts at once.

In addition to that, this program has the ability to check multiple hosts, scan the entire network, and read IP addresses or domain names from a text file to check the existence of machines in a network.

The multiple hosts or range of hosts are scanned in round-robin fashion, and unlike the ping command, it can be used in shell scripts.

How to Install Fping in Linux System

Unfortunately, this amazing command-line tool is not shipped out of the box by Linux distributions, but you can install it from the default package manager.

Execute any one of the following commands to install it on your Linux system.

$ sudo apt install fping                                                                                      #On Debian or Ubuntu
$ sudo dnf install fping                                                                                      #On Red Hat or Fedora
$ sudo pacman -S fping                                                                                    #On Arch or Manjaro

Alternatively, you can install the current latest fping (5.1) version from the source package using the following commands:

$ wget
$ tar -xvf fping-5.1.tar.gz 
$ cd fping-5.1/
$ ./configure
$ make && make install

After the installation is complete, you can move on to the next section to learn the usage of the fping command.

Usage of the Fping Command

The fping command takes two arguments: one is the option, and the other is the hostnames.

$ fping [OPTION] [HOSTNAMES...]

Letโ€™s see how you can use this command to ping multiple hosts.

Ping Multiple Hosts Using the Fping Command

To ping multiple hosts, all you have to do is specify each host as an argument to this command, using a space as a separator.

$ fping


Pinging multiple hosts using the fping command

I think from the above picture you have understood that this command doesnโ€™t give you additional information like โ€œfromโ€œ, โ€œicmp_seqโ€œ, โ€œttlโ€œ, and โ€œtimeโ€ like the ping command does.

Ping Range of IP Address Using the Fping Command

The following command will scan and ping the range of IP addresses and return all the host information in the output.

$ fping -s -g


Scanning range of IP addresses

Ping a Complete Network Using the Fping Command

Unlike the previous command, the following command will scan your whole network and ping each of the hosts to check whether they are alive or not.

$ fping -g -r 1


Pinging the complete network

Read and Scan the Hosts from the Text File

Specifying each host as an argument to the fping command might not be inconvenient, especially when the list of hosts is very long.

However, you can save all the host names in a text file and pass the file name as an argument to the fping command using the โ€œ-fโ€ flag.

$ cat hosts.txt
$ fping -f hosts.txt


Pinging hosts from the text file

Send N Echo Requests to Each Host

Using the โ€œ-cโ€ flag, you can assign the number of echo requests to be sent to each host to check their availability on the network.

The following command will send the five requests to each host in the โ€œhosts.txtโ€ file.

$ fping -c 5 -f hosts.txt


Sending limited requests to hosts

Now most of the options are identical to the standard ping command that you can check by executing any one of the following commands:

$ fping --help
$ man fping

How to Uninstall/Remove Fping From Linux System

Execute any one of the following commands to remove it from your Linux system:

$ sudo apt remove fping                                                                                      #On Debian or Ubuntu
$ sudo dnf remove fping                                                                                      #On Red Hat or Fedora
$ sudo pacman -R fping                                                                                       #On Arch or Manjaro

So, letโ€™s end this article here.

If you have questions or queries related to this tool, then leave them in the comment section.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.