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