Recently we showed you how you could ping multiple IPs with a simple bash script. Now we are going to show you how you can achieve the same results with fping. Roland Schemers released the first version of fping back in 1992. From 2002 till 2011 there was no new official new release but the software was maintained by end-users. Now a new maintainer has taken over the software and released version 5 of fping.
fping allows you to ping either single IPs, multiple IPs, IP ranges or Subnets from the command line which then shows you if the IP is up or down. fping is a great tool for diagnostics and statistics.
How To Install FPING
At the time of writing this article V5 of fping was the latest release. If you install fping using yum, apt, dnf or other OS install method you will get v3 so to install fping v5 from source, follow the instruction below. Ensure you have gcc installed before running the install commands.
wget https://fping.org/dist/fping-5.0.tar.gz tar -xvf fping-5.0.tar.gz cd fping-5.0 ./configure make && make install
fping should now be installed to your server and it’s time to start using the software. Let’s look at pinging single IPs with fping.
fping Single IP
fping 184.108.40.206 220.127.116.11 is alive
Here I have sent ping requests to the IP 18.104.22.168 and fping has told me the IP is up and responding.
fping Multiple IPs
fping 22.214.171.124 126.96.36.199 188.8.131.52 184.108.40.206
fping 220.127.116.11 18.104.22.168 22.214.171.124 126.96.36.199 188.8.131.52 is alive 184.108.40.206 is alive 220.127.116.11 is alive 18.104.22.168 is alive
Here I have pinged multiple IPs and fping has reported they all respond. Entering all these IPs is time-consuming though. This is a subnet of 8 IPs, 22.214.171.124/29 so I could just ask fping to ping the whole subnet.
fping -g 126.96.36.199/29
fping -g 188.8.131.52/29 184.108.40.206 is alive 220.127.116.11 is alive 18.104.22.168 is alive 22.214.171.124 is alive 126.96.36.199 is alive 188.8.131.52 is alive 184.108.40.206 is alive 220.127.116.11 is alive
Here I can see the whole subnet is up and it’s taken seconds because I can just enter the subnet with no need to specify each IP. So what about a whole range of IPs? I could ping the subnet by entering the range too.
fping IP Range
fping -s -g 18.104.22.168 22.214.171.124
fping -s -g 126.96.36.199 188.8.131.52 184.108.40.206 is alive 220.127.116.11 is alive 18.104.22.168 is alive 22.214.171.124 is alive 126.96.36.199 is alive 188.8.131.52 is alive 184.108.40.206 is alive 220.127.116.11 is alive 8 targets 8 alive 0 unreachable 0 unknown addresses 0 timeouts (waiting for response) 8 ICMP Echos sent 8 ICMP Echo Replies received 0 other ICMP received 0.013 ms (min round trip time) 0.018 ms (avg round trip time) 0.024 ms (max round trip time) 0.071 sec (elapsed real time)
Using the -s flag gives you a greater output showing more statistics like the time it takes to ping each IP. If you have IP listed in a text file you can also tell fping to cycle through the whole file and provide you with the results.
fping Multiple IPs In Text File
fping < ips.txt
fping < ips.txt 18.104.22.168 is alive 22.214.171.124 is alive 126.96.36.199 is alive 188.8.131.52 is alive 184.108.40.206 is alive 220.127.116.11 is alive 18.104.22.168 is alive 22.214.171.124 is alive
Here I placed all my IPs into a text file called ips.txt and asked fping to ping each IP. You could add the -s flag (fping -s < ips.txt) to the command for full statistics. Overall fping is much more flexible than pinging multiple IPs with bash and provides for more options and statistics.
How was this article?