マニュアルページセク ション 1M: システム管理コマンド

印刷ビューの終了

更新: 2014 年 7 月
 
 

fping (1m)

名前

fping - send ICMP ECHO_REQUEST packets to network hosts

形式

fping [ options ] [ systems... ]

説明




System Administration Commands                          fping(1M)



NAME
     fping - send ICMP ECHO_REQUEST packets to network hosts

SYNOPSIS
     fping [ options ] [ systems... ]


DESCRIPTION
     fping is a ping like program which uses the Internet Control
     Message Protocol (ICMP) echo request to determine if a  tar-
     get 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 send-
     ing 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.

OPTIONS
     -a   Show systems that are alive.

     -A   Display targets by address rather than DNS name.

     -bn  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.

     -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).  Also,



SunOS 5.11           Last change: 29 Feb 2008                   1






System Administration Commands                          fping(1M)



          statistics about responses for  each  target  are  dis-
          played when all requests have been sent (or when inter-
          rupted).

     -C   Similar to -c, but the per-target statistics  are  dis-
          played 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   Use gethostbyaddr(3NSL) to  lookup  address  of  return
          ping packet. This allows you to give fping a list of IP
          addresses as input and print hostnames in the output.

     -e   Show elapsed (round-trip) time of packets.

     -f   Read list of targets from a file.

          % fping < targets_file


     -g   Generate a target list from a supplied IP netmask, or a
          starting   and  ending  IP.   Specify  the  netmask  or
          start/end in the targets portion of the command line.

          ex. To ping the class C 192.168.1.x, the specified com-
          mand line could look like either:

          fping -g 192.168.1.0/24

          or

          fping -g 192.168.1.0 192.168.1.255

     -h   Print usage message.

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

     -l   Loop sending packets to each target indefinitely.   Can
          be  interrupted  with ctl-C; statistics about responses
          for each target are then displayed.

     -m   Send pings to each of a target host's  multiple  inter-
          faces.




SunOS 5.11           Last change: 29 Feb 2008                   2






System Administration Commands                          fping(1M)



     -n   Same as -d.

     -p   In  looping  or  counting  modes  (-l, -c, or -C), this
          parameter sets the  time  in  milliseconds  that  fping
          waits  between successive packets to an individual tar-
          get.  Default is 1000.

     -q   Quiet. Don't show per-target results,  just  set  final
          exit status.

     -Qn  Like -q, but show summary results every n seconds.

     -rn  Retry limit (default 3). This is the number of times an
          attempt at pinging a target will be made, not including
          the first try.

     -s   Print cumulative statistics upon exit.

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

     -u   Show targets that are unreachable.

     -v   Print fping version information.


EXAMPLES
     The  following  perl  script  will check a list of hosts and
     send mail if any are unreachable. It uses the open2 function
     which allows a program to 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.  Sure the
     open2 usage is not needed in this example, but it's  a  good
     open2 example none the less.

     #!/usr/local/bin/perl
     require 'open2.pl';

     $MAILTO = "root";

     $pid = &open2("OUTPUT","INPUT","/usr/local/bin/fping -u");

     @check=("slapshot","foo","foobar");

     foreach(@check) {  print INPUT "$_\n"; }
     close(INPUT);
     @output=<OUTPUT>;

     if ($#output != -1) {
      chop($date=`date`);



SunOS 5.11           Last change: 29 Feb 2008                   3






System Administration Commands                          fping(1M)



      open(MAIL,"|mail -s 'unreachable systems' $MAILTO");
      print MAIL "\nThe following systems are unreachable as of: $date\n\n";
      print MAIL @output;
      close MAIL;
     }

     Another good example is when you want to perform an action only on hosts
     that are currently reachable.

     #!/usr/local/bin/perl

     $hosts_to_backup = `cat /etc/hosts.backup | fping -a`;

     foreach $host (split(/\n/,$hosts_to_backup)) {
       # do it
     }


     The following is an output example:

     % fping a.b.com x.y.z.net 192.168.0.1 192.168.0.3
       a.b.com is alive
       x.y.z.net is alive
       192.168.0.1 is alive
       192.168.0.3 is alive


     The following is an output example using the '-a' option:

     % fping -a a.b.com x.y.z.net 192.168.0.1 192.168.0.3
       a.b.com
       x.y.z.net
       192.168.0.1
       192.168.0.3

     The following is an output example using the '-c' option:

     % fping -c 3 a.b.com x.y.z.net 192.168.0.1
       a.b.com        : [0], 84 bytes, 51.1 ms (51.1 avg, 0% loss)
       192.168.0.1    : [0], 84 bytes, 0.08 ms (0.08 avg, 0% loss) [<- 192.168.0.4]
       x.y.z.net      : [0], 84 bytes, 70.6 ms (70.6 avg, 0% loss)
       a.b.com        : [1], 84 bytes, 60.9 ms (56.0 avg, 0% loss)
       192.168.0.1    : [1], 84 bytes, 0.09 ms (0.08 avg, 0% loss) [<- 192.168.0.4]
       a.b.com        : [2], 84 bytes, 40.6 ms (50.9 avg, 0% loss)
       192.168.0.1    : [2], 84 bytes, 0.11 ms (0.09 avg, 0% loss) [<- 192.168.0.4]
       x.y.z.net      : [2], 84 bytes, 68.8 ms (69.7 avg, 33% loss)

       a.b.com        : xmt/rcv/%loss = 3/3/0%, min/avg/max = 40.6/50.9/60.9
       x.y.z.net      : xmt/rcv/%loss = 3/2/33%, min/avg/max = 68.8/69.7/70.6
       192.168.0.1    : xmt/rcv/%loss = 3/3/0%, min/avg/max = 0.08/0.09/0.11





SunOS 5.11           Last change: 29 Feb 2008                   4






System Administration Commands                          fping(1M)



     The following is an output example using the '-C' option:

     % fping -C 3 a.b.com x.y.z.net 192.168.0.1
       a.b.com        : [0], 84 bytes, 41.7 ms (41.7 avg, 0% loss)
       x.y.z.net      : [0], 84 bytes, 66.6 ms (66.6 avg, 0% loss)
       a.b.com        : [1], 84 bytes, 50.7 ms (46.2 avg, 0% loss)
       x.y.z.net      : [1], 84 bytes, 62.6 ms (64.6 avg, 0% loss)
       a.b.com        : [2], 84 bytes, 44.9 ms (45.8 avg, 0% loss)
       x.y.z.net      : [2], 84 bytes, 69.5 ms (66.2 avg, 0% loss)

       a.b.com        : 41.74 50.72 44.94
       x.y.z.net      : 66.69 62.63 69.52
       192.168.0.1    : - - -

     The following is an output example using the '-e' option:

     % fping -e a.b.com x.y.z.net 192.168.0.1
       a.b.com is alive (18.9 ms)
       x.y.z.net is alive (9.51 ms)
       192.168.0.1 is alive (0.35 ms)

     The following is an output example using the '-g' option:

     % fping -g 192.168.0.1 192.168.0.6
       192.168.0.0 is alive [<- 192.168.0.4]
       192.168.0.4 is alive
       192.168.0.1 is unreachable
       192.168.0.2 is unreachable
       192.168.0.3 is unreachable
       192.168.0.5 is unreachable
       192.168.0.6 is unreachable

     The following is an output example using the '-s' option:

     % fping -s a.b.com x.y.z.net 192.168.0.1
       a.b.com is alive
       x.y.z.net is alive
       192.168.0.1 is unreachable

              3 targets
              2 alive
              1 unreachable
              0 unknown addresses

              4 timeouts (waiting for response)
              6 ICMP Echos sent
              2 ICMP Echo Replies received
              0 other ICMP received

        46.1 ms (min round trip time)
        58.7 ms (avg round trip time)
        71.3 ms (max round trip time)



SunOS 5.11           Last change: 29 Feb 2008                   5






System Administration Commands                          fping(1M)



               4.153 sec (elapsed real time)


AUTHORS
     Roland J. Schemers III, Stanford University, concept and versions 1.x
     RL "Bob" Morgan, Stanford University, versions 2.x
     ZeroHype Technologies Inc. (http://www.zerohype.com), versions 2.3x and up,
     fping website:  http://www.fping.com

DIAGNOSTICS
     Exit  status  is 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, and 4 for a
     system call failure.

BUGS
     Ha! If we knew of any we would have fixed them!

RESTRICTIONS
     Successful execution of this program  requires  that  it  be
     granted the net_icmpaccess privilege.



ATTRIBUTES
     See   attributes(5)   for   descriptions  of  the  following
     attributes:

     +---------------+------------------+
     |ATTRIBUTE TYPE | ATTRIBUTE VALUE  |
     +---------------+------------------+
     |Availability   | diagnostic/fping |
     +---------------+------------------+
     |Stability      | Volatile         |
     +---------------+------------------+
SEE ALSO
     netstat(1M), ping(1M), ifconfig(1M), rbac(5), privileges(5)




NOTES
     This  software  was   built   from   source   available   at
     https://java.net/projects/solaris-userland.    The  original
     community source was downloaded  from   http://fping.source-
     forge.net/download/fping.tar.gz

     Further  information about this software can be found on the
     open  source  community  website   at   http://fping.source-
     forge.net/.





SunOS 5.11           Last change: 29 Feb 2008                   6