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