]> git.cameronkatri.com Git - apple_cmds.git/blob - network_cmds/ping6.tproj/ping6.8
network_cmds: Get it all working
[apple_cmds.git] / network_cmds / 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 sweepmaxsize[,sweepminsize[,sweepincrsize]]
83 .Ek
84 .Bk -words
85 .Op Fl g Ar gateway
86 .Ek
87 .Bk -words
88 .Op Fl G Ar sweep
89 .Ek
90 .Bk -words
91 .Op Fl h Ar hoplimit
92 .Ek
93 .Bk -words
94 .Op Fl I Ar interface
95 .Ek
96 .Bk -words
97 .Op Fl i Ar wait
98 .Ek
99 .Bk -words
100 .Op Fl k Ar trafficclass
101 .Ek
102 .Bk -words
103 .Op Fl K Ar netservicetype
104 .Ek
105 .Bk -words
106 .Op Fl l Ar preload
107 .Ek
108 .Bk -words
109 .\" new ipsec
110 .Op Fl P Ar policy
111 .Ek
112 .Bk -words
113 .Op Fl p Ar pattern
114 .Ek
115 .Bk -words
116 .Op Fl S Ar sourceaddr
117 .Ek
118 .Bk -words
119 .Op Fl s Ar packetsize
120 .Ek
121 .Bk -words
122 .Op Fl z Ar tclass
123 .Ek
124 .Bk -words
125 .Op Fl Fl apple-connect
126 .Ek
127 .Bk -words
128 .Op Fl Fl apple-time
129 .Ek
130 .Bk -words
131 .Op Ar hops ...
132 .Ek
133 .Bk -words
134 .Ar host
135 .Ek
136 .Sh DESCRIPTION
137 The
138 .Nm
139 utility uses the
140 .Tn ICMPv6
141 protocol's mandatory
142 .Tn ICMP6_ECHO_REQUEST
143 datagram to elicit an
144 .Tn ICMP6_ECHO_REPLY
145 from a host or gateway.
146 .Tn ICMP6_ECHO_REQUEST
147 datagrams (``pings'') have an IPv6 header,
148 and
149 .Tn ICMPv6
150 header formatted as documented in RFC2463.
151 The options are as follows:
152 .Bl -tag -width Ds
153 .\" old ipsec
154 .\" .It Fl A
155 .\" Enables transport-mode IPsec authentication header
156 .\" (experimental).
157 .It Fl a Ar addrtype
158 Generate ICMPv6 Node Information Node Addresses query, rather than echo-request.
159 .Ar addrtype
160 must be a string constructed of the following characters.
161 .Bl -tag -width Ds -compact
162 .It Ic a
163 requests unicast addresses from all of the responder's interfaces.
164 If the character is omitted,
165 only those addresses which belong to the interface which has the
166 responder's address are requests.
167 .It Ic c
168 requests responder's IPv4-compatible and IPv4-mapped addresses.
169 .It Ic g
170 requests responder's global-scope addresses.
171 .It Ic s
172 requests responder's site-local addresses.
173 .It Ic l
174 requests responder's link-local addresses.
175 .It Ic A
176 requests responder's anycast addresses.
177 Without this character, the responder will return unicast addresses only.
178 With this character, the responder will return anycast addresses only.
179 Note that the specification does not specify how to get responder's
180 anycast addresses.
181 This is an experimental option.
182 .El
183 .It Fl b Ar bufsiz
184 Set socket buffer size.
185 .It Fl B Ar boundif
186 Bind the socket to interface
187 This option is an Apple addition.
188 .Ar boundif
189 for sending.
190 .It Fl C
191 Prohibit the socket from using the cellular network interface.
192 .It Fl c Ar count
193 Stop after sending
194 (and receiving)
195 .Ar count
196 .Tn ECHO_RESPONSE
197 packets.
198 If this option is specified in conjunction with ping sweeps,
199 each sweep will consist of
200 .Ar count
201 packets.
202 .It Fl D
203 Disable IPv6 fragmentation.
204 .It Fl d
205 Set the
206 .Dv SO_DEBUG
207 option on the socket being used.
208 .\" .It Fl E
209 .\" Enables transport-mode IPsec encapsulated security payload
210 .\" (experimental).
211 .It Fl f
212 Flood ping.
213 Outputs packets as fast as they come back or one hundred times per second,
214 whichever is more.
215 For every
216 .Tn ECHO_REQUEST
217 sent a period
218 .Dq \&.
219 is printed, while for every
220 .Tn ECHO_REPLY
221 received a backspace is printed.
222 This provides a rapid display of how many packets are being dropped.
223 Only the super-user may use this option.
224 .Bf -emphasis
225 This can be very hard on a network and should be used with caution.
226 .Ef
227 .It Fl G Ar sweepmaxsize[,sweepminsize[,sweepincrsize]]
228 .Ar sweepmaxsize
229 specifies the maximum size of the payload when sending sweeping
230 pings and is required for sweeps.
231 .Ar sweepminsize
232 specifies the size of the payload to start with when sending
233 sweeping pings -- the default value is 0.
234 .Ar sweepincrsize
235 specifies the number of bytes to increment the size of the payload
236 after each sweep when sending sweeping pings -- the default value
237 is 1.
238 This option is an Apple addition.
239 .It Fl g Ar gateway
240 Specifies to use
241 .Ar gateway
242 as the next hop to the destination.
243 The gateway must be a neighbor of the sending node.
244 .It Fl H
245 Specifies to try reverse-lookup of IPv6 addresses.
246 The
247 .Nm
248 utility does not try reverse-lookup unless the option is specified.
249 .It Fl h Ar hoplimit
250 Set the IPv6 hoplimit.
251 .It Fl I Ar interface
252 Source packets with the given interface address.
253 This flag applies if the ping destination is a multicast address,
254 or link-local/site-local unicast address.
255 .It Fl i Ar wait
256 Wait
257 .Ar wait
258 seconds
259 .Em between sending each packet .
260 The default is to wait for one second between each packet.
261 The wait time may be fractional, but only the super-user may specify
262 values less than 0.1 second.
263 This option is incompatible with the
264 .Fl f
265 option.
266 .It Fl k Ar trafficclass
267 Specifies the traffic class to use for sending ICMPv6 packets.
268 The supported traffic classes are
269 BK_SYS, BK, BE, RD, OAM, AV, RV, VI, VO and CTL.
270 By default
271 .Nm
272 uses the control traffic class (CTL).
273 This option is an Apple addition.
274 .It Fl K Ar netservicetype
275 Specifies the network service type to use for sending ICMPv6 packets.
276 The supported network service type are BK_SYS, BK, BE, RV, AV, RD, OAM, VI, SIG and VO.
277 Note this overrides the default traffic class (-k can still be specified after -K to use both).
278 This option is an Apple addition.
279 .It Fl l Ar preload
280 If
281 .Ar preload
282 is specified,
283 .Nm
284 sends that many packets as fast as possible before falling into its normal
285 mode of behavior.
286 Only the super-user may use this option.
287 .It Fl m
288 By default,
289 .Nm
290 asks the kernel to fragment packets to fit into the minimum IPv6 MTU.
291 The
292 .Fl m
293 option
294 will suppress the behavior in the following two levels:
295 when the option is specified once, the behavior will be disabled for
296 unicast packets.
297 When the option is more than once, it will be disabled for both
298 unicast and multicast packets.
299 .It Fl n
300 Numeric output only.
301 No attempt will be made to lookup symbolic names from addresses in the reply.
302 .It Fl N
303 Probe node information multicast group
304 .Pq Li ff02::2:xxxx:xxxx .
305 .Ar host
306 must be string hostname of the target
307 (must not be a numeric IPv6 address).
308 Node information multicast group will be computed based on given
309 .Ar host ,
310 and will be used as the final destination.
311 Since node information multicast group is a link-local multicast group,
312 outgoing interface needs to be specified by
313 .Fl I
314 option.
315 .It Fl o
316 Exit successfully after receiving one reply packet.
317 .It Fl p Ar pattern
318 You may specify up to 16
319 .Dq pad
320 bytes to fill out the packet you send.
321 This is useful for diagnosing data-dependent problems in a network.
322 For example,
323 .Dq Li \-p ff
324 will cause the sent packet to be filled with all
325 ones.
326 .\" new ipsec
327 .It Fl P Ar policy
328 .Ar policy
329 specifies IPsec policy to be used for the probe.
330 .It Fl q
331 Quiet output.
332 Nothing is displayed except the summary lines at startup time and
333 when finished.
334 .It Fl r
335 Audible.
336 Include a bell
337 .Tn ( ASCII
338 0x07)
339 character in the output when any packet is received.
340 .It Fl R
341 Audible.
342 Output a bell
343 .Tn ( ASCII
344 0x07)
345 character when no packet is received before the next packet
346 is transmitted.
347 To cater for round-trip times that are longer than the interval
348 between transmissions, further missing packets cause a bell only
349 if the maximum number of unreceived packets has increased.
350 .It Fl S Ar sourceaddr
351 Specifies the source address of request packets.
352 The source address must be one of the unicast addresses of the sending node,
353 and must be numeric.
354 .It Fl s Ar packetsize
355 Specifies the number of data bytes to be sent.
356 The default is 56, which translates into 64
357 .Tn ICMP
358 data bytes when combined
359 with the 8 bytes of
360 .Tn ICMP
361 header data.
362 You may need to specify
363 .Fl b
364 as well to extend socket buffer size.
365 .It Fl t
366 Generate ICMPv6 Node Information supported query types query,
367 rather than echo-request.
368 .Fl s
369 has no effect if
370 .Fl t
371 is specified.
372 .It Fl v
373 Verbose output.
374 .Tn ICMP
375 packets other than
376 .Tn ECHO_RESPONSE
377 that are received are listed.
378 .It Fl w
379 Generate ICMPv6 Node Information DNS Name query, rather than echo-request.
380 .Fl s
381 has no effect if
382 .Fl w
383 is specified.
384 .It Fl W
385 Same as
386 .Fl w ,
387 but with old packet format based on 03 draft.
388 This option is present for backward compatibility.
389 .Fl s
390 has no effect if
391 .Fl w
392 is specified.
393 .It Fl z Ar tclass
394 Use the specified traffic class.
395 .It Fl Fl apple-connect
396 Connects the socket to the destination address.
397 This option is an Apple addition.
398 .It Fl Fl apple-time
399 Prints the time a packet was received.
400 This option is an Apple addition.
401 .It Ar hops
402 IPv6 addresses for intermediate nodes,
403 which will be put into type 0 routing header.
404 .It Ar host
405 IPv6 address of the final destination node.
406 .El
407 .Pp
408 When using
409 .Nm
410 for fault isolation, it should first be run on the local host, to verify
411 that the local network interface is up and running.
412 Then, hosts and gateways further and further away should be
413 .Dq pinged .
414 Round-trip times and packet loss statistics are computed.
415 If duplicate packets are received, they are not included in the packet
416 loss calculation, although the round trip time of these packets is used
417 in calculating the round-trip time statistics.
418 When the specified number of packets have been sent
419 (and received)
420 or if the program is terminated with a
421 .Dv SIGINT ,
422 a brief summary is displayed, showing the number of packets sent and
423 received, and the minimum, mean, maximum, and standard deviation of
424 the round-trip times.
425 .Pp
426 If
427 .Nm
428 receives a
429 .Dv SIGINFO
430 (see the
431 .Cm status
432 argument for
433 .Xr stty 1 )
434 signal, the current number of packets sent and received, and the
435 minimum, mean, maximum, and standard deviation of the round-trip times
436 will be written to the standard output in the same format as the
437 standard completion message.
438 .Pp
439 This program is intended for use in network testing, measurement and
440 management.
441 Because of the load it can impose on the network, it is unwise to use
442 .Nm
443 during normal operations or from automated scripts.
444 .\" .Sh ICMP PACKET DETAILS
445 .\" An IP header without options is 20 bytes.
446 .\" An
447 .\" .Tn ICMP
448 .\" .Tn ECHO_REQUEST
449 .\" packet contains an additional 8 bytes worth of
450 .\" .Tn ICMP
451 .\" header followed by an arbitrary amount of data.
452 .\" When a
453 .\" .Ar packetsize
454 .\" is given, this indicated the size of this extra piece of data
455 .\" (the default is 56).
456 .\" Thus the amount of data received inside of an IP packet of type
457 .\" .Tn ICMP
458 .\" .Tn ECHO_REPLY
459 .\" will always be 8 bytes more than the requested data space
460 .\" (the
461 .\" .Tn ICMP
462 .\" header).
463 .\" .Pp
464 .\" If the data space is at least eight bytes large,
465 .\" .Nm
466 .\" uses the first eight bytes of this space to include a timestamp which
467 .\" it uses in the computation of round trip times.
468 .\" If less than eight bytes of pad are specified, no round trip times are
469 .\" given.
470 .Sh DUPLICATE AND DAMAGED PACKETS
471 The
472 .Nm
473 utility will report duplicate and damaged packets.
474 Duplicate packets should never occur when pinging a unicast address,
475 and seem to be caused by
476 inappropriate link-level retransmissions.
477 Duplicates may occur in many situations and are rarely
478 (if ever)
479 a good sign, although the presence of low levels of duplicates may not
480 always be cause for alarm.
481 Duplicates are expected when pinging a broadcast or multicast address,
482 since they are not really duplicates but replies from different hosts
483 to the same request.
484 .Pp
485 Damaged packets are obviously serious cause for alarm and often
486 indicate broken hardware somewhere in the
487 .Nm
488 packet's path
489 (in the network or in the hosts).
490 .Sh TRYING DIFFERENT DATA PATTERNS
491 The
492 (inter)network
493 layer should never treat packets differently depending on the data
494 contained in the data portion.
495 Unfortunately, data-dependent problems have been known to sneak into
496 networks and remain undetected for long periods of time.
497 In many cases the particular pattern that will have problems is something
498 that does not have sufficient
499 .Dq transitions ,
500 such as all ones or all zeros, or a pattern right at the edge, such as
501 almost all zeros.
502 It is not
503 necessarily enough to specify a data pattern of all zeros (for example)
504 on the command line because the pattern that is of interest is
505 at the data link level, and the relationship between what you type and
506 what the controllers transmit can be complicated.
507 .Pp
508 This means that if you have a data-dependent problem you will probably
509 have to do a lot of testing to find it.
510 If you are lucky, you may manage to find a file that either
511 cannot
512 be sent across your network or that takes much longer to transfer than
513 other similar length files.
514 You can then examine this file for repeated patterns that you can test
515 using the
516 .Fl p
517 option of
518 .Nm .
519 .Sh EXIT STATUS
520 The
521 .Nm
522 utility returns 0 on success (the host is alive),
523 2 if the transmission was successful but no responses were received,
524 any other non-zero value if the arguments are incorrect or
525 another error has occurred.
526 .Sh EXAMPLES
527 Normally,
528 .Nm
529 works just like
530 .Xr ping 8
531 would work; the following will send ICMPv6 echo request to
532 .Li dst.foo.com .
533 .Bd -literal -offset indent
534 ping6 -n dst.foo.com
535 .Ed
536 .Pp
537 The following will probe hostnames for all nodes on the network link attached to
538 .Li wi0
539 interface.
540 The address
541 .Li ff02::1
542 is named the link-local all-node multicast address, and the packet would
543 reach every node on the network link.
544 .Bd -literal -offset indent
545 ping6 -w ff02::1%wi0
546 .Ed
547 .Pp
548 The following will probe addresses assigned to the destination node,
549 .Li dst.foo.com .
550 .Bd -literal -offset indent
551 ping6 -a agl dst.foo.com
552 .Ed
553 .Sh SEE ALSO
554 .Xr netstat 1 ,
555 .Xr icmp6 4 ,
556 .Xr inet6 4 ,
557 .Xr ip6 4 ,
558 .Xr ifconfig 8 ,
559 .Xr ping 8 ,
560 .Xr routed 8 ,
561 .Xr traceroute 8 ,
562 .Xr traceroute6 8
563 .Rs
564 .%A A. Conta
565 .%A S. Deering
566 .%T "Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification"
567 .%N RFC2463
568 .%D December 1998
569 .Re
570 .Rs
571 .%A Matt Crawford
572 .%T "IPv6 Node Information Queries"
573 .%N draft-ietf-ipngwg-icmp-name-lookups-09.txt
574 .%D May 2002
575 .%O work in progress material
576 .Re
577 .Sh HISTORY
578 The
579 .Xr ping 8
580 utility appeared in
581 .Bx 4.3 .
582 The
583 .Nm
584 utility with IPv6 support first appeared in the WIDE Hydrangea IPv6
585 protocol stack kit.
586 .Pp
587 IPv6 and IPsec support based on the KAME Project
588 .Pq Pa http://www.kame.net/
589 stack was initially integrated into
590 .Fx 4.0 .
591 .Sh BUGS
592 The
593 .Nm
594 utility
595 is intentionally separate from
596 .Xr ping 8 .
597 .Pp
598 There have been many discussions on why we separate
599 .Nm
600 and
601 .Xr ping 8 .
602 Some people argued that it would be more convenient to uniform the
603 ping command for both IPv4 and IPv6.
604 The followings are an answer to the request.
605 .Pp
606 From a developer's point of view:
607 since the underling raw sockets API is totally different between IPv4
608 and IPv6, we would end up having two types of code base.
609 There would actually be less benefit to uniform the two commands
610 into a single command from the developer's standpoint.
611 .Pp
612 From an operator's point of view: unlike ordinary network applications
613 like remote login tools, we are usually aware of address family when using
614 network management tools.
615 We do not just want to know the reachability to the host, but want to know the
616 reachability to the host via a particular network protocol such as
617 IPv6.
618 Thus, even if we had a unified
619 .Xr ping 8
620 command for both IPv4 and IPv6, we would usually type a
621 .Fl 6
622 or
623 .Fl 4
624 option (or something like those) to specify the particular address family.
625 This essentially means that we have two different commands.