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