fping is a program which uses the Internet Control Message Protocol (ICMP) echo request to determine if a host is up. fping is different from ping in that you can specify any number of hosts on the command line, or specify a file containing the lists of hosts to ping. Instead of trying one host until it timeouts or replies, fping will send out a ping packet and move on to the next host in a round-robin fashion. If a host replies, it is noted and removed from the list of hosts to check. If a host does not respond within a certain time limit and/or retry limit it will be considered unreachable.

Basically fping is meant to be used in shell scripts and its output is easy to parse. This command can be very useful to when you have to scan whole network for alive or unreachable hosts. In case of usage regular ping command you’ll have to write shell script and parse each hosts icmp replies but fping can do the same in one line:

To scan range of IP addresses from 192.168.0.1 to 192.168.0.9 just run:
sudo fping -s -g 192.168.0.1 192.168.0.9 -r 1

That will output:

192.168.0.1 is alive
192.168.0.7 is alive
192.168.0.2 is unreachable
192.168.0.3 is unreachable
192.168.0.4 is unreachable
192.168.0.5 is unreachable
192.168.0.6 is unreachable
192.168.0.8 is unreachable
192.168.0.9 is unreachable

9 targets
2 alive
7 unreachable
0 unknown addresses

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

0.05 ms (min round trip time)
0.44 ms (avg round trip time)
0.84 ms (max round trip time)
2.183 sec (elapsed real time)

In order to scan /24 network (254 hosts) and show only alive hosts the following command can be used:

sudo fping -a -q -g 192.168.0.0/24

 

27 Comments

 

  1. Pingback : Phan Nguy?n | Networking | Sys Admin | Linux/Unix

  2. April 27, 2013  12:49 am by bluehost promo code Reply

    However, the cost and hassle of maintaining a paid space is not recommended for personal bloggers who are not using their
    blog as a storefront for their business or online resume. Their hosting plans can
    help you increase your marketing reach and take your business to the next level.

    But - you must have a clear understanding of the information you are being given.

Leave a reply

 

Your email address will not be published.