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.
252
253                     Real number allowed with dot as a decimal separator
254                     (regardless locale setup).
255                   .RE
256
257           When using ping for fault isolation, it should first be run on the
258           local host, to verify that the local network interface is up and
259           running. Then, hosts and gateways further and further away should
260           be “pinged”. Round-trip times and packet loss statistics are
261           computed. If duplicate packets are received, they are not included
262           in the packet loss calculation, although the round trip time of
263           these packets is used in calculating the
264           minimum/average/maximum/mdev round-trip time numbers.
265
266           Population standard deviation (mdev), essentially an average of how
267           far each ping RTT is from the mean RTT. The higher mdev is, the
268           more variable the RTT is (over time). With a high RTT variability,
269           you will have speed issues with bulk transfers (they will take
270           longer than is strictly speaking necessary, as the variability will
271           eventually cause the sender to wait for ACKs) and you will have
272           middling to poor VoIP quality.
273
274           When the specified number of packets have been sent (and received)
275           or if the program is terminated with a SIGINT, a brief summary is
276           displayed. Shorter current statistics can be obtained without
277           termination of process with signal SIGQUIT.
278
279           If ping does not receive any reply packets at all it will exit with
280           code 1. If a packet count and deadline are both specified, and
281           fewer than count packets are received by the time the deadline has
282           arrived, it will also exit with code 1. On other error it exits
283           with code 2. Otherwise it exits with code 0. This makes it possible
284           to use the exit code to see if a host is alive or not.
285
286           This program is intended for use in network testing, measurement
287           and management. Because of the load it can impose on the network,
288           it is unwise to use ping during normal operations or from automated
289           scripts.
290

ICMP PACKET DETAILS

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

DUPLICATE AND DAMAGED PACKETS

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

TRYING DIFFERENT DATA PATTERNS

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

TTL DETAILS

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

BUGS

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

SEE ALSO

381       ip(8), ss(8).
382

HISTORY

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

SECURITY

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

AVAILABILITY

399       ping is part of iputils package.
400
401
402
403iputils s20200821                                                      PING(8)
Impressum