1*7f5f010bSBen Gras.\" $NetBSD: ping.8,v 1.50 2011/09/10 20:47:33 wiz Exp $ 2*7f5f010bSBen Gras.\" 3*7f5f010bSBen Gras.\" Copyright (c) 1985, 1991, 1993 4*7f5f010bSBen Gras.\" The Regents of the University of California. All rights reserved. 5*7f5f010bSBen Gras.\" 6*7f5f010bSBen Gras.\" Redistribution and use in source and binary forms, with or without 7*7f5f010bSBen Gras.\" modification, are permitted provided that the following conditions 8*7f5f010bSBen Gras.\" are met: 9*7f5f010bSBen Gras.\" 1. Redistributions of source code must retain the above copyright 10*7f5f010bSBen Gras.\" notice, this list of conditions and the following disclaimer. 11*7f5f010bSBen Gras.\" 2. Redistributions in binary form must reproduce the above copyright 12*7f5f010bSBen Gras.\" notice, this list of conditions and the following disclaimer in the 13*7f5f010bSBen Gras.\" documentation and/or other materials provided with the distribution. 14*7f5f010bSBen Gras.\" 3. Neither the name of the University nor the names of its contributors 15*7f5f010bSBen Gras.\" may be used to endorse or promote products derived from this software 16*7f5f010bSBen Gras.\" without specific prior written permission. 17*7f5f010bSBen Gras.\" 18*7f5f010bSBen Gras.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19*7f5f010bSBen Gras.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*7f5f010bSBen Gras.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*7f5f010bSBen Gras.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22*7f5f010bSBen Gras.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23*7f5f010bSBen Gras.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24*7f5f010bSBen Gras.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25*7f5f010bSBen Gras.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26*7f5f010bSBen Gras.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27*7f5f010bSBen Gras.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28*7f5f010bSBen Gras.\" SUCH DAMAGE. 29*7f5f010bSBen Gras.\" 30*7f5f010bSBen Gras.\" @(#)ping.8 8.2 (Berkeley) 12/11/93 31*7f5f010bSBen Gras.\" 32*7f5f010bSBen Gras.Dd September 10, 2011 33*7f5f010bSBen Gras.Dt PING 8 34*7f5f010bSBen Gras.Os 35*7f5f010bSBen Gras.Sh NAME 36*7f5f010bSBen Gras.Nm ping 37*7f5f010bSBen Gras.Nd send 38*7f5f010bSBen Gras.Tn ICMP ECHO_REQUEST 39*7f5f010bSBen Graspackets to network hosts 40*7f5f010bSBen Gras.Sh SYNOPSIS 41*7f5f010bSBen Gras.Nm 42*7f5f010bSBen Gras.Op Fl aCDdfLnoPQqRrv 43*7f5f010bSBen Gras.Op Fl c Ar count 44*7f5f010bSBen Gras.Op Fl E Ar policy 45*7f5f010bSBen Gras.Op Fl g Ar gateway 46*7f5f010bSBen Gras.Op Fl h Ar host 47*7f5f010bSBen Gras.Op Fl I Ar srcaddr 48*7f5f010bSBen Gras.Op Fl i Ar interval 49*7f5f010bSBen Gras.Op Fl l Ar preload 50*7f5f010bSBen Gras.Op Fl p Ar pattern 51*7f5f010bSBen Gras.Op Fl s Ar packetsize 52*7f5f010bSBen Gras.Op Fl T Ar ttl 53*7f5f010bSBen Gras.Op Fl t Ar tos 54*7f5f010bSBen Gras.Op Fl w Ar deadline 55*7f5f010bSBen Gras.Ar host 56*7f5f010bSBen Gras.Sh DESCRIPTION 57*7f5f010bSBen Gras.Nm 58*7f5f010bSBen Grasuses the 59*7f5f010bSBen Gras.Tn ICMP 60*7f5f010bSBen Grasprotocol's mandatory 61*7f5f010bSBen Gras.Tn ECHO_REQUEST 62*7f5f010bSBen Grasdatagram to elicit an 63*7f5f010bSBen Gras.Tn ICMP ECHO_RESPONSE 64*7f5f010bSBen Grasfrom a host or gateway. 65*7f5f010bSBen Gras.Tn ECHO_REQUEST 66*7f5f010bSBen Grasdatagrams (``pings'') have an IP and 67*7f5f010bSBen Gras.Tn ICMP 68*7f5f010bSBen Grasheader, 69*7f5f010bSBen Grasfollowed by a 70*7f5f010bSBen Gras.Dq struct timespec 71*7f5f010bSBen Grasand then an arbitrary number of ``pad'' bytes used to fill out the 72*7f5f010bSBen Graspacket. 73*7f5f010bSBen GrasThe options are as follows: 74*7f5f010bSBen Gras.Bl -tag -width Ds 75*7f5f010bSBen Gras.It Fl a 76*7f5f010bSBen GrasEmit an audible beep (by sending an ascii BEL character to the 77*7f5f010bSBen Grasstandard error output) after each non-duplicate response is received. 78*7f5f010bSBen GrasThis is disabled for flood pings as it would probably cause temporary 79*7f5f010bSBen Grasinsanity. 80*7f5f010bSBen Gras.It Fl C 81*7f5f010bSBen GrasSend timestamps in compat format; two 32 bit words in little endian format, 82*7f5f010bSBen Grasthe first one representing seconds, and the second one representing 83*7f5f010bSBen Grasmicroseconds. 84*7f5f010bSBen Gras.It Fl c Ar count 85*7f5f010bSBen GrasStop after sending (and waiting the specified delay to receive) 86*7f5f010bSBen Gras.Ar count 87*7f5f010bSBen Gras.Tn ECHO_RESPONSE 88*7f5f010bSBen Graspackets. 89*7f5f010bSBen Gras.It Fl D 90*7f5f010bSBen GrasSet the 91*7f5f010bSBen Gras.Dv Don't Fragment 92*7f5f010bSBen Grasbit in the IP header. 93*7f5f010bSBen GrasThis can be used to determine the path MTU. 94*7f5f010bSBen Gras.It Fl d 95*7f5f010bSBen GrasSet the 96*7f5f010bSBen Gras.Dv SO_DEBUG 97*7f5f010bSBen Grasoption on the socket being used. 98*7f5f010bSBen Gras.It Fl E Ar policy 99*7f5f010bSBen GrasUse IPsec policy specification string 100*7f5f010bSBen Gras.Ar policy 101*7f5f010bSBen Grasfor packets. 102*7f5f010bSBen GrasFor the format of specification string, please refer 103*7f5f010bSBen Gras.Xr ipsec_set_policy 3 . 104*7f5f010bSBen GrasPlease note that this option is same as 105*7f5f010bSBen Gras.Fl P 106*7f5f010bSBen Grasin KAME/FreeBSD and KAME/BSDI 107*7f5f010bSBen Gras(as 108*7f5f010bSBen Gras.Fl P 109*7f5f010bSBen Graswas already occupied in 110*7f5f010bSBen Gras.Nx ) . 111*7f5f010bSBen Gras.It Fl f 112*7f5f010bSBen GrasFlood ping. 113*7f5f010bSBen GrasOutputs packets as fast as they come back or one hundred times per second, 114*7f5f010bSBen Graswhichever is more. 115*7f5f010bSBen GrasFor every 116*7f5f010bSBen Gras.Tn ECHO_REQUEST 117*7f5f010bSBen Grassent a period ``.'' is printed, while for every 118*7f5f010bSBen Gras.Tn ECHO_REPLY 119*7f5f010bSBen Grasreceived a backspace is printed. 120*7f5f010bSBen GrasThis provides a rapid display of how many packets are being dropped. 121*7f5f010bSBen GrasOnly the super-user may use this option. 122*7f5f010bSBen Gras.Bf -emphasis 123*7f5f010bSBen GrasThis can be very hard on a network and should be used with caution. 124*7f5f010bSBen Gras.Ef 125*7f5f010bSBen Gras.It Fl g Ar gateway 126*7f5f010bSBen GrasUse Loose Source Routing to send the ECHO_REQUEST packets via 127*7f5f010bSBen Gras.Ar gateway . 128*7f5f010bSBen Gras.It Fl h Ar host 129*7f5f010bSBen Grasis an alternate way of specifying the target host instead of as the 130*7f5f010bSBen Graslast argument. 131*7f5f010bSBen Gras.It Fl I Ar srcaddr 132*7f5f010bSBen GrasSet the source IP address to 133*7f5f010bSBen Gras.Ar srcaddr 134*7f5f010bSBen Graswhich can be a hostname or an IP number. 135*7f5f010bSBen GrasFor multicast datagrams, it also specifies the outgoing interface. 136*7f5f010bSBen Gras.It Fl i Ar interval 137*7f5f010bSBen GrasWait 138*7f5f010bSBen Gras.Ar interval 139*7f5f010bSBen Grasseconds 140*7f5f010bSBen Gras.Em between sending each packet . 141*7f5f010bSBen GrasThe default is to wait for one second between each packet, 142*7f5f010bSBen Grasexcept when the -f option is used the wait interval is 0.01 seconds. 143*7f5f010bSBen Gras.It Fl L 144*7f5f010bSBen GrasDisable loopback when sending to multicast destinations, 145*7f5f010bSBen Grasso the transmitting host doesn't see the ICMP requests. 146*7f5f010bSBen Gras.It Fl l Ar preload 147*7f5f010bSBen GrasIf 148*7f5f010bSBen Gras.Ar preload 149*7f5f010bSBen Grasis specified, 150*7f5f010bSBen Gras.Nm 151*7f5f010bSBen Grassends that many packets as fast as possible before falling into its normal 152*7f5f010bSBen Grasmode of behavior. 153*7f5f010bSBen GrasOnly the super-user may use this option. 154*7f5f010bSBen Gras.It Fl n 155*7f5f010bSBen GrasNumeric output only. 156*7f5f010bSBen GrasNo attempt will be made to look up symbolic names for host addresses. 157*7f5f010bSBen Gras.It Fl o 158*7f5f010bSBen GrasExit successfully after receiving one reply packet. 159*7f5f010bSBen Gras.It Fl P 160*7f5f010bSBen GrasUse a pseudo-random sequence for the data instead of the default, 161*7f5f010bSBen Grasfixed sequence of incrementing 8-bit integers. 162*7f5f010bSBen GrasThis is useful to foil compression on PPP and other links. 163*7f5f010bSBen Gras.It Fl p Ar pattern 164*7f5f010bSBen GrasYou may specify up to 16 ``pad'' bytes to fill out the packet you send. 165*7f5f010bSBen GrasThis is useful for diagnosing data-dependent problems in a network. 166*7f5f010bSBen GrasFor example, 167*7f5f010bSBen Gras.Dq Li \-p ff 168*7f5f010bSBen Graswill cause the sent packet to be filled with all 169*7f5f010bSBen Grasones. 170*7f5f010bSBen Gras.It Fl Q 171*7f5f010bSBen GrasDo not display responses such as Network Unreachable ICMP messages 172*7f5f010bSBen Grasconcerning the ECHO_REQUESTs sent. 173*7f5f010bSBen Gras.It Fl q 174*7f5f010bSBen GrasQuiet output. 175*7f5f010bSBen GrasNothing is displayed except the summary lines at startup time and 176*7f5f010bSBen Graswhen finished. 177*7f5f010bSBen Gras.It Fl R 178*7f5f010bSBen GrasRecord Route. 179*7f5f010bSBen GrasIncludes the 180*7f5f010bSBen Gras.Tn RECORD_ROUTE 181*7f5f010bSBen Grasoption in the 182*7f5f010bSBen Gras.Tn ECHO_REQUEST 183*7f5f010bSBen Graspacket and displays the route buffer on returned packets. 184*7f5f010bSBen GrasThis should show the path to the target host and back, which is 185*7f5f010bSBen Grasespecially useful in the case of asymmetric routing. 186*7f5f010bSBen GrasNote that the IP header is only large enough for nine such addresses, 187*7f5f010bSBen Grasand only seven when using the 188*7f5f010bSBen Gras.Fl g 189*7f5f010bSBen Grasoption. 190*7f5f010bSBen GrasThis is why it was necessary to invent 191*7f5f010bSBen Gras.Xr traceroute 8 . 192*7f5f010bSBen GrasMany hosts ignore or discard this option. 193*7f5f010bSBen Gras.It Fl r 194*7f5f010bSBen GrasBypass the normal routing tables and send directly to a host on an attached 195*7f5f010bSBen Grasnetwork. 196*7f5f010bSBen GrasIf the host is not on a directly-attached network, an error is returned. 197*7f5f010bSBen GrasThis option can be used to ping a local host through an interface 198*7f5f010bSBen Grasthat has no route through it (e.g., after the interface was dropped by 199*7f5f010bSBen Gras.Xr routed 8 ) . 200*7f5f010bSBen Gras.It Fl s Ar packetsize 201*7f5f010bSBen GrasSpecifies the number of data bytes to be sent. 202*7f5f010bSBen GrasThe default is 56, which translates into 64 203*7f5f010bSBen Gras.Tn ICMP 204*7f5f010bSBen Grasdata bytes when combined 205*7f5f010bSBen Graswith the 8 bytes of 206*7f5f010bSBen Gras.Tn ICMP 207*7f5f010bSBen Grasheader data. 208*7f5f010bSBen GrasThe maximum allowed value is 65467 bytes. 209*7f5f010bSBen Gras.It Fl T Ar ttl 210*7f5f010bSBen GrasUse the specified time-to-live. 211*7f5f010bSBen Gras.It Fl t Ar tos 212*7f5f010bSBen GrasUse the specified hexadecimal type of service. 213*7f5f010bSBen Gras.It Fl v 214*7f5f010bSBen GrasVerbose output. 215*7f5f010bSBen Gras.Tn ICMP 216*7f5f010bSBen Graspackets other than 217*7f5f010bSBen Gras.Tn ECHO_RESPONSE 218*7f5f010bSBen Grasthat are received are listed. 219*7f5f010bSBen Gras.It Fl w Ar deadline 220*7f5f010bSBen GrasSpecifies a timeout, in seconds, before ping exits regardless of 221*7f5f010bSBen Grashow many packets have been sent or received. 222*7f5f010bSBen Gras.El 223*7f5f010bSBen Gras.Pp 224*7f5f010bSBen GrasWhen using 225*7f5f010bSBen Gras.Nm 226*7f5f010bSBen Grasfor fault isolation, it should first be run on the local host, to verify 227*7f5f010bSBen Grasthat the local network interface is up and running. 228*7f5f010bSBen GrasThen, hosts and gateways further and further away should be ``pinged''. 229*7f5f010bSBen Gras.Pp 230*7f5f010bSBen GrasRound-trip times and packet loss statistics are computed. 231*7f5f010bSBen GrasIf duplicate packets are received, they are not included in the packet 232*7f5f010bSBen Grasloss calculation, although the round trip time of these packets is used 233*7f5f010bSBen Grasin calculating the minimum/average/maximum round-trip time numbers. 234*7f5f010bSBen Gras.Pp 235*7f5f010bSBen GrasWhen the specified number of packets have been sent (and received) or 236*7f5f010bSBen Grasif the program is terminated with a 237*7f5f010bSBen Gras.Dv SIGINT , 238*7f5f010bSBen Grasa brief summary is displayed. 239*7f5f010bSBen GrasThe summary information can be displayed while 240*7f5f010bSBen Gras.Nm 241*7f5f010bSBen Grasis running by sending it a 242*7f5f010bSBen Gras.Dv SIGINFO 243*7f5f010bSBen Grassignal (see the 244*7f5f010bSBen Gras.Dq status 245*7f5f010bSBen Grasargument for 246*7f5f010bSBen Gras.Xr stty 1 247*7f5f010bSBen Grasfor more information). 248*7f5f010bSBen Gras.Pp 249*7f5f010bSBen Gras.Nm 250*7f5f010bSBen Grascontinually sends one datagram per second, and prints one line of 251*7f5f010bSBen Grasoutput for every ECHO_RESPONSE returned. 252*7f5f010bSBen GrasOn a trusted system with IP 253*7f5f010bSBen GrasSecurity Options enabled, if the network idiom is not MONO, 254*7f5f010bSBen Gras.Nm 255*7f5f010bSBen Grasalso prints a second line containing the hexadecimal representation 256*7f5f010bSBen Grasof the IP security option in the ECHO_RESPONSE. 257*7f5f010bSBen GrasIf the 258*7f5f010bSBen Gras.Fl c 259*7f5f010bSBen Grascount option is given, only that number of requests is sent. 260*7f5f010bSBen GrasNo output is produced if there is no response. 261*7f5f010bSBen GrasRound-trip times and packet loss statistics are computed. 262*7f5f010bSBen GrasIf duplicate packets are received, 263*7f5f010bSBen Grasthey are not included in the packet loss calculation, 264*7f5f010bSBen Grasalthough the round trip time of these packets is used in calculating 265*7f5f010bSBen Grasthe minimum/average/maximum round-trip time numbers. 266*7f5f010bSBen GrasWhen the specified number of packets have been sent (and received) or if 267*7f5f010bSBen Grasthe program is terminated with an interrupt (SIGINT), a brief 268*7f5f010bSBen Grassummary is displayed. 269*7f5f010bSBen GrasWhen not using the 270*7f5f010bSBen Gras.Fl f 271*7f5f010bSBen Gras(flood) option, the first interrupt, usually generated by control-C or DEL, 272*7f5f010bSBen Grascauses 273*7f5f010bSBen Gras.Nm 274*7f5f010bSBen Grasto wait for its outstanding requests to return. 275*7f5f010bSBen GrasIt will wait no longer than the longest round trip time 276*7f5f010bSBen Grasencountered by previous, successful pings. 277*7f5f010bSBen GrasThe second interrupt stops ping immediately. 278*7f5f010bSBen Gras.Pp 279*7f5f010bSBen GrasThis program is intended for use in network testing, measurement and 280*7f5f010bSBen Grasmanagement. 281*7f5f010bSBen GrasBecause of the load it can impose on the network, it is unwise to use 282*7f5f010bSBen Gras.Nm 283*7f5f010bSBen Grasduring normal operations or from automated scripts. 284*7f5f010bSBen Gras.Sh ICMP PACKET DETAILS 285*7f5f010bSBen GrasAn IP header without options is 20 bytes. 286*7f5f010bSBen GrasAn 287*7f5f010bSBen Gras.Tn ICMP 288*7f5f010bSBen Gras.Tn ECHO_REQUEST 289*7f5f010bSBen Graspacket contains an additional 8 bytes worth of 290*7f5f010bSBen Gras.Tn ICMP 291*7f5f010bSBen Grasheader followed by an arbitrary amount of data. 292*7f5f010bSBen GrasWhen a 293*7f5f010bSBen Gras.Ar packetsize 294*7f5f010bSBen Grasis given, this indicated the size of this extra piece of data (the 295*7f5f010bSBen Grasdefault is 56). 296*7f5f010bSBen GrasThus the amount of data received inside of an IP packet of type 297*7f5f010bSBen Gras.Tn ICMP 298*7f5f010bSBen Gras.Tn ECHO_REPLY 299*7f5f010bSBen Graswill always be 8 bytes more than the requested data space (the 300*7f5f010bSBen Gras.Tn ICMP 301*7f5f010bSBen Grasheader). 302*7f5f010bSBen Gras.Pp 303*7f5f010bSBen GrasIf the data space is at least 304*7f5f010bSBen Gras.Dv sizeof(struct timespec) 305*7f5f010bSBen Gras(16) large, 306*7f5f010bSBen Gras.Nm 307*7f5f010bSBen Grasuses the first 308*7f5f010bSBen Gras.Dv sizeof(struct timespec) 309*7f5f010bSBen Grasbytes to include a timestamp to compute round trip times. 310*7f5f010bSBen GrasOtherwise if the data space is at least eight bytes large (or the 311*7f5f010bSBen Gras.Fl C 312*7f5f010bSBen Grasflag is specified), 313*7f5f010bSBen Gras.Nm 314*7f5f010bSBen Grasuses the first eight bytes of this space to include a timestamp to compute 315*7f5f010bSBen Grasround trip times. 316*7f5f010bSBen GrasIf there are not enough bytes of pad no round trip times are given. 317*7f5f010bSBen Gras.Sh DUPLICATE AND DAMAGED PACKETS 318*7f5f010bSBen Gras.Nm 319*7f5f010bSBen Graswill report duplicate and damaged packets. 320*7f5f010bSBen GrasDuplicate packets should never occur, and seem to be caused by 321*7f5f010bSBen Grasinappropriate link-level retransmissions. 322*7f5f010bSBen GrasDuplicates may occur in many situations and are rarely (if ever) a 323*7f5f010bSBen Grasgood sign, although the presence of low levels of duplicates may not 324*7f5f010bSBen Grasalways be cause for alarm. 325*7f5f010bSBen Gras.Pp 326*7f5f010bSBen GrasDamaged packets are obviously serious cause for alarm and often 327*7f5f010bSBen Grasindicate broken hardware somewhere in the 328*7f5f010bSBen Gras.Nm 329*7f5f010bSBen Graspacket's path (in the network or in the hosts). 330*7f5f010bSBen Gras.Sh TRYING DIFFERENT DATA PATTERNS 331*7f5f010bSBen GrasThe (inter)network layer should never treat packets differently depending 332*7f5f010bSBen Grason the data contained in the data portion. 333*7f5f010bSBen GrasUnfortunately, data-dependent problems have been known to sneak into 334*7f5f010bSBen Grasnetworks and remain undetected for long periods of time. 335*7f5f010bSBen GrasIn many cases the particular pattern that will have problems is something 336*7f5f010bSBen Grasthat doesn't have sufficient ``transitions'', such as all ones or all 337*7f5f010bSBen Graszeros, or a pattern right at the edge, such as almost all zeros. 338*7f5f010bSBen GrasIt isn't necessarily enough to specify a data pattern of all zeros (for 339*7f5f010bSBen Grasexample) on the command line because the pattern that is of interest is 340*7f5f010bSBen Grasat the data link level, and the relationship between what you type and 341*7f5f010bSBen Graswhat the controllers transmit can be complicated. 342*7f5f010bSBen Gras.Pp 343*7f5f010bSBen GrasThis means that if you have a data-dependent problem you will probably 344*7f5f010bSBen Grashave to do a lot of testing to find it. 345*7f5f010bSBen GrasIf you are lucky, you may manage to find a file that either can't be sent 346*7f5f010bSBen Grasacross your network or that takes much longer to transfer than other 347*7f5f010bSBen Grassimilar length files. 348*7f5f010bSBen GrasYou can then examine this file for repeated patterns that you can test 349*7f5f010bSBen Grasusing the 350*7f5f010bSBen Gras.Fl p 351*7f5f010bSBen Grasoption of 352*7f5f010bSBen Gras.Nm . 353*7f5f010bSBen Gras.Sh TTL DETAILS 354*7f5f010bSBen GrasThe 355*7f5f010bSBen Gras.Tn TTL 356*7f5f010bSBen Grasvalue of an IP packet represents the maximum number of IP routers 357*7f5f010bSBen Grasthat the packet can go through before being thrown away. 358*7f5f010bSBen GrasIn current practice you can expect each router in the Internet to decrement 359*7f5f010bSBen Grasthe 360*7f5f010bSBen Gras.Tn TTL 361*7f5f010bSBen Grasfield by exactly one. 362*7f5f010bSBen Gras.Pp 363*7f5f010bSBen GrasThe 364*7f5f010bSBen Gras.Tn TCP/IP 365*7f5f010bSBen Grasspecification states that the 366*7f5f010bSBen Gras.Tn TTL 367*7f5f010bSBen Grasfield for 368*7f5f010bSBen Gras.Tn TCP 369*7f5f010bSBen Graspackets should 370*7f5f010bSBen Grasbe set to 60, but many systems use smaller values 371*7f5f010bSBen Gras.Po 372*7f5f010bSBen Gras.Bx 4.3 373*7f5f010bSBen Grasuses 30, 374*7f5f010bSBen Gras.Bx 4.2 375*7f5f010bSBen Grasused 15 376*7f5f010bSBen Gras.Pc . 377*7f5f010bSBen Gras.Pp 378*7f5f010bSBen GrasThe maximum possible value of this field is 255, and most 379*7f5f010bSBen Gras.Ux 380*7f5f010bSBen Grassystems set the 381*7f5f010bSBen Gras.Tn TTL 382*7f5f010bSBen Grasfield of 383*7f5f010bSBen Gras.Tn ICMP ECHO_REQUEST 384*7f5f010bSBen Graspackets to 255. 385*7f5f010bSBen GrasThis is why you will find you can ``ping'' some hosts, but not reach them 386*7f5f010bSBen Graswith 387*7f5f010bSBen Gras.Xr telnet 1 388*7f5f010bSBen Grasor 389*7f5f010bSBen Gras.Xr ftp 1 . 390*7f5f010bSBen Gras.Pp 391*7f5f010bSBen GrasIn normal operation ping prints the ttl value from the packet it receives. 392*7f5f010bSBen GrasWhen a remote system receives a ping packet, it can do one of three things 393*7f5f010bSBen Graswith the 394*7f5f010bSBen Gras.Tn TTL 395*7f5f010bSBen Grasfield in its response: 396*7f5f010bSBen Gras.Bl -bullet 397*7f5f010bSBen Gras.It 398*7f5f010bSBen GrasNot change it; this is what Berkeley 399*7f5f010bSBen Gras.Ux 400*7f5f010bSBen Grassystems did before the 401*7f5f010bSBen Gras.Bx 4.3 tahoe 402*7f5f010bSBen Grasrelease. 403*7f5f010bSBen GrasIn this case the 404*7f5f010bSBen Gras.Tn TTL 405*7f5f010bSBen Grasvalue in the received packet will be 255 minus the 406*7f5f010bSBen Grasnumber of routers in the round-trip path. 407*7f5f010bSBen Gras.It 408*7f5f010bSBen GrasSet it to 255; this is what current Berkeley 409*7f5f010bSBen Gras.Ux 410*7f5f010bSBen Grassystems do. 411*7f5f010bSBen GrasIn this case the 412*7f5f010bSBen Gras.Tn TTL 413*7f5f010bSBen Grasvalue in the received packet will be 255 minus the 414*7f5f010bSBen Grasnumber of routers in the path 415*7f5f010bSBen Gras.Em from 416*7f5f010bSBen Grasthe remote system 417*7f5f010bSBen Gras.Em to 418*7f5f010bSBen Grasthe 419*7f5f010bSBen Gras.Nm Ns Em ing 420*7f5f010bSBen Grashost. 421*7f5f010bSBen Gras.It 422*7f5f010bSBen GrasSet it to some other value. 423*7f5f010bSBen GrasSome machines use the same value for 424*7f5f010bSBen Gras.Tn ICMP 425*7f5f010bSBen Graspackets that they use for 426*7f5f010bSBen Gras.Tn TCP 427*7f5f010bSBen Graspackets, for example either 30 or 60. 428*7f5f010bSBen GrasOthers may use completely wild values. 429*7f5f010bSBen Gras.El 430*7f5f010bSBen Gras.Sh EXIT STATUS 431*7f5f010bSBen Gras.Nm 432*7f5f010bSBen Grasreturns 0 on success (the host is alive), 433*7f5f010bSBen Grasand non-zero if the arguments are incorrect or the host is not responding. 434*7f5f010bSBen Gras.Sh SEE ALSO 435*7f5f010bSBen Gras.Xr netstat 1 , 436*7f5f010bSBen Gras.Xr icmp 4 , 437*7f5f010bSBen Gras.Xr inet 4 , 438*7f5f010bSBen Gras.Xr ip 4 , 439*7f5f010bSBen Gras.Xr ifconfig 8 , 440*7f5f010bSBen Gras.Xr routed 8 , 441*7f5f010bSBen Gras.Xr spray 8 , 442*7f5f010bSBen Gras.Xr traceroute 8 443*7f5f010bSBen Gras.Sh HISTORY 444*7f5f010bSBen GrasThe 445*7f5f010bSBen Gras.Nm 446*7f5f010bSBen Grascommand appeared in 447*7f5f010bSBen Gras.Bx 4.3 . 448*7f5f010bSBen GrasIPsec support was added by WIDE/KAME project. 449*7f5f010bSBen Gras.Sh BUGS 450*7f5f010bSBen GrasFlood pinging is not recommended in general, and flood pinging a broadcast 451*7f5f010bSBen Grasor multicast address should only be done under very controlled conditions. 452*7f5f010bSBen Gras.Pp 453*7f5f010bSBen GrasThe 454*7f5f010bSBen Gras.Nm 455*7f5f010bSBen Grasprogram has evolved differently under different operating systems, 456*7f5f010bSBen Grasand in some cases the same flag performs a different function 457*7f5f010bSBen Grasunder different operating systems. 458*7f5f010bSBen GrasThe 459*7f5f010bSBen Gras.Fl t 460*7f5f010bSBen Grasflag conflicts with 461*7f5f010bSBen Gras.Fx . 462*7f5f010bSBen GrasThe 463*7f5f010bSBen Gras.Fl a , c , I , i , 464*7f5f010bSBen Gras.Fl l , P , p , s , 465*7f5f010bSBen Grasand 466*7f5f010bSBen Gras.Fl t 467*7f5f010bSBen Grasflags conflict with 468*7f5f010bSBen Gras.Sy Solaris . 469*7f5f010bSBen Gras.Pp 470*7f5f010bSBen GrasSome hosts and gateways ignore the 471*7f5f010bSBen Gras.Tn RECORD_ROUTE 472*7f5f010bSBen Grasoption. 473*7f5f010bSBen Gras.Pp 474*7f5f010bSBen GrasThe maximum IP header length is too small for options like 475*7f5f010bSBen Gras.Tn RECORD_ROUTE 476*7f5f010bSBen Grasto 477*7f5f010bSBen Grasbe completely useful. 478*7f5f010bSBen GrasThere's not much that that can be done about this, however. 479