Tuesday, March 1, 2011

Linux Usage: ping? Not enough, we have a more powerful tool - fping

fping - send ICMP ECHO_REQUEST packets to network hosts

fping is a program like ping which uses the Internet Control Message Protocol
(ICMP) echo request to determine if a target host is responding. fping differs
from ping in that you can specify any number of targets on the command line, or
specify a file containing the lists of targets to ping. Instead of sending to one
target until it times out or replies, fping will send out a ping packet and move
on to the next target in a round-robin fashion.

In the default mode, if a target replies, it is noted and removed from the list of
targets to check; if a target does not respond within a certain time limit and/or
retry limit it is designated as unreachable. fping also supports sending a speci‐
fied number of pings to a target, or looping indefinitely (as in ping ).

Unlike ping, fping is meant to be used in scripts, so its output is designed to be
easy to parse.

Installaton:
$ sudo apt-get install fping

Usage:
$ fping [options] hosts

Useful Options:
  • -a Show systems that are alive.
  • -A Show systems that are alive
  • -c Number of request packets to send to each target. In this mode, a line is displayed for each received response (this can suppressed with -q or -Q)
  • -C Similar to -c, but the per-target statistics are displayed in a format designed for automated response-time statistics gathering
  • -d Use DNS to lookup address of return ping packet
  • -f Read list of targets from a file. This option can only be used by the root user. Regular users should pipe in the file via stdin: $ fping < targets_file
  • -q Quiet. Don't show per-target results, just set final exit status
  • -rn Retry limit (default 3)
  • -Tn Select timeout in seconds (default 10)
  • -u Show targets that are unreachable
Exit Code (DIAGNOSTICS):

  • 0 if all the hosts are reachable
  • 1 if some hosts were unreachable
  • 2 if any IP addresses were not found
  • 3 for invalid command line arguments
  • 4 for a system call failure.
Conclusion:
fping send ping request continuously which is simpler and faster than ping that send to destination one request by one request.

No comments:

Post a Comment