1*fcb4d9adSdholland.\" $NetBSD: ping6.8,v 1.34 2021/06/07 22:13:34 dholland Exp $ 27f0c96b8Sitojun.\" $KAME: ping6.8,v 1.57 2002/05/26 13:18:25 itojun Exp $ 356b2a497Sitojun.\" 407098cd3Sitojun.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 568ad03feSitojun.\" All rights reserved. 668ad03feSitojun.\" 768ad03feSitojun.\" Redistribution and use in source and binary forms, with or without 868ad03feSitojun.\" modification, are permitted provided that the following conditions 968ad03feSitojun.\" are met: 1068ad03feSitojun.\" 1. Redistributions of source code must retain the above copyright 1168ad03feSitojun.\" notice, this list of conditions and the following disclaimer. 1268ad03feSitojun.\" 2. Redistributions in binary form must reproduce the above copyright 1368ad03feSitojun.\" notice, this list of conditions and the following disclaimer in the 1468ad03feSitojun.\" documentation and/or other materials provided with the distribution. 1568ad03feSitojun.\" 3. Neither the name of the project nor the names of its contributors 1668ad03feSitojun.\" may be used to endorse or promote products derived from this software 1768ad03feSitojun.\" without specific prior written permission. 1868ad03feSitojun.\" 1968ad03feSitojun.\" THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 2068ad03feSitojun.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2168ad03feSitojun.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2268ad03feSitojun.\" ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 2368ad03feSitojun.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2468ad03feSitojun.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2568ad03feSitojun.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2668ad03feSitojun.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2768ad03feSitojun.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2868ad03feSitojun.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2968ad03feSitojun.\" SUCH DAMAGE. 3068ad03feSitojun.\" 31*fcb4d9adSdholland.Dd June 7, 2021 3268ad03feSitojun.Dt PING6 8 3368ad03feSitojun.Os 3468ad03feSitojun.Sh NAME 3568ad03feSitojun.Nm ping6 36da9f1891Swiz.Nd send ICMPv6 ECHO_REQUEST packets to network hosts 3768ad03feSitojun.Sh SYNOPSIS 3807098cd3Sitojun.Nm ping6 397d23ed38Swiz.\" without IPsec, or new IPsec 40f4598fe5Smaxv.Op Fl dfHmnNoqtvwW 417d23ed38Swiz.\" old IPsec 421d7e1a7cSitojun.\" .Op Fl AdEfnNqRtvwW 4368ad03feSitojun.Op Fl a Ar addrtype 4468ad03feSitojun.Op Fl b Ar bufsiz 4568ad03feSitojun.Op Fl c Ar count 46d2653319Sitojun.Op Fl g Ar gateway 4768ad03feSitojun.Op Fl h Ar hoplimit 4868ad03feSitojun.Op Fl I Ar interface 4968ad03feSitojun.Op Fl i Ar wait 5068ad03feSitojun.Op Fl l Ar preload 517d23ed38Swiz.\" new IPsec 52c40b88c3Sitojun.Op Fl P Ar policy 53da9f1891Swiz.Op Fl p Ar pattern 545979fc87Sitojun.Op Fl S Ar sourceaddr 5568ad03feSitojun.Op Fl s Ar packetsize 560c4c07abSkefren.Op Fl X Ar deadline 57da9f1891Swiz.Op Fl x Ar maxwait 5868ad03feSitojun.Ar host 5968ad03feSitojun.Sh DESCRIPTION 60c40b88c3Sitojun.Nm 61da9f1891Swizuses the ICMPv6 protocol's mandatory 62da9f1891Swiz.Dv ICMP6_ECHO_REQUEST 63c40b88c3Sitojundatagram to elicit an 64da9f1891Swiz.Dv ICMP6_ECHO_REPLY 65c40b88c3Sitojunfrom a host or gateway. 66da9f1891Swiz.Dv ICMP6_ECHO_REQUEST 67c40b88c3Sitojundatagrams (``pings'') have an IPv6 header, 68da9f1891Swizand ICMPv6 header formatted as documented in RFC 2463. 69c40b88c3SitojunThe options are as follows: 7068ad03feSitojun.Bl -tag -width Ds 717d23ed38Swiz.\" old IPsec 72c40b88c3Sitojun.\" .It Fl A 7356b2a497Sitojun.\" Enables transport-mode IPsec authentication header 7456b2a497Sitojun.\" .Pq experimental . 7568ad03feSitojun.It Fl a Ar addrtype 7668ad03feSitojunGenerate ICMPv6 Node Information Node Addresses query, rather than echo-request. 7768ad03feSitojun.Ar addrtype 7856b2a497Sitojunmust be a string constructed of the following characters. 7968ad03feSitojun.Bl -tag -width Ds -compact 8068ad03feSitojun.It Ic a 8132a3de22Sitojunrequests unicast addresses from all of the responder's interfaces. 8232a3de22SitojunIf the character is omitted, 8368ad03feSitojunonly those addresses which belong to the interface which has the 849a400bfcSitojunresponder's address are requests. 859a400bfcSitojun.It Ic c 869a400bfcSitojunrequests responder's IPv4-compatible and IPv4-mapped addresses. 8768ad03feSitojun.It Ic g 889a400bfcSitojunrequests responder's global-scope addresses. 8968ad03feSitojun.It Ic s 909a400bfcSitojunrequests responder's site-local addresses. 9168ad03feSitojun.It Ic l 929a400bfcSitojunrequests responder's link-local addresses. 935979fc87Sitojun.It Ic A 9456b2a497Sitojunrequests responder's anycast addresses. 9556b2a497SitojunWithout this character, the responder will return unicast addresses only. 9656b2a497SitojunWith this character, the responder will return anycast addresses only. 975979fc87SitojunNote that the specification does not specify how to get responder's 9856b2a497Sitojunanycast addresses. 9956b2a497SitojunThis is an experimental option. 10068ad03feSitojun.El 10168ad03feSitojun.It Fl b Ar bufsiz 10268ad03feSitojunSet socket buffer size. 10368ad03feSitojun.It Fl c Ar count 10468ad03feSitojunStop after sending 10568ad03feSitojun.Pq and receiving 10668ad03feSitojun.Ar count 107da9f1891Swiz.Dv ECHO_RESPONSE 10868ad03feSitojunpackets. 10968ad03feSitojun.It Fl d 11068ad03feSitojunSet the 11168ad03feSitojun.Dv SO_DEBUG 11268ad03feSitojunoption on the socket being used. 113c40b88c3Sitojun.\" .It Fl E 11456b2a497Sitojun.\" Enables transport-mode IPsec encapsulated security payload 11556b2a497Sitojun.\" .Pq experimental . 11668ad03feSitojun.It Fl f 11768ad03feSitojunFlood ping. 11868ad03feSitojunOutputs packets as fast as they come back or one hundred times per second, 11968ad03feSitojunwhichever is more. 12068ad03feSitojunFor every 121da9f1891Swiz.Dv ECHO_REQUEST 12268ad03feSitojunsent a period 12368ad03feSitojun.Dq \&. 12468ad03feSitojunis printed, while for every 125da9f1891Swiz.Dv ECHO_REPLY 12668ad03feSitojunreceived a backspace is printed. 12768ad03feSitojunThis provides a rapid display of how many packets are being dropped. 12868ad03feSitojunOnly the super-user may use this option. 12968ad03feSitojun.Bf -emphasis 13068ad03feSitojunThis can be very hard on a network and should be used with caution. 13168ad03feSitojun.Ef 132d2653319Sitojun.It Fl g Ar gateway 133d2653319SitojunSpecifies to use 134d2653319Sitojun.Ar gateway 135d2653319Sitojunas the next hop to the destination. 136d2653319SitojunThe gateway must be a neighbor of the sending node. 13707098cd3Sitojun.It Fl H 13807098cd3SitojunSpecifies to try reverse-lookup of IPv6 addresses. 13907098cd3SitojunThe 14007098cd3Sitojun.Nm 14107098cd3Sitojuncommand does not try reverse-lookup unless the option is specified. 14268ad03feSitojun.It Fl h Ar hoplimit 14368ad03feSitojunSet the IPv6 hoplimit. 14468ad03feSitojun.It Fl I Ar interface 14568ad03feSitojunSource packets with the given interface address. 14668ad03feSitojunThis flag applies if the ping destination is a multicast address, 14768ad03feSitojunor link-local/site-local unicast address. 14868ad03feSitojun.It Fl i Ar wait 14968ad03feSitojunWait 15068ad03feSitojun.Ar wait 15168ad03feSitojunseconds 15268ad03feSitojun.Em between sending each packet . 15368ad03feSitojunThe default is to wait for one second between each packet. 15468ad03feSitojunThis option is incompatible with the 15568ad03feSitojun.Fl f 15668ad03feSitojunoption. 15768ad03feSitojun.It Fl l Ar preload 15868ad03feSitojunIf 15968ad03feSitojun.Ar preload 16068ad03feSitojunis specified, 161279552d3Slukem.Nm 16268ad03feSitojunsends that many packets as fast as possible before falling into its normal 16368ad03feSitojunmode of behavior. 16468ad03feSitojunOnly the super-user may use this option. 165de8db475Srpaulo.It Fl m 166de8db475SrpauloBy default, 167de8db475Srpaulo.Nm 168de8db475Srpauloasks the kernel to fragment packets to fit into the minimum IPv6 MTU. 169de8db475Srpaulo.Fl m 170de8db475Srpaulowill suppress the behavior in the following two levels: 171de8db475Srpaulowhen the option is specified once, the behavior will be disabled for 172de8db475Srpaulounicast packets. 173de8db475SrpauloWhen the option is specified more than once, it will be disabled for both 174de8db475Srpaulounicast and multicast packets. 17507098cd3Sitojun.It Fl N 17607098cd3SitojunProbe node information multicast group 17707098cd3Sitojun.Pq Li ff02::2:xxxx:xxxx . 17807098cd3Sitojun.Ar host 17907098cd3Sitojunmust be string hostname of the target 18007098cd3Sitojun.Pq must not be a numeric IPv6 address . 18107098cd3SitojunNode information multicast group will be computed based on given 18207098cd3Sitojun.Ar host , 18307098cd3Sitojunand will be used as the final destination. 18407098cd3SitojunSince node information multicast group is a link-local multicast group, 185d2653319Sitojunoutgoing interface needs to be specified by 18607098cd3Sitojun.Fl I 18707098cd3Sitojunoption. 188da9f1891Swiz.It Fl n 189da9f1891SwizNumeric output only. 190da9f1891SwizNo attempt will be made to lookup symbolic names from addresses in the reply. 1918e83ba13Schristos.It Fl o 1928e83ba13SchristosExit successfully after receiving one reply packet. 193da9f1891Swiz.It Fl P Ar policy 194da9f1891Swiz.Ar policy 195da9f1891Swizspecifies IPsec policy to be used for the probe. 19668ad03feSitojun.It Fl p Ar pattern 19768ad03feSitojunYou may specify up to 16 19868ad03feSitojun.Dq pad 19968ad03feSitojunbytes to fill out the packet you send. 20068ad03feSitojunThis is useful for diagnosing data-dependent problems in a network. 20168ad03feSitojunFor example, 20268ad03feSitojun.Dq Li \-p ff 20368ad03feSitojunwill cause the sent packet to be filled with all 20468ad03feSitojunones. 205*fcb4d9adSdhollandNote that for IPv6 there is no fill space by default so it is 206*fcb4d9adSdhollandnecessary to also use the 207*fcb4d9adSdholland.Fl s 208*fcb4d9adSdhollandoption to expand the packet. 2097d23ed38Swiz.\" new IPsec 21068ad03feSitojun.It Fl q 21168ad03feSitojunQuiet output. 21268ad03feSitojunNothing is displayed except the summary lines at startup time and 21368ad03feSitojunwhen finished. 2145979fc87Sitojun.It Fl S Ar sourceaddr 2155979fc87SitojunSpecifies the source address of request packets. 2167f0c96b8SitojunThe source address must be one of the unicast addresses of the sending node, 217d2653319Sitojunand must be numeric. 21868ad03feSitojun.It Fl s Ar packetsize 21968ad03feSitojunSpecifies the number of data bytes to be sent. 220da9f1891SwizThe default is 56, which translates into 64 ICMP data bytes when combined 221da9f1891Swizwith the 8 bytes of ICMP header data. 2225979fc87SitojunYou may need to specify 2235979fc87Sitojun.Fl b 2245979fc87Sitojunas well to extend socket buffer size. 2251b2be13dSitojun.It Fl t 2261b2be13dSitojunGenerate ICMPv6 Node Information supported query types query, 2271b2be13dSitojunrather than echo-request. 2281b2be13dSitojun.Fl s 2291b2be13dSitojunhas no effect if 2301b2be13dSitojun.Fl t 2311b2be13dSitojunis specified. 23268ad03feSitojun.It Fl v 23368ad03feSitojunVerbose output. 234da9f1891SwizICMP packets other than 235da9f1891Swiz.Dv ECHO_RESPONSE 23668ad03feSitojunthat are received are listed. 23768ad03feSitojun.It Fl W 23868ad03feSitojunSame as 23907098cd3Sitojun.Fl w , 24007098cd3Sitojunbut with old packet format based on 03 draft. 24107098cd3SitojunThis option is present for backward compatibility. 2425979fc87Sitojun.Fl s 2435979fc87Sitojunhas no effect if 2445979fc87Sitojun.Fl w 2455979fc87Sitojunis specified. 246da9f1891Swiz.It Fl w 247da9f1891SwizGenerate ICMPv6 Node Information DNS Name query, rather than echo-request. 248da9f1891Swiz.Fl s 249da9f1891Swizhas no effect if 250da9f1891Swiz.Fl w 251da9f1891Swizis specified. 2520c4c07abSkefren.It Fl X Ar deadline 2530c4c07abSkefrenSpecify a timeout, in seconds, before ping exits regardless of 2540c4c07abSkefrenhow many packets have been received. 25562e82d7eSitojun.It Ar host 2565dd379b9SwizIPv6 address of the final destination node. 257da9f1891Swiz.It Fl x Ar maxwait 258da9f1891SwizTime in milliseconds to wait for a reply for each packet sent. 25968ad03feSitojun.El 26068ad03feSitojun.Pp 26168ad03feSitojunWhen using 26268ad03feSitojun.Nm 26368ad03feSitojunfor fault isolation, it should first be run on the local host, to verify 26468ad03feSitojunthat the local network interface is up and running. 26568ad03feSitojunThen, hosts and gateways further and further away should be 26668ad03feSitojun.Dq pinged . 26768ad03feSitojunRound-trip times and packet loss statistics are computed. 26868ad03feSitojunIf duplicate packets are received, they are not included in the packet 26968ad03feSitojunloss calculation, although the round trip time of these packets is used 27068ad03feSitojunin calculating the round-trip time statistics. 27168ad03feSitojunWhen the specified number of packets have been sent 27268ad03feSitojun.Pq and received 27368ad03feSitojunor if the program is terminated with a 27468ad03feSitojun.Dv SIGINT , 27568ad03feSitojuna brief summary is displayed, showing the number of packets sent and 27668ad03feSitojunreceived, and the minimum, maximum, mean, and standard deviation of 27768ad03feSitojunthe round-trip times. 27868ad03feSitojun.Pp 27968ad03feSitojunThis program is intended for use in network testing, measurement and 28068ad03feSitojunmanagement. 28168ad03feSitojunBecause of the load it can impose on the network, it is unwise to use 28268ad03feSitojun.Nm 28368ad03feSitojunduring normal operations or from automated scripts. 28468ad03feSitojun.\" .Sh ICMP PACKET DETAILS 28568ad03feSitojun.\" An IP header without options is 20 bytes. 28668ad03feSitojun.\" An 287da9f1891Swiz.\" ICMP 288da9f1891Swiz.\" .Dv ECHO_REQUEST 28968ad03feSitojun.\" packet contains an additional 8 bytes worth of 290da9f1891Swiz.\" ICMP 29168ad03feSitojun.\" header followed by an arbitrary amount of data. 29268ad03feSitojun.\" When a 29368ad03feSitojun.\" .Ar packetsize 29468ad03feSitojun.\" is given, this indicated the size of this extra piece of data 29568ad03feSitojun.\" .Pq the default is 56 . 29668ad03feSitojun.\" Thus the amount of data received inside of an IP packet of type 297da9f1891Swiz.\" ICMP 298da9f1891Swiz.\" .Dv ECHO_REPLY 29968ad03feSitojun.\" will always be 8 bytes more than the requested data space 300da9f1891Swiz.\" .Pq the ICMP header . 30168ad03feSitojun.\" .Pp 30268ad03feSitojun.\" If the data space is at least eight bytes large, 30368ad03feSitojun.\" .Nm 30468ad03feSitojun.\" uses the first eight bytes of this space to include a timestamp which 30568ad03feSitojun.\" it uses in the computation of round trip times. 30668ad03feSitojun.\" If less than eight bytes of pad are specified, no round trip times are 30768ad03feSitojun.\" given. 30868ad03feSitojun.Sh DUPLICATE AND DAMAGED PACKETS 309279552d3Slukem.Nm 31068ad03feSitojunwill report duplicate and damaged packets. 31168ad03feSitojunDuplicate packets should never occur when pinging a unicast address, 31268ad03feSitojunand seem to be caused by 31368ad03feSitojuninappropriate link-level retransmissions. 31468ad03feSitojunDuplicates may occur in many situations and are rarely 31568ad03feSitojun.Pq if ever 31668ad03feSitojuna good sign, although the presence of low levels of duplicates may not 31768ad03feSitojunalways be cause for alarm. 31883dc99daSrpauloDuplicates are expected when pinging a multicast address, 31968ad03feSitojunsince they are not really duplicates but replies from different hosts 32068ad03feSitojunto the same request. 32168ad03feSitojun.Pp 32268ad03feSitojunDamaged packets are obviously serious cause for alarm and often 32368ad03feSitojunindicate broken hardware somewhere in the 324279552d3Slukem.Nm 32568ad03feSitojunpacket's path 32668ad03feSitojun.Pq in the network or in the hosts . 32768ad03feSitojun.Sh TRYING DIFFERENT DATA PATTERNS 32868ad03feSitojunThe 32968ad03feSitojun(inter)network 33068ad03feSitojunlayer should never treat packets differently depending on the data 33168ad03feSitojuncontained in the data portion. 33268ad03feSitojunUnfortunately, data-dependent problems have been known to sneak into 33368ad03feSitojunnetworks and remain undetected for long periods of time. 33468ad03feSitojunIn many cases the particular pattern that will have problems is something 33568ad03feSitojunthat does not have sufficient 33668ad03feSitojun.Dq transitions , 33768ad03feSitojunsuch as all ones or all zeros, or a pattern right at the edge, such as 33868ad03feSitojunalmost all zeros. 33968ad03feSitojunIt is not 34068ad03feSitojunnecessarily enough to specify a data pattern of all zeros (for example) 34168ad03feSitojunon the command line because the pattern that is of interest is 34268ad03feSitojunat the data link level, and the relationship between what you type and 34368ad03feSitojunwhat the controllers transmit can be complicated. 34468ad03feSitojun.Pp 34568ad03feSitojunThis means that if you have a data-dependent problem you will probably 34668ad03feSitojunhave to do a lot of testing to find it. 34768ad03feSitojunIf you are lucky, you may manage to find a file that either 34868ad03feSitojuncannot 34968ad03feSitojunbe sent across your network or that takes much longer to transfer than 35068ad03feSitojunother similar length files. 35168ad03feSitojunYou can then examine this file for repeated patterns that you can test 35268ad03feSitojunusing the 35368ad03feSitojun.Fl p 35468ad03feSitojunoption of 355da9f1891Swiz.Nm . 3562caf6aacSkleink.Sh EXIT STATUS 35768ad03feSitojun.Nm 3580a6cee32Sitojunexits with 0 on success (the host is alive), 35956b2a497Sitojunand non-zero if the arguments are incorrect or the host is not responding. 360dc50d851Sitojun.Sh EXAMPLES 361dc50d851SitojunNormally, 3629e3976cdSitojun.Nm 363dc50d851Sitojunworks just like 364dc50d851Sitojun.Xr ping 8 365dc50d851Sitojunwould work; the following will send ICMPv6 echo request to 366dc50d851Sitojun.Li dst.foo.com . 367dc50d851Sitojun.Bd -literal -offset indent 368dc50d851Sitojunping6 -n dst.foo.com 369dc50d851Sitojun.Ed 370dc50d851Sitojun.Pp 371dc50d851SitojunThe following will probe hostnames for all nodes on the network link attached to 372dc50d851Sitojun.Li wi0 373dc50d851Sitojuninterface. 374dc50d851SitojunThe address 375dc50d851Sitojun.Li ff02::1 376dc50d851Sitojunis named the link-local all-node multicast address, and the packet would 377dc50d851Sitojunreach every node on the network link. 378dc50d851Sitojun.Bd -literal -offset indent 379dc50d851Sitojunping6 -w ff02::1%wi0 380dc50d851Sitojun.Ed 381dc50d851Sitojun.Pp 382dc50d851SitojunThe following will probe addresses assigned to the destination node, 383dc50d851Sitojun.Li dst.foo.com . 384dc50d851Sitojun.Bd -literal -offset indent 385dc50d851Sitojunping6 -a agl dst.foo.com 386dc50d851Sitojun.Ed 38768ad03feSitojun.Sh SEE ALSO 38868ad03feSitojun.Xr netstat 1 , 3895e3565beSjhawk.Xr icmp6 4 , 3905e3565beSjhawk.Xr inet6 4 , 3915e3565beSjhawk.Xr ip6 4 , 39268ad03feSitojun.Xr ifconfig 8 , 39368ad03feSitojun.Xr ping 8 , 39456b2a497Sitojun.Xr routed 8 , 39568ad03feSitojun.Xr traceroute 8 , 39668ad03feSitojun.Xr traceroute6 8 397c40b88c3Sitojun.Rs 398c40b88c3Sitojun.%A A. Conta 399c40b88c3Sitojun.%A S. Deering 400c40b88c3Sitojun.%T "Internet Control Message Protocol (ICMPv6) for the Internet Protocol Version 6 (IPv6) Specification" 401c40b88c3Sitojun.%N RFC 2463 402c40b88c3Sitojun.%D December 1998 403c40b88c3Sitojun.Re 40456b2a497Sitojun.Rs 40556b2a497Sitojun.%A Matt Crawford 40656b2a497Sitojun.%T "IPv6 Node Information Queries" 407d2653319Sitojun.%N draft-ietf-ipngwg-icmp-name-lookups-09.txt 408d2653319Sitojun.%D May 2002 40956b2a497Sitojun.%O work in progress material 41056b2a497Sitojun.Re 41168ad03feSitojun.Sh HISTORY 41268ad03feSitojunThe 413a21e5360Sitojun.Xr ping 8 41468ad03feSitojuncommand appeared in 41568ad03feSitojun.Bx 4.3 . 41656b2a497SitojunThe 41756b2a497Sitojun.Nm 41807da92e6Swizcommand with IPv6 support first appeared in the WIDE Hydrangea IPv6 41907da92e6Swizprotocol stack kit. 42007da92e6Swiz.Sh BUGS 42107da92e6Swiz.\" except for bsdi 42207da92e6Swiz.Nm 42307da92e6Swizis intentionally separate from 42407da92e6Swiz.Xr ping 8 . 425