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