1PING(8)                System Manager's Manual: iputils                PING(8)
2
3
4

NAME

6       ping - send ICMP ECHO_REQUEST to network hosts
7

SYNOPSIS

9       ping [-aAbBdDfhLnOqrRUvV46] [-c count] [-F flowlabel] [-i interval] [-I
10       interface] [-l  preload]  [-m  mark]  [-M  pmtudisc_option]  [-N  node‐
11       info_option] [-w deadline] [-W timeout] [-p pattern] [-Q tos] [-s pack‐
12       etsize] [-S sndbuf] [-t ttl] [-T timestamp option] [hop  ...]  destina‐
13       tion
14
15

DESCRIPTION

17       ping uses the ICMP protocol's mandatory ECHO_REQUEST datagram to elicit
18       an ICMP ECHO_RESPONSE from a host or gateway.   ECHO_REQUEST  datagrams
19       (``pings'')  have  an  IP and ICMP header, followed by a struct timeval
20       and then an arbitrary number of ``pad'' bytes  used  to  fill  out  the
21       packet.
22
23       ping  works  with both IPv4 and IPv6. Using only one of them explicitly
24       can be enforced by specifying -4 or -6.
25
26       ping can also send IPv6 Node Information Queries (RFC4620).  Intermedi‐
27       ate hops may not be allowed, because IPv6 source routing was deprecated
28       (RFC5095).
29

OPTIONS

31       -4     Use IPv4 only.
32
33       -6     Use IPv6 only.
34
35       -a     Audible ping.
36
37       -A     Adaptive ping. Interpacket interval adapts to  round-trip  time,
38              so  that  effectively  not more than one (or more, if preload is
39              set) unanswered probe is present in the network. Minimal  inter‐
40              val  is  200msec  for  not super-user.  On networks with low rtt
41              this mode is essentially equivalent to flood mode.
42
43       -b     Allow pinging a broadcast address.
44
45       -B     Do not allow ping to  change  source  address  of  probes.   The
46              address is bound to one selected when ping starts.
47
48       -c count
49              Stop  after  sending  count  ECHO_REQUEST packets. With deadline
50              option, ping waits for count ECHO_REPLY packets, until the time‐
51              out expires.
52
53       -d     Set  the SO_DEBUG option on the socket being used.  Essentially,
54              this socket option is not used by Linux kernel.
55
56       -D     Print timestamp (unix time + microseconds  as  in  gettimeofday)
57              before each line.
58
59       -f     Flood  ping.  For  every  ECHO_REQUEST  sent  a  period ``.'' is
60              printed, while for  ever  ECHO_REPLY  received  a  backspace  is
61              printed.   This provides a rapid display of how many packets are
62              being dropped.  If interval is not given, it  sets  interval  to
63              zero  and  outputs packets as fast as they come back or one hun‐
64              dred times per second, whichever is more.  Only  the  super-user
65              may use this option with zero interval.
66
67       -F flow label
68              IPv6  only.  Allocate and set 20 bit flow label (in hex) on echo
69              request packets.  If value is zero, kernel allocates random flow
70              label.
71
72       -h     Show help.
73
74       -i interval
75              Wait  interval seconds between sending each packet.  The default
76              is to wait for one second between each packet normally,  or  not
77              to  wait in flood mode. Only super-user may set interval to val‐
78              ues less 0.2 seconds.
79
80       -I interface
81              interface is either an address, or an interface name.  If inter‐
82              face  is  an address, it sets source address to specified inter‐
83              face address.  If interface in an interface name, it sets source
84              interface  to specified interface.  For IPv6, when doing ping to
85              a link-local scope address, link specification (by the '%'-nota‐
86              tion in destination, or by this option) is required.
87
88       -l preload
89              If  preload is specified, ping sends that many packets not wait‐
90              ing for reply.  Only the super-user may select preload more than
91              3.
92
93       -L     Suppress  loopback of multicast packets.  This flag only applies
94              if the ping destination is a multicast address.
95
96       -m mark
97              use mark to tag the packets going out. This is useful for  vari‐
98              ety of reasons within the kernel such as using policy routing to
99              select specific outbound processing.
100
101       -M pmtudisc_opt
102              Select Path MTU  Discovery  strategy.   pmtudisc_option  may  be
103              either  do  (prohibit  fragmentation,  even local one), want (do
104              PMTU discovery, fragment locally when packet size is large),  or
105              dont (do not set DF flag).
106
107       -N nodeinfo_option
108              IPv6  only.   Send  ICMPv6  Node  Information Queries (RFC4620),
109              instead of Echo Request.  CAP_NET_RAW capability is required.
110
111              help   Show help for NI support.
112
113              name   Queries for Node Names.
114
115              ipv6   Queries for IPv6 Addresses. There are several  IPv6  spe‐
116                     cific flags.
117
118                     ipv6-global
119                            Request IPv6 global-scope addresses.
120
121                     ipv6-sitelocal
122                            Request IPv6 site-local addresses.
123
124                     ipv6-linklocal
125                            Request IPv6 link-local addresses.
126
127                     ipv6-all
128                            Request IPv6 addresses on other interfaces.
129
130              ipv4   Queries  for  IPv4 Addresses.  There is one IPv4 specific
131                     flag.
132
133                     ipv4-all
134                            Request IPv4 addresses on other interfaces.
135
136              subject-ipv6=ipv6addr
137                     IPv6 subject address.
138
139              subject-ipv4=ipv4addr
140                     IPv4 subject address.
141
142              subject-name=nodename
143                     Subject name.  If it contains more than one  dot,  fully-
144                     qualified domain name is assumed.
145
146              subject-fqdn=nodename
147                     Subject  name.   Fully-qualified  domain  name  is always
148                     assumed.
149
150       -n     Numeric output only.  No attempt will be made to lookup symbolic
151              names for host addresses.
152
153       -O     Report  outstanding  ICMP ECHO reply before sending next packet.
154              This is useful together with the timestamp -D to log output to a
155              diagnostic file and search for missing answers.
156
157       -p pattern
158              You  may  specify  up to 16 ``pad'' bytes to fill out the packet
159              you send.  This is useful for diagnosing data-dependent problems
160              in  a network.  For example, -p ff will cause the sent packet to
161              be filled with all ones.
162
163       -q     Quiet output.  Nothing is displayed except the summary lines  at
164              startup time and when finished.
165
166       -Q tos Set Quality of Service -related bits in ICMP datagrams.  tos can
167              be decimal (ping only) or hex number.
168
169              In RFC2474, these fields are interpreted as 8-bit Differentiated
170              Services  (DS), consisting of: bits 0-1 (2 lowest bits) of sepa‐
171              rate data, and bits 2-7 (highest 6 bits) of Differentiated  Ser‐
172              vices  Codepoint  (DSCP).   In RFC2481 and RFC3168, bits 0-1 are
173              used for ECN.
174
175              Historically (RFC1349, obsoleted by RFC2474), these were  inter‐
176              preted  as:  bit  0  (lowest  bit) for reserved (currently being
177              redefined as congestion control), 1-4 for Type  of  Service  and
178              bits 5-7 (highest bits) for Precedence.
179
180       -r     Bypass  the normal routing tables and send directly to a host on
181              an attached interface.  If  the  host  is  not  on  a  directly-
182              attached network, an error is returned.  This option can be used
183              to ping a local host through an  interface  that  has  no  route
184              through it provided the option -I is also used.
185
186       -R     ping  only.   Record route.  Includes the RECORD_ROUTE option in
187              the  ECHO_REQUEST  packet  and  displays  the  route  buffer  on
188              returned  packets.  Note that the IP header is only large enough
189              for nine such routes.  Many hosts ignore or discard this option.
190
191       -s packetsize
192              Specifies the number of data bytes to be sent.  The  default  is
193              56,  which translates into 64 ICMP data bytes when combined with
194              the 8 bytes of ICMP header data.
195
196       -S sndbuf
197              Set socket sndbuf. If not specified, it is  selected  to  buffer
198              not more than one packet.
199
200       -t ttl ping only.  Set the IP Time to Live.
201
202       -T timestamp option
203              Set  special  IP  timestamp  options.   timestamp  option may be
204              either  tsonly  (only  timestamps),  tsandaddr  (timestamps  and
205              addresses) or tsprespec host1 [host2 [host3 [host4]]] (timestamp
206              prespecified hops).
207
208       -U     Print full user-to-user latency (the  old  behaviour).  Normally
209              ping prints network round trip time, which can be different f.e.
210              due to DNS failures.
211
212       -v     Verbose output.
213
214       -V     Show version and exit.
215
216       -w deadline
217              Specify a timeout, in seconds, before ping exits  regardless  of
218              how  many  packets have been sent or received. In this case ping
219              does not stop after count packet are sent, it waits  either  for
220              deadline  expire  or until count probes are answered or for some
221              error notification from network.
222
223       -W timeout
224              Time to wait for a response, in seconds. The option affects only
225              timeout  in  absence  of any responses, otherwise ping waits for
226              two RTTs.
227
228       When using ping for fault isolation, it should  first  be  run  on  the
229       local  host,  to verify that the local network interface is up and run‐
230       ning. Then, hosts and gateways  further  and  further  away  should  be
231       ``pinged''.  Round-trip  times and packet loss statistics are computed.
232       If duplicate packets are received, they are not included in the  packet
233       loss calculation, although the round trip time of these packets is used
234       in calculating the  minimum/average/maximum  round-trip  time  numbers.
235       When  the  specified number of packets have been sent (and received) or
236       if the program is terminated with a SIGINT, a  brief  summary  is  dis‐
237       played.  Shorter current statistics can be obtained without termination
238       of process with signal SIGQUIT.
239
240       If ping does not receive any reply packets at all  it  will  exit  with
241       code  1.  If  a packet count and deadline are both specified, and fewer
242       than count packets are received by the time the deadline  has  arrived,
243       it  will  also  exit with code 1.  On other error it exits with code 2.
244       Otherwise it exits with code 0. This makes it possible to use the  exit
245       code to see if a host is alive or not.
246
247       This  program  is  intended for use in network testing, measurement and
248       management.  Because of the load it can impose on the  network,  it  is
249       unwise to use ping during normal operations or from automated scripts.
250

ICMP PACKET DETAILS

252       An  IP header without options is 20 bytes.  An ICMP ECHO_REQUEST packet
253       contains an additional 8 bytes worth of  ICMP  header  followed  by  an
254       arbitrary  amount  of data.  When a packetsize is given, this indicated
255       the size of this extra piece of data (the  default  is  56).  Thus  the
256       amount  of data received inside of an IP packet of type ICMP ECHO_REPLY
257       will always be 8 bytes more than the requested  data  space  (the  ICMP
258       header).
259
260       If  the  data space is at least of size of struct timeval ping uses the
261       beginning bytes of this space to include a timestamp which it  uses  in
262       the  computation of round trip times.  If the data space is shorter, no
263       round trip times are given.
264

DUPLICATE AND DAMAGED PACKETS

266       ping will report duplicate  and  damaged  packets.   Duplicate  packets
267       should  never  occur, and seem to be caused by inappropriate link-level
268       retransmissions.  Duplicates may  occur  in  many  situations  and  are
269       rarely  (if  ever)  a good sign, although the presence of low levels of
270       duplicates may not always be cause for alarm.
271
272       Damaged packets are obviously serious cause for alarm and  often  indi‐
273       cate  broken  hardware somewhere in the ping packet's path (in the net‐
274       work or in the hosts).
275

TRYING DIFFERENT DATA PATTERNS

277       The (inter)network layer should never treat packets differently depend‐
278       ing  on  the  data contained in the data portion.  Unfortunately, data-
279       dependent problems have been known to sneak into  networks  and  remain
280       undetected for long periods of time.  In many cases the particular pat‐
281       tern that will have problems is something that doesn't have  sufficient
282       ``transitions'',  such  as all ones or all zeros, or a pattern right at
283       the edge, such as almost all zeros.  It  isn't  necessarily  enough  to
284       specify  a  data pattern of all zeros (for example) on the command line
285       because the pattern that is of interest is at the data link level,  and
286       the  relationship between what you type and what the controllers trans‐
287       mit can be complicated.
288
289       This means that if you have a data-dependent problem you will  probably
290       have to do a lot of testing to find it.  If you are lucky, you may man‐
291       age to find a file that either can't be sent  across  your  network  or
292       that  takes  much  longer  to transfer than other similar length files.
293       You can then examine this file for repeated patterns that you can  test
294       using the -p option of ping.
295

TTL DETAILS

297       The  TTL  value  of  an  IP  packet represents the maximum number of IP
298       routers that the packet can go through before being  thrown  away.   In
299       current  practice  you can expect each router in the Internet to decre‐
300       ment the TTL field by exactly one.
301
302       The TCP/IP specification states that the  TTL  field  for  TCP  packets
303       should  be set to 60, but many systems use smaller values (4.3 BSD uses
304       30, 4.2 used 15).
305
306       The maximum possible value of this field is 255, and most Unix  systems
307       set the TTL field of ICMP ECHO_REQUEST packets to 255.  This is why you
308       will find you can ``ping'' some hosts, but not  reach  them  with  tel‐
309       net(1) or ftp(1).
310
311       In  normal  operation  ping  prints  the  TTL  value from the packet it
312       receives.  When a remote system receives a ping packet, it can  do  one
313       of three things with the TTL field in its response:
314
315       · Not  change  it;  this  is  what Berkeley Unix systems did before the
316         4.3BSD Tahoe release. In this case the  TTL  value  in  the  received
317         packet  will  be  255  minus  the number of routers in the round-trip
318         path.
319
320       · Set it to 255; this is what current Berkeley  Unix  systems  do.   In
321         this  case the TTL value in the received packet will be 255 minus the
322         number of routers in the path from the remote system to  the  pinging
323         host.
324
325       · Set it to some other value. Some machines use the same value for ICMP
326         packets that they use for TCP packets, for example either 30  or  60.
327         Others may use completely wild values.
328

BUGS

330       · Many Hosts and Gateways ignore the RECORD_ROUTE option.
331
332       · The   maximum  IP  header  length  is  too  small  for  options  like
333         RECORD_ROUTE to be completely useful.  There's not much that  can  be
334         done about this, however.
335
336       · Flood  pinging  is  not recommended in general, and flood pinging the
337         broadcast address should only be done under  very  controlled  condi‐
338         tions.
339

SEE ALSO

341       netstat(1), ifconfig(8).
342

HISTORY

344       The ping command appeared in 4.3BSD.
345
346       The version described here is its descendant specific to Linux.
347
348       As  of  version  s20150815, the ping6 binary doesn't exist anymore.  It
349       has been merged into ping. Creating a symlink named ping6  pointing  to
350       ping will result in the same funcionality as before.
351

SECURITY

353       ping  requires  CAP_NET_RAW capability to be executed 1) if the program
354       is used for non-echo queries (See -N option), or 2) if kernel does  not
355       support  non-raw ICMP sockets, or 3) if the user is not allowed to cre‐
356       ate an ICMP echo socket.  The program may be used as set-uid root.
357

AVAILABILITY

359       ping is part of iputils package and the latest versions are   available
360       in    source    form    at   http://www.skbuff.net/iputils/iputils-cur
361       rent.tar.bz2.
362
363
364
365iputils-160308                                                         PING(8)
Impressum