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