]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sbin/ping6/ping6.8
Update to bmake-20201101
[FreeBSD/FreeBSD.git] / sbin / ping6 / ping6.8
1 .\"     $KAME: ping6.8,v 1.58 2003/06/20 12:00:22 itojun Exp $
2 .\"
3 .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 3. Neither the name of the project nor the names of its contributors
15 .\"    may be used to endorse or promote products derived from this software
16 .\"    without specific prior written permission.
17 .\"
18 .\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
19 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
22 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" SUCH DAMAGE.
29 .\"
30 .\" $FreeBSD$
31 .\"
32 .Dd October 2, 2020
33 .Dt PING6 8
34 .Os
35 .Sh NAME
36 .Nm ping6
37 .Nd send
38 .Tn ICMPv6 ECHO_REQUEST
39 packets to network hosts
40 .Sh SYNOPSIS
41 .Nm
42 .\" without ipsec, or new ipsec
43 .Op Fl aAdDfHnNoOquvyY
44 .\" old ipsec
45 .\" .Op Fl ADdEfmnNqRtvwW
46 .Bk -words
47 .Op Fl b Ar bufsiz
48 .Ek
49 .Bk -words
50 .Op Fl C Ar pcp
51 .Ek
52 .Bk -words
53 .Op Fl c Ar count
54 .Ek
55 .Bk -words
56 .Op Fl e Ar gateway
57 .Ek
58 .Bk -words
59 .Op Fl I Ar interface
60 .Ek
61 .Bk -words
62 .Op Fl i Ar wait
63 .Ek
64 .Bk -words
65 .Op Fl k Ar addrtype
66 .Ek
67 .Bk -words
68 .Op Fl l Ar preload
69 .Ek
70 .Bk -words
71 .Op Fl m Ar hoplimit
72 .Ek
73 .Bk -words
74 .\" new ipsec
75 .Op Fl P Ar policy
76 .Ek
77 .Bk -words
78 .Op Fl p Ar pattern
79 .Ek
80 .Bk -words
81 .Op Fl S Ar sourceaddr
82 .Ek
83 .Bk -words
84 .Op Fl s Ar packetsize
85 .Ek
86 .Bk -words
87 .Op Fl t Ar timeout
88 .Ek
89 .Bk -words
90 .Op Fl W Ar waittime
91 .Ek
92 .Bk -words
93 .Op Fl z Ar tclass
94 .Ek
95 .Bk -words
96 .Op Ar hops ...
97 .Ek
98 .Bk -words
99 .Ar host
100 .Ek
101 .Sh DESCRIPTION
102 The
103 .Nm
104 utility uses the
105 .Tn ICMPv6
106 protocol's mandatory
107 .Tn ICMP6_ECHO_REQUEST
108 datagram to elicit an
109 .Tn ICMP6_ECHO_REPLY
110 from a host or gateway.
111 .Tn ICMP6_ECHO_REQUEST
112 datagrams (``pings'') have an IPv6 header,
113 and
114 .Tn ICMPv6
115 header formatted as documented in RFC2463.
116 The options are as follows:
117 .Bl -tag -width Ds
118 .\" old ipsec
119 .\" .It Fl Z
120 .\" Enables transport-mode IPsec authentication header
121 .\" (experimental).
122 .It Fl k Ar addrtype
123 Generate ICMPv6 Node Information Node Addresses query, rather than echo-request.
124 .Ar addrtype
125 must be a string constructed of the following characters.
126 .Bl -tag -width Ds -compact
127 .It Ic a
128 requests unicast addresses from all of the responder's interfaces.
129 If the character is omitted,
130 only those addresses which belong to the interface which has the
131 responder's address are requests.
132 .It Ic c
133 requests responder's IPv4-compatible and IPv4-mapped addresses.
134 .It Ic g
135 requests responder's global-scope addresses.
136 .It Ic s
137 requests responder's site-local addresses.
138 .It Ic l
139 requests responder's link-local addresses.
140 .It Ic A
141 requests responder's anycast addresses.
142 Without this character, the responder will return unicast addresses only.
143 With this character, the responder will return anycast addresses only.
144 Note that the specification does not specify how to get responder's
145 anycast addresses.
146 This is an experimental option.
147 .El
148 .It Fl b Ar bufsiz
149 Set socket buffer size.
150 .It Fl C Ar pcp
151 Add an 802.1p Ethernet Priority Code Point when sending a packet.
152 0..7 uses that specific PCP, -1 uses the interface default PCP (or none).
153 .It Fl c Ar count
154 Stop after sending
155 (and receiving)
156 .Ar count
157 .Tn ECHO_RESPONSE
158 packets.
159 .It Fl D
160 Disable IPv6 fragmentation.
161 .It Fl d
162 Set the
163 .Dv SO_DEBUG
164 option on the socket being used.
165 .\" .It Fl E
166 .\" Enables transport-mode IPsec encapsulated security payload
167 .\" (experimental).
168 .It Fl f
169 Flood ping.
170 Outputs packets as fast as they come back or one hundred times per second,
171 whichever is more.
172 For every
173 .Tn ECHO_REQUEST
174 sent a period
175 .Dq \&.
176 is printed, while for every
177 .Tn ECHO_REPLY
178 received a backspace is printed.
179 This provides a rapid display of how many packets are being dropped.
180 Only the super-user may use this option.
181 .Bf -emphasis
182 This can be very hard on a network and should be used with caution.
183 .Ef
184 .It Fl e Ar gateway
185 Specifies to use
186 .Ar gateway
187 as the next hop to the destination.
188 The gateway must be a neighbor of the sending node.
189 .It Fl H
190 Specifies to try reverse-lookup of IPv6 addresses.
191 The
192 .Nm
193 utility does not try reverse-lookup unless the option is specified.
194 .It Fl m Ar hoplimit
195 Set the IPv6 hoplimit.
196 .It Fl I Ar interface
197 Source packets with the given interface address.
198 This flag applies if the ping destination is a multicast address,
199 or link-local/site-local unicast address.
200 .It Fl i Ar wait
201 Wait
202 .Ar wait
203 seconds
204 .Em between sending each packet .
205 The default is to wait for one second between each packet.
206 This option is incompatible with the
207 .Fl f
208 option.
209 .It Fl W Ar waittime
210 Time in milliseconds to wait for a reply for each packet sent.
211 If a reply arrives later,
212 the packet is not printed as replied,
213 but considered as replied when calculating statistics.
214 .It Fl t Ar timeout
215 Specify a timeout,
216 in seconds,
217 before ping exits regardless of how many packets have been received.
218 .It Fl l Ar preload
219 If
220 .Ar preload
221 is specified,
222 .Nm
223 sends that many packets as fast as possible before falling into its normal
224 mode of behavior.
225 Only the super-user may use this option.
226 .It Fl u
227 By default,
228 .Nm
229 asks the kernel to fragment packets to fit into the minimum IPv6 MTU.
230 The
231 .Fl u
232 option
233 will suppress the behavior in the following two levels:
234 when the option is specified once, the behavior will be disabled for
235 unicast packets.
236 When the option is more than once, it will be disabled for both
237 unicast and multicast packets.
238 .It Fl n
239 Numeric output only.
240 No attempt will be made to lookup symbolic names from addresses in the reply.
241 .It Fl N
242 Probe node information multicast group address
243 .Pq Li ff02::2:ffxx:xxxx .
244 .Ar host
245 must be string hostname of the target
246 (must not be a numeric IPv6 address).
247 Node information multicast group will be computed based on given
248 .Ar host ,
249 and will be used as the final destination.
250 Since node information multicast group is a link-local multicast group,
251 outgoing interface needs to be specified by
252 .Fl I
253 option.
254 .Pp
255 When specified twice, the address
256 .Pq Li ff02::2:xxxx:xxxx
257 is used instead.
258 The former is in RFC 4620, the latter is in an old Internet Draft
259 draft-ietf-ipngwg-icmp-name-lookup.
260 Note that KAME-derived implementations including
261 .Fx
262 use the latter.
263 .It Fl o
264 Exit successfully after receiving one reply packet.
265 .It Fl p Ar pattern
266 You may specify up to 16
267 .Dq pad
268 bytes to fill out the packet you send.
269 This is useful for diagnosing data-dependent problems in a network.
270 For example,
271 .Dq Li \-p ff
272 will cause the sent packet to be filled with all
273 ones.
274 .\" new ipsec
275 .It Fl P Ar policy
276 .Ar policy
277 specifies IPsec policy to be used for the probe.
278 .It Fl q
279 Quiet output.
280 Nothing is displayed except the summary lines at startup time and
281 when finished.
282 .It Fl a
283 Audible.
284 Include a bell
285 .Tn ( ASCII
286 0x07)
287 character in the output when any packet is received.
288 .It Fl A
289 Audible.
290 Output a bell
291 .Tn ( ASCII
292 0x07)
293 character when no packet is received before the next packet
294 is transmitted.
295 To cater for round-trip times that are longer than the interval
296 between transmissions, further missing packets cause a bell only
297 if the maximum number of unreceived packets has increased.
298 .It Fl S Ar sourceaddr
299 Specifies the source address of request packets.
300 The source address must be one of the unicast addresses of the sending node,
301 and must be numeric.
302 .It Fl s Ar packetsize
303 Specifies the number of data bytes to be sent.
304 The default is 56, which translates into 64
305 .Tn ICMP
306 data bytes when combined
307 with the 8 bytes of
308 .Tn ICMP
309 header data.
310 You may need to specify
311 .Fl b
312 as well to extend socket buffer size.
313 .It Fl O
314 Generate ICMPv6 Node Information supported query types query,
315 rather than echo-request.
316 .Fl s
317 has no effect if
318 .Fl O
319 is specified.
320 .It Fl v
321 Verbose output.
322 .Tn ICMP
323 packets other than
324 .Tn ECHO_RESPONSE
325 that are received are listed.
326 .It Fl y
327 Generate ICMPv6 Node Information DNS Name query, rather than echo-request.
328 .Fl s
329 has no effect if
330 .Fl y
331 is specified.
332 .It Fl Y
333 Same as
334 .Fl y ,
335 but with old packet format based on 03 draft.
336 This option is present for backward compatibility.
337 .Fl s
338 has no effect if
339 .Fl y
340 is specified.
341 .It Fl z Ar tclass
342 Use the specified traffic class when sending.
343 .It Ar hops
344 IPv6 addresses for intermediate nodes,
345 which will be put into type 0 routing header.
346 .It Ar host
347 IPv6 address of the final destination node.
348 .El
349 .Pp
350 When using
351 .Nm
352 for fault isolation, it should first be run on the local host, to verify
353 that the local network interface is up and running.
354 Then, hosts and gateways further and further away should be
355 .Dq pinged .
356 Round-trip times and packet loss statistics are computed.
357 If duplicate packets are received, they are not included in the packet
358 loss calculation, although the round trip time of these packets is used
359 in calculating the round-trip time statistics.
360 When the specified number of packets have been sent
361 (and received)
362 or if the program is terminated with a
363 .Dv SIGINT ,
364 a brief summary is displayed, showing the number of packets sent and
365 received, and the minimum, mean, maximum, and standard deviation of
366 the round-trip times.
367 .Pp
368 If
369 .Nm
370 receives a
371 .Dv SIGINFO
372 (see the
373 .Cm status
374 argument for
375 .Xr stty 1 )
376 signal, the current number of packets sent and received, and the
377 minimum, mean, maximum, and standard deviation of the round-trip times
378 will be written to the standard output in the same format as the
379 standard completion message.
380 .Pp
381 This program is intended for use in network testing, measurement and
382 management.
383 Because of the load it can impose on the network, it is unwise to use
384 .Nm
385 during normal operations or from automated scripts.
386 .\" .Sh ICMP PACKET DETAILS
387 .\" An IP header without options is 20 bytes.
388 .\" An
389 .\" .Tn ICMP
390 .\" .Tn ECHO_REQUEST
391 .\" packet contains an additional 8 bytes worth of
392 .\" .Tn ICMP
393 .\" header followed by an arbitrary amount of data.
394 .\" When a
395 .\" .Ar packetsize
396 .\" is given, this indicated the size of this extra piece of data
397 .\" (the default is 56).
398 .\" Thus the amount of data received inside of an IP packet of type
399 .\" .Tn ICMP
400 .\" .Tn ECHO_REPLY
401 .\" will always be 8 bytes more than the requested data space
402 .\" (the
403 .\" .Tn ICMP
404 .\" header).
405 .\" .Pp
406 .\" If the data space is at least eight bytes large,
407 .\" .Nm
408 .\" uses the first eight bytes of this space to include a timestamp which
409 .\" it uses in the computation of round trip times.
410 .\" If less than eight bytes of pad are specified, no round trip times are
411 .\" given.
412 .Sh DUPLICATE AND DAMAGED PACKETS
413 The
414 .Nm
415 utility will report duplicate and damaged packets.
416 Duplicate packets should never occur when pinging a unicast address,
417 and seem to be caused by
418 inappropriate link-level retransmissions.
419 Duplicates may occur in many situations and are rarely
420 (if ever)
421 a good sign, although the presence of low levels of duplicates may not
422 always be cause for alarm.
423 Duplicates are expected when pinging a broadcast or multicast address,
424 since they are not really duplicates but replies from different hosts
425 to the same request.
426 .Pp
427 Damaged packets are obviously serious cause for alarm and often
428 indicate broken hardware somewhere in the
429 .Nm
430 packet's path
431 (in the network or in the hosts).
432 .Sh TRYING DIFFERENT DATA PATTERNS
433 The
434 (inter)network
435 layer should never treat packets differently depending on the data
436 contained in the data portion.
437 Unfortunately, data-dependent problems have been known to sneak into
438 networks and remain undetected for long periods of time.
439 In many cases the particular pattern that will have problems is something
440 that does not have sufficient
441 .Dq transitions ,
442 such as all ones or all zeros, or a pattern right at the edge, such as
443 almost all zeros.
444 It is not
445 necessarily enough to specify a data pattern of all zeros (for example)
446 on the command line because the pattern that is of interest is
447 at the data link level, and the relationship between what you type and
448 what the controllers transmit can be complicated.
449 .Pp
450 This means that if you have a data-dependent problem you will probably
451 have to do a lot of testing to find it.
452 If you are lucky, you may manage to find a file that either
453 cannot
454 be sent across your network or that takes much longer to transfer than
455 other similar length files.
456 You can then examine this file for repeated patterns that you can test
457 using the
458 .Fl p
459 option of
460 .Nm .
461 .Sh EXIT STATUS
462 The
463 .Nm
464 utility returns 0 on success (the host is alive),
465 2 if the transmission was successful but no responses were received,
466 any other non-zero value if the arguments are incorrect or
467 another error has occurred.
468 .Sh EXAMPLES
469 Normally,
470 .Nm
471 works just like
472 .Xr ping 8
473 would work; the following will send ICMPv6 echo request to
474 .Li dst.foo.com .
475 .Bd -literal -offset indent
476 ping6 -n dst.foo.com
477 .Ed
478 .Pp
479 The following will probe hostnames for all nodes on the network link attached to
480 .Li wi0
481 interface.
482 The address
483 .Li ff02::1
484 is named the link-local all-node multicast address, and the packet would
485 reach every node on the network link.
486 .Bd -literal -offset indent
487 ping6 -y ff02::1%wi0
488 .Ed
489 .Pp
490 The following will probe addresses assigned to the destination node,
491 .Li dst.foo.com .
492 .Bd -literal -offset indent
493 ping6 -k agl dst.foo.com
494 .Ed
495 .Sh SEE ALSO
496 .Xr netstat 1 ,
497 .Xr icmp6 4 ,
498 .Xr inet6 4 ,
499 .Xr ip6 4 ,
500 .Xr ifconfig 8 ,
501 .Xr ping 8 ,
502 .Xr routed 8 ,
503 .Xr traceroute 8 ,
504 .Xr traceroute6 8
505 .Rs
506 .%A A. Conta
507 .%A S. Deering
508 .%T "Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification"
509 .%N RFC2463
510 .%D December 1998
511 .Re
512 .Rs
513 .%A Matt Crawford
514 .%T "IPv6 Node Information Queries"
515 .%N draft-ietf-ipngwg-icmp-name-lookups-09.txt
516 .%D May 2002
517 .%O work in progress material
518 .Re
519 .Sh HISTORY
520 The
521 .Xr ping 8
522 utility appeared in
523 .Bx 4.3 .
524 The
525 .Nm
526 utility with IPv6 support first appeared in the WIDE Hydrangea IPv6
527 protocol stack kit.
528 .Pp
529 IPv6 and IPsec support based on the KAME Project
530 .Pq Pa http://www.kame.net/
531 stack was initially integrated into
532 .Fx 4.0 .
533 .Sh BUGS
534 The
535 .Nm
536 utility
537 is intentionally separate from
538 .Xr ping 8 .
539 .Pp
540 There have been many discussions on why we separate
541 .Nm
542 and
543 .Xr ping 8 .
544 Some people argued that it would be more convenient to uniform the
545 ping command for both IPv4 and IPv6.
546 The followings are an answer to the request.
547 .Pp
548 From a developer's point of view:
549 since the underling raw sockets API is totally different between IPv4
550 and IPv6, we would end up having two types of code base.
551 There would actually be less benefit to uniform the two commands
552 into a single command from the developer's standpoint.
553 .Pp
554 From an operator's point of view: unlike ordinary network applications
555 like remote login tools, we are usually aware of address family when using
556 network management tools.
557 We do not just want to know the reachability to the host, but want to know the
558 reachability to the host via a particular network protocol such as
559 IPv6.
560 Thus, even if we had a unified
561 .Xr ping 8
562 command for both IPv4 and IPv6, we would usually type a
563 .Fl 6
564 or
565 .Fl 4
566 option (or something like those) to specify the particular address family.
567 This essentially means that we have two different commands.