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