fping

Command

fping is a ping-like utility that 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 list of targets to ping. Instead of sending to one target
until it times out or replies,
fping sends out a ping packet and moves on to the
next target in a round-robin fashion,

In the default mode, if a target replies, fping notes it
and removes it 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 specified 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.

specifies the number of bytes of ping data to send.
The minimum size (normally 12) allows room for the data that
fping
needs to do its work (sequence number, timestamp). The reported
received data size includes the IP header (normally 20 bytes) and ICMP
header (8 bytes), so the minimum total size is 40 bytes. Default is
56, as in ping.
Maximum is the theoretical maximum IP datagram size (64K), though most
systems limit this to a smaller, system-dependent number.

-Bn

in the default mode, fping sends several requests to
a target before giving up, waiting longer for a reply on each successive
request.
This parameter is the value by which the wait time is multiplied on each
successive request; it must be entered as a floating-point number
(x.y).
The default is 1.5.

-cn

specifies the number of request packets to send to each target.
In this mode, fping displays a line for each received
response (this can suppressed with -q or -Q).
Also, statistics about responses for each target are displayed
when all requests have been sent (or when interrupted).

-Cn

is similar to -c, but fping displays
the per-target statistics in a format designed for automated response-time
statistics gathering. For example:

%fping -C 5 -q somehost
somehost : 91.7 37.0 29.2 - 36.8

shows the response time in milliseconds for each of the five requests,
with the - indicating that no response was received to the fourth
request.

-d

uses DNS to lookup address of return ping packet.
With this option, you can specify a list of IP addresses as the
systems arguments and have fping display
hostnames in the output.

-e

shows elapsed (round-trip) time of packets.

-ffile

reads the list of targets from a file.
This option can only be used by the root user.
Regular users should pipe in the file via standard input:

% fping < targets_file

-g

generates a target list from a supplied IP netmask, or a starting and
ending IP.
The netmask or starting/ending IPs are specified in the systems
portion of the command line.
For example, to ping the class the C 192.168.1.x, the command line could
look like either:

fping -g 192.168.1.0/24

or

fping -g 192.168.1.0 192.168.1.255

-h

displays usage message.

-in

specifies the minimum amount of time (in milliseconds) between sending a
ping packet to any target (default is 25).

-l

loops sending packets to each target indefinitely.
The looping can be interrupted with
CTRL-C;
fping then displays statistics about responses for
each target.

-m

sends pings to each of a target host's multiple interfaces.

-n

is the same as the -d option.

-pn

in looping or counting modes (-l, -c,
or -C, specifies the time in milliseconds that
fping waits between successive packets to an individual
target.
The default is 1000.

-q

enables quiet mode. fping does not
show per-target results; it just sets the final exit status.

-Qn

is similar to -q, but displays summary results every
n seconds.

-rn

specifies the retry limit (the default is 3).
This is the number of times an attempt at pinging a target is made, not
including the first try.

-s

displays cumulative statistics upon exit.

-tn

specifies the initial target timeout in milliseconds (the default is 500).
In the default mode, this is the amount of time that
fping waits for a response to its first request.
Successive timeouts are multiplied by the backoff factor.

The following perl script checks a list of hosts
and sends mail if any are unreachable.
It uses the open2() function which lets a program
be opened for reading and writing.
fping does not start pinging the list of systems
until it reads EOF, which it gets after INPUT
is closed.
The open2() usage is not really needed in this example,
but it serves as a good example of its use.

When certain options are used (that is, a low value for
-i and -t, and a high value for
-r), it is possible to flood the network.
This program must be installed as setuid root in order to open up a
raw socket, or must be run by root.
To stop non-root users from hosing the network (when
fping is installed setuid root) , normal users cannot
specify the following: