xref: /netbsd/sbin/ping6/ping6.8 (revision bf9ec67e)
1.\"	$NetBSD: ping6.8,v 1.22 2002/05/26 13:21:01 itojun 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 17, 1998
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 dfHnNqRtvwW
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 RFC2463.
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 n
199Numeric output only.
200No attempt will be made to lookup symbolic names from addresses in the reply.
201.It Fl N
202Probe node information multicast group
203.Pq Li ff02::2:xxxx:xxxx .
204.Ar host
205must be string hostname of the target
206.Pq must not be a numeric IPv6 address .
207Node information multicast group will be computed based on given
208.Ar host ,
209and will be used as the final destination.
210Since node information multicast group is a link-local multicast group,
211outgoing interface needs to be specified by
212.Fl I
213option.
214.It Fl p Ar pattern
215You may specify up to 16
216.Dq pad
217bytes to fill out the packet you send.
218This is useful for diagnosing data-dependent problems in a network.
219For example,
220.Dq Li \-p ff
221will cause the sent packet to be filled with all
222ones.
223.\" new ipsec
224.It Fl P Ar policy
225.Ar policy
226specifies IPsec policy to be used for the probe.
227.It Fl q
228Quiet output.
229Nothing is displayed except the summary lines at startup time and
230when finished.
231.It Fl R
232Make the kernel believe that the target
233.Ar host
234.Po
235or the first
236.Ar hop
237if you specify
238.Ar hops
239.Pc
240is reachable, by injecting upper-layer reachability confirmation hint.
241The option is meaningful only if the target
242.Ar host
243.Pq or the first hop
244is a neighbor.
245.It Fl S Ar sourceaddr
246Specifies the source address of request packets.
247The source address must be one of the unicast addresses of the sending node,
248and must be numeric.
249.It Fl s Ar packetsize
250Specifies the number of data bytes to be sent.
251The default is 56, which translates into 64
252.Tn ICMP
253data bytes when combined
254with the 8 bytes of
255.Tn ICMP
256header data.
257You may need to specify
258.Fl b
259as well to extend socket buffer size.
260.It Fl t
261Generate ICMPv6 Node Information supported query types query,
262rather than echo-request.
263.Fl s
264has no effect if
265.Fl t
266is specified.
267.It Fl v
268Verbose output.
269.Tn ICMP
270packets other than
271.Tn ECHO_RESPONSE
272that are received are listed.
273.It Fl w
274Generate ICMPv6 Node Information DNS Name query, rather than echo-request.
275.Fl s
276has no effect if
277.Fl w
278is specified.
279.It Fl W
280Same as
281.Fl w ,
282but with old packet format based on 03 draft.
283This option is present for backward compatibility.
284.Fl s
285has no effect if
286.Fl w
287is specified.
288.It Ar hops
289IPv6 addresses for intermediate nodes,
290which will be put into type 0 routing header.
291.It Ar host
292IPv6 adddress of the final destination node.
293.El
294.Pp
295When using
296.Nm
297for fault isolation, it should first be run on the local host, to verify
298that the local network interface is up and running.
299Then, hosts and gateways further and further away should be
300.Dq pinged .
301Round-trip times and packet loss statistics are computed.
302If duplicate packets are received, they are not included in the packet
303loss calculation, although the round trip time of these packets is used
304in calculating the round-trip time statistics.
305When the specified number of packets have been sent
306.Pq and received
307or if the program is terminated with a
308.Dv SIGINT ,
309a brief summary is displayed, showing the number of packets sent and
310received, and the minimum, maximum, mean, and standard deviation of
311the round-trip times.
312.Pp
313This program is intended for use in network testing, measurement and
314management.
315Because of the load it can impose on the network, it is unwise to use
316.Nm
317during normal operations or from automated scripts.
318.\" .Sh ICMP PACKET DETAILS
319.\" An IP header without options is 20 bytes.
320.\" An
321.\" .Tn ICMP
322.\" .Tn ECHO_REQUEST
323.\" packet contains an additional 8 bytes worth of
324.\" .Tn ICMP
325.\" header followed by an arbitrary amount of data.
326.\" When a
327.\" .Ar packetsize
328.\" is given, this indicated the size of this extra piece of data
329.\" .Pq the default is 56 .
330.\" Thus the amount of data received inside of an IP packet of type
331.\" .Tn ICMP
332.\" .Tn ECHO_REPLY
333.\" will always be 8 bytes more than the requested data space
334.\" .Pq the Tn ICMP header .
335.\" .Pp
336.\" If the data space is at least eight bytes large,
337.\" .Nm
338.\" uses the first eight bytes of this space to include a timestamp which
339.\" it uses in the computation of round trip times.
340.\" If less than eight bytes of pad are specified, no round trip times are
341.\" given.
342.Sh DUPLICATE AND DAMAGED PACKETS
343.Nm
344will report duplicate and damaged packets.
345Duplicate packets should never occur when pinging a unicast address,
346and seem to be caused by
347inappropriate link-level retransmissions.
348Duplicates may occur in many situations and are rarely
349.Pq if ever
350a good sign, although the presence of low levels of duplicates may not
351always be cause for alarm.
352Duplicates are expected when pinging a broadcast or multicast address,
353since they are not really duplicates but replies from different hosts
354to the same request.
355.Pp
356Damaged packets are obviously serious cause for alarm and often
357indicate broken hardware somewhere in the
358.Nm
359packet's path
360.Pq in the network or in the hosts .
361.Sh TRYING DIFFERENT DATA PATTERNS
362The
363(inter)network
364layer should never treat packets differently depending on the data
365contained in the data portion.
366Unfortunately, data-dependent problems have been known to sneak into
367networks and remain undetected for long periods of time.
368In many cases the particular pattern that will have problems is something
369that does not have sufficient
370.Dq transitions ,
371such as all ones or all zeros, or a pattern right at the edge, such as
372almost all zeros.
373It is not
374necessarily enough to specify a data pattern of all zeros (for example)
375on the command line because the pattern that is of interest is
376at the data link level, and the relationship between what you type and
377what the controllers transmit can be complicated.
378.Pp
379This means that if you have a data-dependent problem you will probably
380have to do a lot of testing to find it.
381If you are lucky, you may manage to find a file that either
382cannot
383be sent across your network or that takes much longer to transfer than
384other similar length files.
385You can then examine this file for repeated patterns that you can test
386using the
387.Fl p
388option of
389.Nm Ns .
390.Sh EXIT STATUS
391.Nm
392exits with 0 on success (the host is alive),
393and non-zero if the arguments are incorrect or the host is not responding.
394.Sh EXAMPLES
395Normally,
396.Nm
397works just like
398.Xr ping 8
399would work; the following will send ICMPv6 echo request to
400.Li dst.foo.com .
401.Bd -literal -offset indent
402ping6 -n dst.foo.com
403.Ed
404.Pp
405The following will probe hostnames for all nodes on the network link attached to
406.Li wi0
407interface.
408The address
409.Li ff02::1
410is named the link-local all-node multicast address, and the packet would
411reach every node on the network link.
412.Bd -literal -offset indent
413ping6 -w ff02::1%wi0
414.Ed
415.Pp
416The following will probe addresses assigned to the destination node,
417.Li dst.foo.com .
418.Bd -literal -offset indent
419ping6 -a agl dst.foo.com
420.Ed
421.Sh SEE ALSO
422.Xr netstat 1 ,
423.Xr icmp6 4 ,
424.Xr inet6 4 ,
425.Xr ip6 4 ,
426.Xr ifconfig 8 ,
427.Xr ping 8 ,
428.Xr routed 8 ,
429.Xr traceroute 8 ,
430.Xr traceroute6 8
431.Rs
432.%A A. Conta
433.%A S. Deering
434.%T "Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification"
435.%N RFC2463
436.%D December 1998
437.Re
438.Rs
439.%A Matt Crawford
440.%T "IPv6 Node Information Queries"
441.%N draft-ietf-ipngwg-icmp-name-lookups-09.txt
442.%D May 2002
443.%O work in progress material
444.Re
445.Sh HISTORY
446The
447.Xr ping 8
448command appeared in
449.Bx 4.3 .
450The
451.Nm
452command with IPv6 support first appeared in the WIDE Hydrangea IPv6
453protocol stack kit.
454.Sh BUGS
455.\" except for bsdi
456.Nm
457is intentionally separate from
458.Xr ping 8 .
459