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