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