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