xref: /dragonfly/sbin/ping6/ping6.8 (revision 19fe1c42)
1.\"	$KAME: ping6.8,v 1.43 2001/06/28 06:54:29 suz Exp $
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.\"
30.\"	$FreeBSD: src/sbin/ping6/ping6.8,v 1.3.2.12 2003/02/24 00:56:42 trhodes Exp $
31.\"	$DragonFly: src/sbin/ping6/ping6.8,v 1.7 2007/11/23 23:16:36 swildner Exp $
32.\"
33.Dd May 17, 1998
34.Dt PING6 8
35.Os
36.Sh NAME
37.Nm ping6
38.Nd send
39.Tn ICMPv6 ECHO_REQUEST
40packets to network hosts
41.Sh SYNOPSIS
42.Nm
43.\" without ipsec, or new ipsec
44.Op Fl dfHnNqRtvwW
45.\" old ipsec
46.\" .Op Fl AdEfnNqRtvwW
47.Bk -words
48.Op Fl a Ar addrtype
49.Ek
50.Bk -words
51.Op Fl b Ar bufsiz
52.Ek
53.Bk -words
54.Op Fl c Ar count
55.Ek
56.Bk -words
57.Op Fl h Ar hoplimit
58.Ek
59.Bk -words
60.Op Fl I Ar interface
61.Ek
62.Bk -words
63.Op Fl i Ar wait
64.Ek
65.Bk -words
66.Op Fl l Ar preload
67.Ek
68.Bk -words
69.Op Fl p Ar pattern
70.Ek
71.Bk -words
72.\" new ipsec
73.Op Fl P Ar policy
74.Ek
75.Bk -words
76.Op Fl S Ar sourceaddr
77.Ek
78.Bk -words
79.Op Fl s Ar packetsize
80.Ek
81.Bk -words
82.Op Ar hops...\&
83.Ek
84.Bk -words
85.Ar host
86.Ek
87.Sh DESCRIPTION
88The
89.Nm
90utility uses 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.\" (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 all the responder's unicast addresses.
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(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.\" (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 H
166Specifies to try reverse-lookup of IPv6 addresses.
167The
168.Nm
169utility does not try reverse-lookup unless the option is specified.
170.It Fl h Ar hoplimit
171Set the IPv6 hoplimit.
172.It Fl I Ar interface
173Source packets with the given interface address.
174This flag applies if the ping destination is a multicast address,
175or link-local/site-local unicast address.
176.It Fl i Ar wait
177Wait
178.Ar wait
179seconds
180.Em between sending each packet .
181The default is to wait for one second between each packet.
182This option is incompatible with the
183.Fl f
184option.
185.It Fl l Ar preload
186If
187.Ar preload
188is specified,
189.Nm
190sends that many packets as fast as possible before falling into its normal
191mode of behavior.
192Only the super-user may use this option.
193.It Fl n
194Numeric output only.
195No attempt will be made to lookup symbolic names from addresses in the reply.
196.It Fl N
197Probe node information multicast group
198.Pq Li ff02::2:xxxx:xxxx .
199.Ar host
200must be string hostname of the target
201(must not be a numeric IPv6 address).
202Node information multicast group will be computed based on given
203.Ar host ,
204and will be used as the final destination.
205Since node information multicast group is a link-local multicast group,
206destination link needs to be specified by
207.Fl I
208option.
209.It Fl p Ar pattern
210You may specify up to 16
211.Dq pad
212bytes to fill out the packet you send.
213This is useful for diagnosing data-dependent problems in a network.
214For example,
215.Dq Li \-p ff
216will cause the sent packet to be filled with all
217ones.
218.\" new ipsec
219.It Fl P Ar policy
220.Ar policy
221specifies IPsec policy to be used for the probe.
222.It Fl q
223Quiet output.
224Nothing is displayed except the summary lines at startup time and
225when finished.
226.It Fl R
227Make the kernel believe that the target
228.Ar host
229(or the first
230.Ar hop
231if you specify
232.Ar hops )
233is reachable, by injecting upper-layer reachability confirmation hint.
234The option is meaningful only if the target
235.Ar host
236(or the first hop)
237is a neighbor.
238.It Fl S Ar sourceaddr
239Specifies the source address of request packets.
240The source address must be one of the unicast addresses of the sending node.
241If the outgoing interface is specified by the
242.Fl I
243option as well,
244.Ar sourceaddr
245needs to be an address assigned to the specified interface.
246.It Fl s Ar packetsize
247Specifies the number of data bytes to be sent.
248The default is 56, which translates into 64
249.Tn ICMP
250data bytes when combined
251with the 8 bytes of
252.Tn ICMP
253header data.
254You may need to specify
255.Fl b
256as well to extend socket buffer size.
257.It Fl t
258Generate ICMPv6 Node Information supported query types query,
259rather than echo-request.
260.Fl s
261has no effect if
262.Fl t
263is specified.
264.It Fl v
265Verbose output.
266.Tn ICMP
267packets other than
268.Tn ECHO_RESPONSE
269that are received are listed.
270.It Fl w
271Generate ICMPv6 Node Information DNS Name query, rather than echo-request.
272.Fl s
273has no effect if
274.Fl w
275is specified.
276.It Fl W
277Same as
278.Fl w ,
279but with old packet format based on 03 draft.
280This option is present for backward compatibility.
281.Fl s
282has no effect if
283.Fl w
284is specified.
285.It Ar hops
286IPv6 addresses for intermediate nodes,
287which will be put into type 0 routing header.
288.It Ar host
289IPv6 address of the final destination node.
290.El
291.Pp
292When using
293.Nm
294for fault isolation, it should first be run on the local host, to verify
295that the local network interface is up and running.
296Then, hosts and gateways further and further away should be
297.Dq pinged .
298Round-trip times and packet loss statistics are computed.
299If duplicate packets are received, they are not included in the packet
300loss calculation, although the round trip time of these packets is used
301in calculating the round-trip time statistics.
302When the specified number of packets have been sent
303(and received)
304or if the program is terminated with a
305.Dv SIGINT ,
306a brief summary is displayed, showing the number of packets sent and
307received, and the minimum, mean, maximum, and standard deviation of
308the round-trip times.
309.Pp
310If
311.Nm
312receives a
313.Dv SIGINFO
314(see the
315.Cm status
316argument for
317.Xr stty 1 )
318signal, the current number of packets sent and received, and the
319minimum, mean, maximum, and standard deviation of the round-trip times
320will be written to the standard output in the same format as the
321standard completion message.
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.\" (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.\" (the
345.\" .Tn ICMP
346.\" header).
347.\" .Pp
348.\" If the data space is at least eight bytes large,
349.\" .Nm
350.\" uses the first eight bytes of this space to include a timestamp which
351.\" it uses in the computation of round trip times.
352.\" If less than eight bytes of pad are specified, no round trip times are
353.\" given.
354.Sh DUPLICATE AND DAMAGED PACKETS
355The
356.Nm
357utility will report duplicate and damaged packets.
358Duplicate packets should never occur when pinging a unicast address,
359and seem to be caused by
360inappropriate link-level retransmissions.
361Duplicates may occur in many situations and are rarely
362(if ever)
363a good sign, although the presence of low levels of duplicates may not
364always be cause for alarm.
365Duplicates are expected when pinging a broadcast or multicast address,
366since they are not really duplicates but replies from different hosts
367to the same request.
368.Pp
369Damaged packets are obviously serious cause for alarm and often
370indicate broken hardware somewhere in the
371.Nm
372packet's path
373(in the network or in the hosts).
374.Sh TRYING DIFFERENT DATA PATTERNS
375The
376(inter)network
377layer should never treat packets differently depending on the data
378contained in the data portion.
379Unfortunately, data-dependent problems have been known to sneak into
380networks and remain undetected for long periods of time.
381In many cases the particular pattern that will have problems is something
382that does not have sufficient
383.Dq transitions ,
384such as all ones or all zeros, or a pattern right at the edge, such as
385almost all zeros.
386It is not
387necessarily enough to specify a data pattern of all zeros (for example)
388on the command line because the pattern that is of interest is
389at the data link level, and the relationship between what you type and
390what the controllers transmit can be complicated.
391.Pp
392This means that if you have a data-dependent problem you will probably
393have to do a lot of testing to find it.
394If you are lucky, you may manage to find a file that either
395cannot
396be sent across your network or that takes much longer to transfer than
397other similar length files.
398You can then examine this file for repeated patterns that you can test
399using the
400.Fl p
401option of
402.Nm .
403.Sh EXAMPLES
404Normally,
405.Nm
406works just like
407.Xr ping 8
408would work; the following will send ICMPv6 echo request to
409.Li dst.foo.com .
410.Bd -literal -offset indent
411ping6 -n dst.foo.com
412.Ed
413.Pp
414The following will probe hostnames for all nodes on the network link attached to
415.Li wi0
416interface.
417The address
418.Li ff02::1
419is named the link-local all-node multicast address, and the packet would
420reach every node on the network link.
421.Bd -literal -offset indent
422ping6 -w ff02::1%wi0
423.Ed
424.Pp
425The following will probe addresses assigned to the destination node,
426.Li dst.foo.com .
427.Bd -literal -offset indent
428ping6 -a agl dst.foo.com
429.Ed
430.Sh DIAGNOSTICS
431The
432.Nm
433utility returns 0 on success (the host is alive),
434and non-zero if the arguments are incorrect or the host is not responding.
435.Sh SEE ALSO
436.Xr netstat 1 ,
437.Xr icmp6 4 ,
438.Xr inet6 4 ,
439.Xr ip6 4 ,
440.Xr ifconfig 8 ,
441.Xr ping 8 ,
442.Xr routed 8 ,
443.Xr traceroute 8 ,
444.Xr traceroute6 8
445.Rs
446.%A A. Conta
447.%A S. Deering
448.%T "Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification"
449.%N RFC 2463
450.%D December 1998
451.Re
452.Rs
453.%A Matt Crawford
454.%T "IPv6 Node Information Queries"
455.%N draft-ietf-ipngwg-icmp-name-lookups-07.txt
456.%D August 2000
457.%O work in progress material
458.Re
459.Sh HISTORY
460The
461.Xr ping 8
462command appeared in
463.Bx 4.3 .
464The
465.Nm
466utility with IPv6 support first appeared in WIDE Hydrangea IPv6 protocol stack
467kit.
468.Pp
469IPv6 and IPsec support based on the KAME Project
470.Pa ( http://www.kame.net/ )
471stack was initially integrated into
472.Fx 4.0
473.Sh BUGS
474There have been many discussions on why we separate
475.Nm
476and
477.Xr ping 8 .
478Some people argued that it would be more convenient to uniform the
479ping command for both IPv4 and IPv6.
480The followings are an answer to the request.
481.Pp
482From a developer's point of view:
483since the underling raw sockets API is totally different between IPv4
484and IPv6, we would end up having two types of code base.
485There would actually be less benefit to uniform the two commands
486into a single command from the developer's standpoint.
487.Pp
488From an operator's point of view: unlike ordinary network applications
489like remote login tools, we are usually aware of address family when using
490network management tools.
491We do not just want to know the reachability to the host, but want to know the
492reachability to the host via a particular network protocol such as
493IPv6.
494Thus, even if we had a unified
495.Xr ping 8
496command for both IPv4 and IPv6, we would usually type a
497.Fl 6
498or
499.Fl 4
500option (or something like those) to specify the particular address family.
501This essentially means that we have two different commands.
502