1PING(8) iputils PING(8)
2
3
4
6 ping - send ICMP ECHO_REQUEST to network hosts
7
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
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
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 for not 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 ever 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. The default is
84 to wait for one second between each packet normally, or not to wait
85 in flood mode. Only super-user may set interval to values less than
86 0.2 seconds.
87
88 -I interface
89 interface is either an address, or an interface name. If interface
90 is an address, it sets source address to specified interface
91 address. If interface in an interface name, it sets source
92 interface to specified interface. NOTE: For IPv6, when doing ping
93 to a link-local scope address, link specification (by the
94 '%'-notation in destination, or by this option) can be used but it
95 is no longer required.
96
97 -l preload
98 If preload is specified, ping sends that many packets not waiting
99 for reply. Only the super-user may select preload more than 3.
100
101 -L
102 Suppress loopback of multicast packets. This flag only applies if
103 the ping destination is a multicast address.
104
105 -m mark
106 use mark to tag the packets going out. This is useful for variety
107 of reasons within the kernel such as using policy routing to select
108 specific outbound processing.
109
110 -M pmtudisc_opt
111 Select Path MTU Discovery strategy. pmtudisc_option may be either
112 do (prohibit fragmentation, even local one), want (do PMTU
113 discovery, fragment locally when packet size is large), or dont (do
114 not set DF flag).
115
116 -N nodeinfo_option
117 IPv6 only. Send ICMPv6 Node Information Queries (RFC4620), instead
118 of Echo Request. CAP_NET_RAW capability is required.
119
120 help
121 Show help for NI support.
122
123 name
124 Queries for Node Names.
125
126 ipv6
127 Queries for IPv6 Addresses. There are several IPv6 specific
128 flags.
129
130 ipv6-global
131 Request IPv6 global-scope addresses.
132
133 ipv6-sitelocal
134 Request IPv6 site-local addresses.
135
136 ipv6-linklocal
137 Request IPv6 link-local addresses.
138
139 ipv6-all
140 Request IPv6 addresses on other interfaces.
141
142 ipv4
143 Queries for IPv4 Addresses. There is one IPv4 specific flag.
144
145 ipv4-all
146 Request IPv4 addresses on other interfaces.
147
148 subject-ipv6=ipv6addr
149 IPv6 subject address.
150
151 subject-ipv4=ipv4addr
152 IPv4 subject address.
153
154 subject-name=nodename
155 Subject name. If it contains more than one dot, fully-qualified
156 domain name is assumed.
157
158 subject-fqdn=nodename
159 Subject name. Fully-qualified domain name is always assumed.
160
161 -n
162 Numeric output only. No attempt will be made to lookup symbolic
163 names for host addresses.
164
165 -O
166 Report outstanding ICMP ECHO reply before sending next packet. This
167 is useful together with the timestamp -D to log output to a
168 diagnostic file and search for missing answers.
169
170 -p pattern
171 You may specify up to 16 “pad” bytes to fill out the packet you
172 send. This is useful for diagnosing data-dependent problems in a
173 network. For example, -p ff will cause the sent packet to be filled
174 with all ones.
175
176 -q
177 Quiet output. Nothing is displayed except the summary lines at
178 startup time and when finished.
179
180 -Q tos
181 Set Quality of Service -related bits in ICMP datagrams. tos can be
182 decimal (ping only) or hex number.
183
184 In RFC2474, these fields are interpreted as 8-bit Differentiated
185 Services (DS), consisting of: bits 0-1 (2 lowest bits) of separate
186 data, and bits 2-7 (highest 6 bits) of Differentiated Services
187 Codepoint (DSCP). In RFC2481 and RFC3168, bits 0-1 are used for
188 ECN.
189
190 Historically (RFC1349, obsoleted by RFC2474), these were
191 interpreted as: bit 0 (lowest bit) for reserved (currently being
192 redefined as congestion control), 1-4 for Type of Service and bits
193 5-7 (highest bits) for Precedence.
194
195 -r
196 Bypass the normal routing tables and send directly to a host on an
197 attached interface. If the host is not on a directly-attached
198 network, an error is returned. This option can be used to ping a
199 local host through an interface that has no route through it
200 provided the option -I is also used.
201
202 -R
203 ping only. Record route. Includes the RECORD_ROUTE option in the
204 ECHO_REQUEST packet and displays the route buffer on returned
205 packets. Note that the IP header is only large enough for nine such
206 routes. Many hosts ignore or discard this option.
207
208 -s packetsize
209 Specifies the number of data bytes to be sent. The default is 56,
210 which translates into 64 ICMP data bytes when combined with the 8
211 bytes of ICMP header data.
212
213 -S sndbuf
214 Set socket sndbuf. If not specified, it is selected to buffer not
215 more than one packet.
216
217 -t ttl
218 ping only. Set the IP Time to Live.
219
220 -T timestamp option
221 Set special IP timestamp options. timestamp option may be either
222 tsonly (only timestamps), tsandaddr (timestamps and addresses) or
223 tsprespec host1 [host2 [host3 [host4]]] (timestamp prespecified
224 hops).
225
226 -U
227 Print full user-to-user latency (the old behaviour). Normally ping
228 prints network round trip time, which can be different f.e. due to
229 DNS failures.
230
231 -v
232 Verbose output.
233
234 -V
235 Show version and exit.
236
237 -w deadline
238 Specify a timeout, in seconds, before ping exits regardless of how
239 many packets have been sent or received. In this case ping does not
240 stop after count packet are sent, it waits either for deadline
241 expire or until count probes are answered or for some error
242 notification from network.
243
244 -W timeout
245 Time to wait for a response, in seconds. The option affects only
246 timeout in absence of any responses, otherwise ping waits for two
247 RTTs.
248
249 When using ping for fault isolation, it should first be run on the
250 local host, to verify that the local network interface is up and
251 running. Then, hosts and gateways further and further away should be
252 “pinged”. Round-trip times and packet loss statistics are computed. If
253 duplicate packets are received, they are not included in the packet
254 loss calculation, although the round trip time of these packets is used
255 in calculating the minimum/average/maximum/mdev round-trip time
256 numbers.
257
258 Population standard deviation (mdev), essentially an average of how far
259 each ping RTT is from the mean RTT. The higher mdev is, the more
260 variable the RTT is (over time). With a high RTT variability, you will
261 have speed issues with bulk transfers (they will take longer than is
262 strictly speaking necessary, as the variability will eventually cause
263 the sender to wait for ACKs) and you will have middling to poor VoIP
264 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
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
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
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
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
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
372 ip(8), ss(8).
373
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
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
390 ping is part of iputils package.
391
392
393
394iputils s20190515 PING(8)