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