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

DESCRIPTION

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

OPTIONS

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

ICMP PACKET DETAILS

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

DUPLICATE AND DAMAGED PACKETS

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

TRYING DIFFERENT DATA PATTERNS

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

TTL DETAILS

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

BUGS

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

SEE ALSO

377       ip(8), ss(8).
378

HISTORY

380       The ping command appeared in 4.3BSD.
381
382       The version described here is its descendant specific to Linux.
383
384       As of version s20150815, the ping6 binary doesn't exist anymore. It has
385       been merged into ping. Creating a symlink named ping6 pointing to ping
386       will result in the same functionality as before.
387

SECURITY

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

AVAILABILITY

395       ping is part of iputils package.
396
397
398
399iputils 20210202                                                       PING(8)
Impressum