Lorenzo Colitti | 313379e | 2013-07-11 01:07:11 +0900 | [diff] [blame] | 1 | <refentry id="ping"> |
| 2 | |
| 3 | <refmeta> |
| 4 | <refentrytitle>ping</refentrytitle> |
| 5 | <manvolnum>8</manvolnum> |
| 6 | <refmiscinfo>iputils-&snapshot;</refmiscinfo> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>ping, ping6</refname> |
| 11 | <refpurpose>send ICMP ECHO_REQUEST to network hosts</refpurpose> |
| 12 | </refnamediv> |
| 13 | |
| 14 | <refsynopsisdiv> |
| 15 | <cmdsynopsis> |
| 16 | <command>ping</command> |
| 17 | <arg choice="opt"><option>-aAbBdDfhLnOqrRUvV</option></arg> |
| 18 | <arg choice="opt">-c <replaceable/count/</arg> |
| 19 | <arg choice="opt">-F <replaceable/flowlabel/</arg> |
| 20 | <arg choice="opt">-i <replaceable/interval/</arg> |
| 21 | <arg choice="opt">-I <replaceable/interface/</arg> |
| 22 | <arg choice="opt">-l <replaceable/preload/</arg> |
| 23 | <arg choice="opt">-m <replaceable/mark/</arg> |
| 24 | <arg choice="opt">-M <replaceable/pmtudisc_option/</arg> |
| 25 | <arg choice="opt">-N <replaceable/nodeinfo_option/</arg> |
| 26 | <arg choice="opt">-w <replaceable/deadline/</arg> |
| 27 | <arg choice="opt">-W <replaceable/timeout/</arg> |
| 28 | <arg choice="opt">-p <replaceable/pattern/</arg> |
| 29 | <arg choice="opt">-Q <replaceable/tos/</arg> |
| 30 | <arg choice="opt">-s <replaceable/packetsize/</arg> |
| 31 | <arg choice="opt">-S <replaceable/sndbuf/</arg> |
| 32 | <arg choice="opt">-t <replaceable/ttl/</arg> |
| 33 | <arg choice="opt">-T <replaceable/timestamp option/</arg> |
| 34 | <arg choice="opt" rep="repeat"><replaceable/hop/</arg> |
| 35 | <arg choice="req"><replaceable/destination/</arg> |
| 36 | </cmdsynopsis> |
| 37 | </refsynopsisdiv> |
| 38 | |
| 39 | <refsect1><title>DESCRIPTION</title> |
| 40 | <para> |
| 41 | <command/ping/ uses the ICMP protocol's mandatory ECHO_REQUEST |
| 42 | datagram to elicit an ICMP ECHO_RESPONSE from a host or gateway. |
| 43 | ECHO_REQUEST datagrams (``pings'') have an IP and ICMP |
| 44 | header, followed by a <structname/struct timeval/ and then an arbitrary |
| 45 | number of ``pad'' bytes used to fill out the packet. |
| 46 | </para> |
| 47 | <para> |
| 48 | <command/ping6/ is IPv6 version of <command/ping/, and can also send Node Information Queries (RFC4620). |
| 49 | Intermediate <replaceable/hop/s may not be allowed, because IPv6 source routing was deprecated (RFC5095). |
| 50 | </para> |
| 51 | </refsect1> |
| 52 | |
| 53 | <refsect1><title>OPTIONS</title> |
| 54 | |
| 55 | <variablelist> |
| 56 | <varlistentry> |
| 57 | <term><option/-a/</term> |
| 58 | <listitem><para> |
| 59 | Audible ping. |
| 60 | </para></listitem> |
| 61 | </varlistentry> |
| 62 | <varlistentry> |
| 63 | <term><option/-A/</term> |
| 64 | <listitem><para> |
| 65 | Adaptive ping. Interpacket interval adapts to round-trip time, so that |
| 66 | effectively not more than one (or more, if preload is set) unanswered probe |
| 67 | is present in the network. Minimal interval is 200msec for not super-user. |
| 68 | On networks with low rtt this mode is essentially equivalent to flood mode. |
| 69 | </para></listitem> |
| 70 | </varlistentry> |
| 71 | <varlistentry> |
| 72 | <term><option/-b/</term> |
| 73 | <listitem><para> |
| 74 | Allow pinging a broadcast address. |
| 75 | </para></listitem> |
| 76 | </varlistentry> |
| 77 | <varlistentry> |
| 78 | <term><option/-B/</term> |
| 79 | <listitem><para> |
| 80 | Do not allow <command/ping/ to change source address of probes. |
| 81 | The address is bound to one selected when <command/ping/ starts. |
| 82 | </para></listitem> |
| 83 | </varlistentry> |
| 84 | <varlistentry> |
| 85 | <term><option><anchor id="ping.count">-c <replaceable/count/</option></term> |
| 86 | <listitem><para> |
| 87 | Stop after sending <replaceable/count/ ECHO_REQUEST |
| 88 | packets. With |
| 89 | <link linkend="ping.deadline"><replaceable/deadline/</link> |
| 90 | option, <command/ping/ waits for |
| 91 | <replaceable/count/ ECHO_REPLY packets, until the timeout expires. |
| 92 | </para></listitem> |
| 93 | </varlistentry> |
| 94 | <varlistentry> |
| 95 | <term><option/-d/</term> |
| 96 | <listitem><para> |
| 97 | Set the <constant/SO_DEBUG/ option on the socket being used. |
| 98 | Essentially, this socket option is not used by Linux kernel. |
| 99 | </para></listitem> |
| 100 | </varlistentry> |
| 101 | <varlistentry> |
| 102 | <term><option/-D/</term> |
| 103 | <listitem><para> |
| 104 | Print timestamp (unix time + microseconds as in gettimeofday) before |
| 105 | each line. |
| 106 | </para></listitem> |
| 107 | </varlistentry> |
| 108 | <varlistentry> |
| 109 | <term><option/-f/</term> |
| 110 | <listitem><para> |
| 111 | Flood ping. For every ECHO_REQUEST sent a period ``.'' is printed, |
| 112 | while for ever ECHO_REPLY received a backspace is printed. |
| 113 | This provides a rapid display of how many packets are being dropped. |
| 114 | If interval is not given, it sets interval to zero and |
| 115 | outputs packets as fast as they come back or one hundred times per second, |
| 116 | whichever is more. |
| 117 | Only the super-user may use this option with zero interval. |
| 118 | </para></listitem> |
| 119 | </varlistentry> |
| 120 | <varlistentry> |
| 121 | <term><option>-F <replaceable/flow label/</option></term> |
| 122 | <listitem><para> |
| 123 | <command/ping6/ only. |
| 124 | Allocate and set 20 bit flow label (in hex) on echo request packets. |
| 125 | If value is zero, kernel allocates random flow label. |
| 126 | </para></listitem> |
| 127 | </varlistentry> |
| 128 | <varlistentry> |
| 129 | <term><option/-h/</term> |
| 130 | <listitem><para> |
| 131 | Show help. |
| 132 | </para></listitem> |
| 133 | </varlistentry> |
| 134 | <varlistentry> |
| 135 | <term><option>-i <replaceable/interval/</option></term> |
| 136 | <listitem><para> |
| 137 | Wait <replaceable/interval/ seconds between sending each packet. |
| 138 | The default is to wait for one second between each packet normally, |
| 139 | or not to wait in flood mode. Only super-user may set interval |
| 140 | to values less 0.2 seconds. |
| 141 | </para></listitem> |
| 142 | </varlistentry> |
| 143 | <varlistentry> |
| 144 | <term><option>-I <replaceable/interface/</option></term> |
| 145 | <listitem><para> |
| 146 | <replaceable/interface/ is either an address, or an interface name. |
| 147 | If <replaceable/interface/ is an address, it sets source address |
| 148 | to specified interface address. |
| 149 | If <replaceable/interface/ in an interface name, it sets |
| 150 | source interface to specified interface. |
| 151 | For <command/ping6/, when doing ping to a link-local scope |
| 152 | address, link specification (by the '%'-notation in |
| 153 | <replaceable/destination/, or by this option) is required. |
| 154 | </para></listitem> |
| 155 | </varlistentry> |
| 156 | <varlistentry> |
| 157 | <term><option>-l <replaceable/preload/</option></term> |
| 158 | <listitem><para> |
| 159 | If <replaceable/preload/ is specified, |
| 160 | <command/ping/ sends that many packets not waiting for reply. |
| 161 | Only the super-user may select preload more than 3. |
| 162 | </para></listitem> |
| 163 | </varlistentry> |
| 164 | <varlistentry> |
| 165 | <term><option/-L/</term> |
| 166 | <listitem><para> |
| 167 | Suppress loopback of multicast packets. This flag only applies if the ping |
| 168 | destination is a multicast address. |
| 169 | </para></listitem> |
| 170 | </varlistentry> |
| 171 | <varlistentry> |
| 172 | <term><option>-m <replaceable/mark/</option></term> |
| 173 | <listitem><para> |
| 174 | use <replaceable/mark/ to tag the packets going out. This is useful |
| 175 | for variety of reasons within the kernel such as using policy |
| 176 | routing to select specific outbound processing. |
| 177 | </para></listitem> |
| 178 | </varlistentry> |
| 179 | <varlistentry> |
| 180 | <term><option>-M <replaceable/pmtudisc_opt/</option></term> |
| 181 | <listitem><para> |
| 182 | Select Path MTU Discovery strategy. |
| 183 | <replaceable/pmtudisc_option/ may be either <replaceable/do/ |
| 184 | (prohibit fragmentation, even local one), |
| 185 | <replaceable/want/ (do PMTU discovery, fragment locally when packet size |
| 186 | is large), or <replaceable/dont/ (do not set DF flag). |
| 187 | </para></listitem> |
| 188 | </varlistentry> |
| 189 | <varlistentry> |
| 190 | <term><option>-N <replaceable/nodeinfo_option/</option></term> |
| 191 | <listitem><para> |
| 192 | <command/ping6/ only. |
| 193 | Send ICMPv6 Node Information Queries (RFC4620), instead of Echo Request. |
| 194 | <variablelist> |
| 195 | <varlistentry> |
| 196 | <term><option>help</option></term> |
| 197 | <listitem><para>Show help for NI support.</para></listitem> |
| 198 | </varlistentry> |
| 199 | </variablelist> |
| 200 | <variablelist> |
| 201 | <varlistentry> |
| 202 | <term><option>name</option></term> |
| 203 | <listitem><para>Queries for Node Names.</para></listitem> |
| 204 | </varlistentry> |
| 205 | </variablelist> |
| 206 | <variablelist> |
| 207 | <varlistentry> |
| 208 | <term><option>ipv6</option></term> |
| 209 | <listitem><para>Queries for IPv6 Addresses. There are several IPv6 specific flags. |
| 210 | <variablelist> |
| 211 | <varlistentry> |
| 212 | <term><option>ipv6-global</option></term> |
| 213 | <listitem><para>Request IPv6 global-scope addresses.</para></listitem> |
| 214 | </varlistentry> |
| 215 | </variablelist> |
| 216 | <variablelist> |
| 217 | <varlistentry> |
| 218 | <term><option>ipv6-sitelocal</option></term> |
| 219 | <listitem><para>Request IPv6 site-local addresses.</para></listitem> |
| 220 | </varlistentry> |
| 221 | </variablelist> |
| 222 | <variablelist> |
| 223 | <varlistentry> |
| 224 | <term><option>ipv6-linklocal</option></term> |
| 225 | <listitem><para>Request IPv6 link-local addresses.</para></listitem> |
| 226 | </varlistentry> |
| 227 | </variablelist> |
| 228 | <variablelist> |
| 229 | <varlistentry> |
| 230 | <term><option>ipv6-all</option></term> |
| 231 | <listitem><para>Request IPv6 addresses on other interfaces.</para></listitem> |
| 232 | </varlistentry> |
| 233 | </variablelist> |
| 234 | </para></listitem> |
| 235 | </varlistentry> |
| 236 | </variablelist> |
| 237 | <variablelist> |
| 238 | <varlistentry> |
| 239 | <term><option>ipv4</option></term> |
| 240 | <listitem><para>Queries for IPv4 Addresses. There is one IPv4 specific flag. |
| 241 | <variablelist> |
| 242 | <varlistentry> |
| 243 | <term><option>ipv4-all</option></term> |
| 244 | <listitem><para>Request IPv4 addresses on other interfaces.</para></listitem> |
| 245 | </varlistentry> |
| 246 | </variablelist> |
| 247 | </para></listitem> |
| 248 | </varlistentry> |
| 249 | </variablelist> |
| 250 | <variablelist> |
| 251 | <varlistentry> |
| 252 | <term><option>subject-ipv6=<replaceable/ipv6addr/</option></term> |
| 253 | <listitem><para>IPv6 subject address.</para></listitem> |
| 254 | </varlistentry> |
| 255 | </variablelist> |
| 256 | <variablelist> |
| 257 | <varlistentry> |
| 258 | <term><option>subject-ipv4=<replaceable/ipv4addr/</option></term> |
| 259 | <listitem><para>IPv4 subject address.</para></listitem> |
| 260 | </varlistentry> |
| 261 | </variablelist> |
| 262 | <variablelist> |
| 263 | <varlistentry> |
| 264 | <term><option>subject-name=<replaceable/nodename/</option></term> |
| 265 | <listitem><para>Subject name. If it contains more than one dot, |
| 266 | fully-qualified domain name is assumed.</para></listitem> |
| 267 | </varlistentry> |
| 268 | </variablelist> |
| 269 | <variablelist> |
| 270 | <varlistentry> |
| 271 | <term><option>subject-fqdn=<replaceable/nodename/</option></term> |
| 272 | <listitem><para>Subject name. Fully-qualified domain name is |
| 273 | always assumed.</para></listitem> |
| 274 | </varlistentry> |
| 275 | </variablelist> |
| 276 | </para></listitem> |
| 277 | </varlistentry> |
| 278 | <varlistentry> |
| 279 | <term><option/-n/</term> |
| 280 | <listitem><para> |
| 281 | Numeric output only. |
| 282 | No attempt will be made to lookup symbolic names for host addresses. |
| 283 | </para></listitem> |
| 284 | </varlistentry> |
| 285 | <varlistentry> |
| 286 | <term><option/-O/</term> |
| 287 | <listitem><para> |
| 288 | Report outstanding ICMP ECHO reply before sending next packet. |
| 289 | This is useful together with the timestamp <option>-D</option> to |
| 290 | log output to a diagnostic file and search for missing answers. |
| 291 | </para></listitem> |
| 292 | </varlistentry> |
| 293 | <varlistentry> |
| 294 | <term><option>-p <replaceable/pattern/</option></term> |
| 295 | <listitem><para> |
| 296 | You may specify up to 16 ``pad'' bytes to fill out the packet you send. |
| 297 | This is useful for diagnosing data-dependent problems in a network. |
| 298 | For example, <option>-p ff</option> will cause the sent packet |
| 299 | to be filled with all ones. |
| 300 | </para></listitem> |
| 301 | </varlistentry> |
| 302 | <varlistentry> |
| 303 | <term><option/-q/</term> |
| 304 | <listitem><para> |
| 305 | Quiet output. |
| 306 | Nothing is displayed except the summary lines at startup time and |
| 307 | when finished. |
| 308 | </para></listitem> |
| 309 | </varlistentry> |
| 310 | <varlistentry> |
| 311 | <term><option>-Q <replaceable/tos/</option></term> |
| 312 | <listitem><para> |
| 313 | Set Quality of Service -related bits in ICMP datagrams. |
| 314 | <replaceable/tos/ can be decimal (<command/ping/ only) or hex number. |
| 315 | </para> |
| 316 | <para> |
| 317 | In RFC2474, these fields are interpreted as 8-bit Differentiated |
| 318 | Services (DS), consisting of: bits 0-1 (2 lowest bits) of separate |
| 319 | data, and bits 2-7 (highest 6 bits) of Differentiated Services |
| 320 | Codepoint (DSCP). In RFC2481 and RFC3168, bits 0-1 are used for ECN. |
| 321 | </para> |
| 322 | <para> |
| 323 | Historically (RFC1349, obsoleted by RFC2474), these were interpreted |
| 324 | as: bit 0 (lowest bit) for reserved (currently being redefined as |
| 325 | congestion control), 1-4 for Type of Service and bits 5-7 |
| 326 | (highest bits) for Precedence. |
| 327 | </para> |
| 328 | </listitem> |
| 329 | </varlistentry> |
| 330 | <varlistentry> |
| 331 | <term><option/-r/</term> |
| 332 | <listitem><para> |
| 333 | Bypass the normal routing tables and send directly to a host on an attached |
| 334 | interface. |
| 335 | If the host is not on a directly-attached network, an error is returned. |
| 336 | This option can be used to ping a local host through an interface |
| 337 | that has no route through it provided the option <option/-I/ is also |
| 338 | used. |
| 339 | </para></listitem> |
| 340 | </varlistentry> |
| 341 | <varlistentry> |
| 342 | <term><option/-R/</term> |
| 343 | <listitem><para> |
| 344 | <command/ping/ only. |
| 345 | Record route. |
| 346 | Includes the RECORD_ROUTE option in the ECHO_REQUEST |
| 347 | packet and displays the route buffer on returned packets. |
| 348 | Note that the IP header is only large enough for nine such routes. |
| 349 | Many hosts ignore or discard this option. |
| 350 | </para></listitem> |
| 351 | </varlistentry> |
| 352 | <varlistentry> |
| 353 | <term><option>-s <replaceable/packetsize/</option></term> |
| 354 | <listitem><para> |
| 355 | Specifies the number of data bytes to be sent. |
| 356 | The default is 56, which translates into 64 ICMP |
| 357 | data bytes when combined with the 8 bytes of ICMP header data. |
| 358 | </para></listitem> |
| 359 | </varlistentry> |
| 360 | <varlistentry> |
| 361 | <term><option>-S <replaceable/sndbuf/</option></term> |
| 362 | <listitem><para> |
| 363 | Set socket sndbuf. If not specified, it is selected to buffer |
| 364 | not more than one packet. |
| 365 | </para></listitem> |
| 366 | </varlistentry> |
| 367 | <varlistentry> |
| 368 | <term><option>-t <replaceable/ttl/</option></term> |
| 369 | <listitem><para> |
| 370 | <command/ping/ only. |
| 371 | Set the IP Time to Live. |
| 372 | </para></listitem> |
| 373 | </varlistentry> |
| 374 | <varlistentry> |
| 375 | <term><option>-T <replaceable/timestamp option/</option></term> |
| 376 | <listitem><para> |
| 377 | Set special IP timestamp options. |
| 378 | <replaceable/timestamp option/ may be either |
| 379 | <replaceable/tsonly/ (only timestamps), |
| 380 | <replaceable/tsandaddr/ (timestamps and addresses) or |
| 381 | <replaceable/tsprespec host1 [host2 [host3 [host4]]]/ |
| 382 | (timestamp prespecified hops). |
| 383 | </para></listitem> |
| 384 | </varlistentry> |
| 385 | <varlistentry> |
| 386 | <term><option/-U/</term> |
| 387 | <listitem><para> |
| 388 | Print full user-to-user latency (the old behaviour). Normally |
| 389 | <command/ping/ |
| 390 | prints network round trip time, which can be different |
| 391 | f.e. due to DNS failures. |
| 392 | </para></listitem> |
| 393 | </varlistentry> |
| 394 | <varlistentry> |
| 395 | <term><option/-v/</term> |
| 396 | <listitem><para> |
| 397 | Verbose output. |
| 398 | </para></listitem> |
| 399 | </varlistentry> |
| 400 | <varlistentry> |
| 401 | <term><option/-V/</term> |
| 402 | <listitem><para> |
| 403 | Show version and exit. |
| 404 | </para></listitem> |
| 405 | </varlistentry> |
| 406 | <varlistentry> |
| 407 | <term><option><anchor id="ping.deadline">-w <replaceable/deadline/</option></term> |
| 408 | <listitem><para> |
| 409 | Specify a timeout, in seconds, before |
| 410 | <command/ping/ |
| 411 | exits regardless of how many |
| 412 | packets have been sent or received. In this case |
| 413 | <command/ping/ |
| 414 | does not stop after |
| 415 | <link linkend="ping.count"><replaceable/count/</link> |
| 416 | packet are sent, it waits either for |
| 417 | <link linkend="ping.deadline"><replaceable/deadline/</link> |
| 418 | expire or until |
| 419 | <link linkend="ping.count"><replaceable/count/</link> |
| 420 | probes are answered or for some error notification from network. |
| 421 | </para></listitem> |
| 422 | </varlistentry> |
| 423 | <varlistentry> |
| 424 | <term><option>-W <replaceable/timeout/</option></term> |
| 425 | <listitem><para> |
| 426 | Time to wait for a response, in seconds. The option affects only timeout |
| 427 | in absence of any responses, otherwise <command/ping/ waits for two RTTs. |
| 428 | </para></listitem> |
| 429 | </varlistentry> |
| 430 | </variablelist> |
| 431 | |
| 432 | <para> |
| 433 | When using <command/ping/ for fault isolation, it should first be run |
| 434 | on the local host, to verify that the local network interface is up |
| 435 | and running. Then, hosts and gateways further and further away should be |
| 436 | ``pinged''. Round-trip times and packet loss statistics are computed. |
| 437 | If duplicate packets are received, they are not included in the packet |
| 438 | loss calculation, although the round trip time of these packets is used |
| 439 | in calculating the minimum/average/maximum round-trip time numbers. |
| 440 | When the specified number of packets have been sent (and received) or |
| 441 | if the program is terminated with a |
| 442 | <constant/SIGINT/, a brief summary is displayed. Shorter current statistics |
| 443 | can be obtained without termination of process with signal |
| 444 | <constant/SIGQUIT/. |
| 445 | </para> |
| 446 | |
| 447 | <para> |
| 448 | If <command/ping/ does not receive any reply packets at all it will |
| 449 | exit with code 1. If a packet |
| 450 | <link linkend="ping.count"><replaceable/count/</link> |
| 451 | and |
| 452 | <link linkend="ping.deadline"><replaceable/deadline/</link> |
| 453 | are both specified, and fewer than |
| 454 | <link linkend="ping.count"><replaceable/count/</link> |
| 455 | packets are received by the time the |
| 456 | <link linkend="ping.deadline"><replaceable/deadline/</link> |
| 457 | has arrived, it will also exit with code 1. |
| 458 | On other error it exits with code 2. Otherwise it exits with code 0. This |
| 459 | makes it possible to use the exit code to see if a host is alive or |
| 460 | not. |
| 461 | </para> |
| 462 | |
| 463 | |
| 464 | <para> |
| 465 | This program is intended for use in network testing, measurement and |
| 466 | management. |
| 467 | Because of the load it can impose on the network, it is unwise to use |
| 468 | <command/ping/ during normal operations or from automated scripts. |
| 469 | </para> |
| 470 | |
| 471 | </refsect1> |
| 472 | |
| 473 | |
| 474 | <refsect1><title>ICMP PACKET DETAILS</title> |
| 475 | |
| 476 | <para> |
| 477 | An IP header without options is 20 bytes. |
| 478 | An ICMP ECHO_REQUEST packet contains an additional 8 bytes worth |
| 479 | of ICMP header followed by an arbitrary amount of data. |
| 480 | When a <replaceable/packetsize/ is given, this indicated the size of this |
| 481 | extra piece of data (the default is 56). Thus the amount of data received |
| 482 | inside of an IP packet of type ICMP ECHO_REPLY will always be 8 bytes |
| 483 | more than the requested data space (the ICMP header). |
| 484 | </para> |
| 485 | |
| 486 | <para> |
| 487 | If the data space is at least of size of <structname/struct timeval/ |
| 488 | <command/ping/ uses the beginning bytes of this space to include |
| 489 | a timestamp which it uses in the computation of round trip times. |
| 490 | If the data space is shorter, no round trip times are given. |
| 491 | </para> |
| 492 | |
| 493 | </refsect1> |
| 494 | |
| 495 | <refsect1><title>DUPLICATE AND DAMAGED PACKETS</title> |
| 496 | |
| 497 | <para> |
| 498 | <command/ping/ will report duplicate and damaged packets. |
| 499 | Duplicate packets should never occur, and seem to be caused by |
| 500 | inappropriate link-level retransmissions. |
| 501 | Duplicates may occur in many situations and are rarely (if ever) a |
| 502 | good sign, although the presence of low levels of duplicates may not |
| 503 | always be cause for alarm. |
| 504 | </para> |
| 505 | |
| 506 | <para> |
| 507 | Damaged packets are obviously serious cause for alarm and often |
| 508 | indicate broken hardware somewhere in the |
| 509 | <command/ping/ packet's path (in the network or in the hosts). |
| 510 | </para> |
| 511 | |
| 512 | </refsect1> |
| 513 | |
| 514 | <refsect1><title>TRYING DIFFERENT DATA PATTERNS</title> |
| 515 | |
| 516 | <para> |
| 517 | The (inter)network layer should never treat packets differently depending |
| 518 | on the data contained in the data portion. |
| 519 | Unfortunately, data-dependent problems have been known to sneak into |
| 520 | networks and remain undetected for long periods of time. |
| 521 | In many cases the particular pattern that will have problems is something |
| 522 | that doesn't have sufficient ``transitions'', such as all ones or all |
| 523 | zeros, or a pattern right at the edge, such as almost all zeros. |
| 524 | It isn't necessarily enough to specify a data pattern of all zeros (for |
| 525 | example) on the command line because the pattern that is of interest is |
| 526 | at the data link level, and the relationship between what you type and |
| 527 | what the controllers transmit can be complicated. |
| 528 | </para> |
| 529 | |
| 530 | <para> |
| 531 | This means that if you have a data-dependent problem you will probably |
| 532 | have to do a lot of testing to find it. |
| 533 | If you are lucky, you may manage to find a file that either can't be sent |
| 534 | across your network or that takes much longer to transfer than other |
| 535 | similar length files. |
| 536 | You can then examine this file for repeated patterns that you can test |
| 537 | using the <option/-p/ option of <command/ping/. |
| 538 | </para> |
| 539 | |
| 540 | </refsect1> |
| 541 | |
| 542 | <refsect1><title>TTL DETAILS</title> |
| 543 | |
| 544 | <para> |
| 545 | The TTL value of an IP packet represents the maximum number of IP routers |
| 546 | that the packet can go through before being thrown away. |
| 547 | In current practice you can expect each router in the Internet to decrement |
| 548 | the TTL field by exactly one. |
| 549 | </para> |
| 550 | |
| 551 | <para> |
| 552 | The TCP/IP specification states that the TTL field for TCP |
| 553 | packets should be set to 60, but many systems use smaller values |
| 554 | (4.3 BSD uses 30, 4.2 used 15). |
| 555 | </para> |
| 556 | |
| 557 | <para> |
| 558 | The maximum possible value of this field is 255, and most Unix systems set |
| 559 | the TTL field of ICMP ECHO_REQUEST packets to 255. |
| 560 | This is why you will find you can ``ping'' some hosts, but not reach them |
| 561 | with |
| 562 | <citerefentry><refentrytitle/telnet/<manvolnum/1/</citerefentry> |
| 563 | or |
| 564 | <citerefentry><refentrytitle/ftp/<manvolnum/1/</citerefentry>. |
| 565 | </para> |
| 566 | |
| 567 | <para> |
| 568 | In normal operation ping prints the TTL value from the packet it receives. |
| 569 | When a remote system receives a ping packet, it can do one of three things |
| 570 | with the TTL field in its response: |
| 571 | </para> |
| 572 | |
| 573 | <itemizedlist> |
| 574 | <listitem><para> |
| 575 | Not change it; this is what Berkeley Unix systems did before the |
| 576 | 4.3BSD Tahoe release. In this case the TTL value in the received packet |
| 577 | will be 255 minus the number of routers in the round-trip path. |
| 578 | </para></listitem> |
| 579 | <listitem><para> |
| 580 | Set it to 255; this is what current Berkeley Unix systems do. |
| 581 | In this case the TTL value in the received packet will be 255 minus the |
| 582 | number of routers in the path <emphasis/from/ |
| 583 | the remote system <emphasis/to/ the <command/ping/ing host. |
| 584 | </para></listitem> |
| 585 | <listitem><para> |
| 586 | Set it to some other value. Some machines use the same value for |
| 587 | ICMP packets that they use for TCP packets, for example either 30 or 60. |
| 588 | Others may use completely wild values. |
| 589 | </para></listitem> |
| 590 | </itemizedlist> |
| 591 | |
| 592 | </refsect1> |
| 593 | |
| 594 | <refsect1><title>BUGS</title> |
| 595 | |
| 596 | <itemizedlist> |
| 597 | <listitem><para> |
| 598 | Many Hosts and Gateways ignore the RECORD_ROUTE option. |
| 599 | </para></listitem> |
| 600 | <listitem><para> |
| 601 | The maximum IP header length is too small for options like |
| 602 | RECORD_ROUTE to be completely useful. |
| 603 | There's not much that can be done about this, however. |
| 604 | </para></listitem> |
| 605 | <listitem><para> |
| 606 | Flood pinging is not recommended in general, and flood pinging the |
| 607 | broadcast address should only be done under very controlled conditions. |
| 608 | </para></listitem> |
| 609 | </itemizedlist> |
| 610 | |
| 611 | </refsect1> |
| 612 | |
| 613 | <refsect1><title>SEE ALSO</title> |
| 614 | <para> |
| 615 | <citerefentry><refentrytitle/netstat/<manvolnum/1/</citerefentry>, |
| 616 | <citerefentry><refentrytitle/ifconfig/<manvolnum/8/</citerefentry>. |
| 617 | </para> |
| 618 | </refsect1> |
| 619 | |
| 620 | <refsect1><title>HISTORY</title> |
| 621 | <para> |
| 622 | The <command/ping/ command appeared in 4.3BSD. |
| 623 | </para> |
| 624 | <para> |
| 625 | The version described here is its descendant specific to Linux. |
| 626 | </para> |
| 627 | </refsect1> |
| 628 | |
| 629 | <refsect1><title>SECURITY</title> |
| 630 | <para> |
| 631 | <command/ping/ requires <constant/CAP_NET_RAW/ capability |
| 632 | to be executed. It may be used as set-uid root. |
| 633 | </para> |
| 634 | </refsect1> |
| 635 | |
| 636 | <refsect1><title>AVAILABILITY</title> |
| 637 | <para> |
| 638 | <command/ping/ is part of <filename/iputils/ package |
| 639 | and the latest versions are available in source form at |
| 640 | <ulink url="http://www.skbuff.net/iputils/iputils-current.tar.bz2"> |
| 641 | http://www.skbuff.net/iputils/iputils-current.tar.bz2</ulink>. |
| 642 | </para> |
| 643 | </refsect1> |
| 644 | |
| 645 | <![IGNORE[ |
| 646 | <refsect1><title>COPYING</title> |
| 647 | <para> |
| 648 | <literallayout> |
| 649 | Copyright (c) 1989 The Regents of the University of California. |
| 650 | All rights reserved. |
| 651 | |
| 652 | This code is derived from software contributed to Berkeley by |
| 653 | Mike Muuss. |
| 654 | |
| 655 | Redistribution and use in source and binary forms, with or without |
| 656 | modification, are permitted provided that the following conditions |
| 657 | are met: |
| 658 | 1. Redistributions of source code must retain the above copyright |
| 659 | notice, this list of conditions and the following disclaimer. |
| 660 | 2. Redistributions in binary form must reproduce the above copyright |
| 661 | notice, this list of conditions and the following disclaimer in the |
| 662 | documentation and/or other materials provided with the distribution. |
| 663 | 3. All advertising materials mentioning features or use of this software |
| 664 | must display the following acknowledgement: |
| 665 | This product includes software developed by the University of |
| 666 | California, Berkeley and its contributors. |
| 667 | 4. Neither the name of the University nor the names of its contributors |
| 668 | may be used to endorse or promote products derived from this software |
| 669 | without specific prior written permission. |
| 670 | |
| 671 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 672 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 673 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 674 | ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 675 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 676 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 677 | OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 678 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 679 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 680 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 681 | SUCH DAMAGE. |
| 682 | </literallayout> |
| 683 | </para> |
| 684 | </refsect1> |
| 685 | ]]> |
| 686 | |
| 687 | |
| 688 | </refentry> |
| 689 | |