1PING(8)                             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]
10            [-I interface] [-l preload] [-m mark] [-M pmtudisc_option]
11            [-N nodeinfo_option] [-w deadline] [-W timeout] [-p pattern]
12            [-Q tos] [-s packetsize] [-S sndbuf] [-t ttl]
13            [-T timestamp option] [hop...] destination
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 and
20       then an arbitrary number of “pad” bytes used to fill out the packet.
21
22       ping works with both IPv4 and IPv6. Using only one of them explicitly
23       can be enforced by specifying -4 or -6.
24
25       ping can also send IPv6 Node Information Queries (RFC4620).
26       Intermediate hops may not be allowed, because IPv6 source routing was
27       deprecated (RFC5095).
28

OPTIONS

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

ICMP PACKET DETAILS

283       An IP header without options is 20 bytes. An ICMP ECHO_REQUEST packet
284       contains an additional 8 bytes worth of ICMP header followed by an
285       arbitrary amount of data. When a packetsize is given, this indicated
286       the size of this extra piece of data (the default is 56). Thus the
287       amount of data received inside of an IP packet of type ICMP ECHO_REPLY
288       will always be 8 bytes more than the requested data space (the ICMP
289       header).
290
291       If the data space is at least of size of struct timeval ping uses the
292       beginning bytes of this space to include a timestamp which it uses in
293       the computation of round trip times. If the data space is shorter, no
294       round trip times are given.
295

DUPLICATE AND DAMAGED PACKETS

297       ping will report duplicate and damaged packets. Duplicate packets
298       should never occur, and seem to be caused by inappropriate link-level
299       retransmissions. Duplicates may occur in many situations and are rarely
300       (if ever) a good sign, although the presence of low levels of
301       duplicates may not always be cause for alarm.
302
303       Damaged packets are obviously serious cause for alarm and often
304       indicate broken hardware somewhere in the ping packet's path (in the
305       network or in the hosts).
306

TRYING DIFFERENT DATA PATTERNS

308       The (inter)network layer should never treat packets differently
309       depending on the data contained in the data portion. Unfortunately,
310       data-dependent problems have been known to sneak into networks and
311       remain undetected for long periods of time. In many cases the
312       particular pattern that will have problems is something that doesn't
313       have sufficient “transitions”, such as all ones or all zeros, or a
314       pattern right at the edge, such as almost all zeros. It isn't
315       necessarily enough to specify a data pattern of all zeros (for example)
316       on the command line because the pattern that is of interest is at the
317       data link level, and the relationship between what you type and what
318       the controllers transmit can be complicated.
319
320       This means that if you have a data-dependent problem you will probably
321       have to do a lot of testing to find it. If you are lucky, you may
322       manage to find a file that either can't be sent across your network or
323       that takes much longer to transfer than other similar length files. You
324       can then examine this file for repeated patterns that you can test
325       using the -p option of ping.
326

TTL DETAILS

328       The TTL value of an IP packet represents the maximum number of IP
329       routers that the packet can go through before being thrown away. In
330       current practice you can expect each router in the Internet to
331       decrement the TTL field by exactly one.
332
333       The TCP/IP specification states that the TTL field for TCP packets
334       should be set to 60, but many systems use smaller values (4.3 BSD uses
335       30, 4.2 used 15).
336
337       The maximum possible value of this field is 255, and most Unix systems
338       set the TTL field of ICMP ECHO_REQUEST packets to 255. This is why you
339       will find you can “ping” some hosts, but not reach them with telnet(1)
340       or ftp(1).
341
342       In normal operation ping prints the TTL value from the packet it
343       receives. When a remote system receives a ping packet, it can do one of
344       three things with the TTL field in its response:
345
346           · Not change it; this is what Berkeley Unix systems did before the
347           4.3BSD Tahoe release. In this case the TTL value in the received
348           packet will be 255 minus the number of routers in the round-trip
349           path.
350
351           · Set it to 255; this is what current Berkeley Unix systems do. In
352           this case the TTL value in the received packet will be 255 minus
353           the number of routers in the path from the remote system to the
354           pinging host.
355
356           · Set it to some other value. Some machines use the same value for
357           ICMP packets that they use for TCP packets, for example either 30
358           or 60. Others may use completely wild values.
359

BUGS

361           · Many Hosts and Gateways ignore the RECORD_ROUTE option.
362
363           · The maximum IP header length is too small for options like
364           RECORD_ROUTE to be completely useful. There's not much that can be
365           done about this, however.
366
367           · Flood pinging is not recommended in general, and flood pinging
368           the broadcast address should only be done under very controlled
369           conditions.
370

SEE ALSO

372       ip(8), ss(8).
373

HISTORY

375       The ping command appeared in 4.3BSD.
376
377       The version described here is its descendant specific to Linux.
378
379       As of version s20150815, the ping6 binary doesn't exist anymore. It has
380       been merged into ping. Creating a symlink named ping6 pointing to ping
381       will result in the same funcionality as before.
382

SECURITY

384       ping requires CAP_NET_RAW capability to be executed 1) if the program
385       is used for non-echo queries (See -N option), or 2) if kernel does not
386       support non-raw ICMP sockets, or 3) if the user is not allowed to
387       create an ICMP echo socket. The program may be used as set-uid root.
388

AVAILABILITY

390       ping is part of iputils package.
391
392
393
394iputils s20180629                                                      PING(8)
Impressum