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

NAME

6       ping, ping6 - send ICMP ECHO_REQUEST to network hosts
7

SYNOPSIS

9       ping  [ -LRUbdfnqrvVaAB]  [ -c count]  [ -m mark]  [ -i interval]  [ -l
10       preload]  [ -p pattern]  [ -s packetsize]  [ -t ttl]  [ -w deadline]  [
11       -F  flowlabel]   [ -I interface]  [ -M hint]  [ -N nioption]  [ -Q tos]
12       [ -S sndbuf]  [ -T timestamp option]  [ -W timeout]  [ hop ...]  desti‐
13       nation
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       ping6 can also send Node Information Queries (RFC4620).
24

OPTIONS

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

ICMP PACKET DETAILS

234       An  IP header without options is 20 bytes.  An ICMP ECHO_REQUEST packet
235       contains an additional 8 bytes worth of  ICMP  header  followed  by  an
236       arbitrary  amount  of data.  When a packetsize is given, this indicated
237       the size of this extra piece of data (the  default  is  56).  Thus  the
238       amount  of data received inside of an IP packet of type ICMP ECHO_REPLY
239       will always be 8 bytes more than the requested  data  space  (the  ICMP
240       header).
241
242       If  the  data space is at least of size of struct timeval ping uses the
243       beginning bytes of this space to include a timestamp which it  uses  in
244       the  computation of round trip times.  If the data space is shorter, no
245       round trip times are given.
246

DUPLICATE AND DAMAGED PACKETS

248       ping will report duplicate  and  damaged  packets.   Duplicate  packets
249       should  never  occur, and seem to be caused by inappropriate link-level
250       retransmissions.  Duplicates may  occur  in  many  situations  and  are
251       rarely  (if  ever)  a good sign, although the presence of low levels of
252       duplicates may not always be cause for alarm.
253
254       Damaged packets are obviously serious cause for alarm and  often  indi‐
255       cate  broken  hardware somewhere in the ping packet's path (in the net‐
256       work or in the hosts).
257

TRYING DIFFERENT DATA PATTERNS

259       The (inter)network layer should never treat packets differently depend‐
260       ing  on  the  data contained in the data portion.  Unfortunately, data-
261       dependent problems have been known to sneak into  networks  and  remain
262       undetected for long periods of time.  In many cases the particular pat‐
263       tern that will have problems is something that doesn't have  sufficient
264       ``transitions'',  such  as all ones or all zeros, or a pattern right at
265       the edge, such as almost all zeros.  It  isn't  necessarily  enough  to
266       specify  a  data pattern of all zeros (for example) on the command line
267       because the pattern that is of interest is at the data link level,  and
268       the  relationship between what you type and what the controllers trans‐
269       mit can be complicated.
270
271       This means that if you have a data-dependent problem you will  probably
272       have to do a lot of testing to find it.  If you are lucky, you may man‐
273       age to find a file that either can't be sent  across  your  network  or
274       that  takes  much  longer  to transfer than other similar length files.
275       You can then examine this file for repeated patterns that you can  test
276       using the -p option of ping.
277

TTL DETAILS

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

BUGS

312       · Many Hosts and Gateways ignore the RECORD_ROUTE option.
313
314       · The   maximum  IP  header  length  is  too  small  for  options  like
315         RECORD_ROUTE to be completely useful.  There's not much that that can
316         be done about this, however.
317
318       · Flood  pinging  is  not recommended in general, and flood pinging the
319         broadcast address should only be done under  very  controlled  condi‐
320         tions.
321

SEE ALSO

323       netstat(1), ifconfig(8).
324

HISTORY

326       The ping command appeared in 4.3BSD.
327
328       The version described here is its descendant specific to Linux.
329

SECURITY

331       ping  requires  CAP_NET_RAWIO capability to be executed. It may be used
332       as set-uid root.
333

AVAILABILITY

335       ping is part of iputils package and the latest versions are   available
336       in    source    form    at   http://www.skbuff.net/iputils/iputils-cur
337       rent.tar.bz2.
338
339
340
341iputils-100418                   13 July 2010                          PING(8)
Impressum