xref: /freebsd/sbin/ping/ping.8 (revision 9ff95228e8c027710cce6b7f8dbd7b13d579565c)
18fae3551SRodney W. Grimes.\" Copyright (c) 1985, 1991, 1993
28fae3551SRodney W. Grimes.\"	The Regents of the University of California.  All rights reserved.
38fae3551SRodney W. Grimes.\"
48fae3551SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without
58fae3551SRodney W. Grimes.\" modification, are permitted provided that the following conditions
68fae3551SRodney W. Grimes.\" are met:
78fae3551SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright
88fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer.
98fae3551SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright
108fae3551SRodney W. Grimes.\"    notice, this list of conditions and the following disclaimer in the
118fae3551SRodney W. Grimes.\"    documentation and/or other materials provided with the distribution.
128fae3551SRodney W. Grimes.\" 4. Neither the name of the University nor the names of its contributors
138fae3551SRodney W. Grimes.\"    may be used to endorse or promote products derived from this software
148fae3551SRodney W. Grimes.\"    without specific prior written permission.
158fae3551SRodney W. Grimes.\"
168fae3551SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
178fae3551SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
188fae3551SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
198fae3551SRodney W. Grimes.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
208fae3551SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
218fae3551SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
228fae3551SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
238fae3551SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
248fae3551SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
258fae3551SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
268fae3551SRodney W. Grimes.\" SUCH DAMAGE.
278fae3551SRodney W. Grimes.\"
288fae3551SRodney W. Grimes.\"     @(#)ping.8	8.2 (Berkeley) 12/11/93
297f3dea24SPeter Wemm.\" $FreeBSD$
308fae3551SRodney W. Grimes.\"
319ff95228SGleb Smirnoff.Dd August 15, 2005
328fae3551SRodney W. Grimes.Dt PING 8
339fe48c6eSRuslan Ermilov.Os
348fae3551SRodney W. Grimes.Sh NAME
358fae3551SRodney W. Grimes.Nm ping
368fae3551SRodney W. Grimes.Nd send
378fae3551SRodney W. Grimes.Tn ICMP ECHO_REQUEST
388fae3551SRodney W. Grimespackets to network hosts
398fae3551SRodney W. Grimes.Sh SYNOPSIS
407c7fb079SRuslan Ermilov.Nm
412c56e246SMatthew N. Dodd.Op Fl AaDdfnoQqRrv
428fae3551SRodney W. Grimes.Op Fl c Ar count
439ff95228SGleb Smirnoff.Op Fl G Ar sweepmaxsize
449ff95228SGleb Smirnoff.Op Fl g Ar sweepminsize
459ff95228SGleb Smirnoff.Op Fl h Ar sweepincrsize
468fae3551SRodney W. Grimes.Op Fl i Ar wait
478fae3551SRodney W. Grimes.Op Fl l Ar preload
481bd10ba2SRuslan Ermilov.Op Fl M Cm mask | time
49211bfbd2SRuslan Ermilov.Op Fl m Ar ttl
509a4365d0SYoshinobu Inoue.Op Fl P Ar policy
511f6a4631SRuslan Ermilov.Op Fl p Ar pattern
5299490edeSWarner Losh.Op Fl S Ar src_addr
531f6a4631SRuslan Ermilov.Op Fl s Ar packetsize
54bf113f1bSBill Fumerola.Op Fl t Ar timeout
550b2f8b3fSMaxim Konovalov.Op Fl z Ar tos
561bd10ba2SRuslan Ermilov.Ar host
571bd10ba2SRuslan Ermilov.Nm
582c56e246SMatthew N. Dodd.Op Fl AaDdfLnoQqRrv
591bd10ba2SRuslan Ermilov.Op Fl c Ar count
601bd10ba2SRuslan Ermilov.Op Fl I Ar iface
611bd10ba2SRuslan Ermilov.Op Fl i Ar wait
621bd10ba2SRuslan Ermilov.Op Fl l Ar preload
631bd10ba2SRuslan Ermilov.Op Fl M Cm mask | time
641bd10ba2SRuslan Ermilov.Op Fl m Ar ttl
651bd10ba2SRuslan Ermilov.Op Fl P Ar policy
661bd10ba2SRuslan Ermilov.Op Fl p Ar pattern
671bd10ba2SRuslan Ermilov.Op Fl S Ar src_addr
681bd10ba2SRuslan Ermilov.Op Fl s Ar packetsize
69f78ac61bSWarner Losh.Op Fl T Ar ttl
701bd10ba2SRuslan Ermilov.Op Fl t Ar timeout
711bd10ba2SRuslan Ermilov.Op Fl z Ar tos
72f78ac61bSWarner Losh.Ar mcast-group
738fae3551SRodney W. Grimes.Sh DESCRIPTION
74e1205e80SPhilippe CharnierThe
75e1205e80SPhilippe Charnier.Nm
76e1205e80SPhilippe Charnierutility uses the
778fae3551SRodney W. Grimes.Tn ICMP
7850ceac88SJohn-Mark Gurney.No protocol Ap s mandatory
798fae3551SRodney W. Grimes.Tn ECHO_REQUEST
808fae3551SRodney W. Grimesdatagram to elicit an
818fae3551SRodney W. Grimes.Tn ICMP ECHO_RESPONSE
828fae3551SRodney W. Grimesfrom a host or gateway.
838fae3551SRodney W. Grimes.Tn ECHO_REQUEST
8450ceac88SJohn-Mark Gurneydatagrams
8550ceac88SJohn-Mark Gurney.Pq Dq pings
8650ceac88SJohn-Mark Gurneyhave an IP and
878fae3551SRodney W. Grimes.Tn ICMP
8850ceac88SJohn-Mark Gurneyheader, followed by a
898fae3551SRodney W. Grimes.Dq struct timeval
9050ceac88SJohn-Mark Gurneyand then an arbitrary number of
9150ceac88SJohn-Mark Gurney.Dq pad
921f6a4631SRuslan Ermilovbytes used to fill out the packet.
931f6a4631SRuslan ErmilovThe options are as follows:
94e345a80dSPhilippe Charnier.Bl -tag -width indent
95ca517ad8SPoul-Henning Kamp.It Fl A
96ca517ad8SPoul-Henning KampAudible.
9725107197SIan DowseOutput a bell
98c4d9468eSRuslan Ermilov.Tn ( ASCII
99c4d9468eSRuslan Ermilov0x07)
10025107197SIan Dowsecharacter when no packet is received before the next packet
101ca517ad8SPoul-Henning Kampis transmitted.
10225107197SIan DowseTo cater for round-trip times that are longer than the interval
10325107197SIan Dowsebetween transmissions, further missing packets cause a bell only
10425107197SIan Dowseif the maximum number of unreceived packets has increased.
105772dfa72SDaniel O'Callaghan.It Fl a
106ef8f7ac9SSheldon HearnAudible.
107ef8f7ac9SSheldon HearnInclude a bell
108c4d9468eSRuslan Ermilov.Tn ( ASCII
109c4d9468eSRuslan Ermilov0x07)
110ef8f7ac9SSheldon Hearncharacter in the output when any packet is received.
111ef8f7ac9SSheldon HearnThis option is ignored
11250ceac88SJohn-Mark Gurneyif other format options are present.
1138fae3551SRodney W. Grimes.It Fl c Ar count
11450ceac88SJohn-Mark GurneyStop after sending
115c4d9468eSRuslan Ermilov(and receiving)
1168fae3551SRodney W. Grimes.Ar count
1178fae3551SRodney W. Grimes.Tn ECHO_RESPONSE
1180ed77db8SBruce Evanspackets.
1190ed77db8SBruce EvansIf this option is not specified,
1200ed77db8SBruce Evans.Nm
1210ed77db8SBruce Evanswill operate until interrupted.
1229ff95228SGleb SmirnoffIf this option is specified in conjunction with ping sweeps,
1239ff95228SGleb Smirnoffeach sweep will consist of
1249ff95228SGleb Smirnoff.Ar count
1259ff95228SGleb Smirnoffpackets.
1261f6a4631SRuslan Ermilov.It Fl D
1271f6a4631SRuslan ErmilovSet the Don't Fragment bit.
1288fae3551SRodney W. Grimes.It Fl d
1298fae3551SRodney W. GrimesSet the
1308fae3551SRodney W. Grimes.Dv SO_DEBUG
1318fae3551SRodney W. Grimesoption on the socket being used.
1328fae3551SRodney W. Grimes.It Fl f
1338fae3551SRodney W. GrimesFlood ping.
1348fae3551SRodney W. GrimesOutputs packets as fast as they come back or one hundred times per second,
1358fae3551SRodney W. Grimeswhichever is more.
1368fae3551SRodney W. GrimesFor every
1378fae3551SRodney W. Grimes.Tn ECHO_REQUEST
13850ceac88SJohn-Mark Gurneysent a period
1391252c1bbSRuslan Ermilov.Dq .\&
14050ceac88SJohn-Mark Gurneyis printed, while for every
1418fae3551SRodney W. Grimes.Tn ECHO_REPLY
1420ed77db8SBruce Evansreceived a backspace is printed.
1438fae3551SRodney W. GrimesThis provides a rapid display of how many packets are being dropped.
1448fae3551SRodney W. GrimesOnly the super-user may use this option.
1458fae3551SRodney W. Grimes.Bf -emphasis
1468fae3551SRodney W. GrimesThis can be very hard on a network and should be used with caution.
1478fae3551SRodney W. Grimes.Ef
1489ff95228SGleb Smirnoff.It Fl G Ar sweepmaxsize
1499ff95228SGleb SmirnoffSpecify the maximum size of
1509ff95228SGleb Smirnoff.Tn ICMP
1519ff95228SGleb Smirnoffpayload when sending sweeping pings.
1529ff95228SGleb SmirnoffThis option is required for ping sweeps.
1539ff95228SGleb Smirnoff.It Fl g Ar sweepminsize
1549ff95228SGleb SmirnoffSpecify the size of
1559ff95228SGleb Smirnoff.Tn ICMP
1569ff95228SGleb Smirnoffpayload to start with when sending sweeping pings.
1579ff95228SGleb SmirnoffThe default value is 0.
1589ff95228SGleb Smirnoff.It Fl h Ar sweepincrsize
1599ff95228SGleb SmirnoffSpecify the number of bytes to increment the size of
1609ff95228SGleb Smirnoff.Tn ICMP
1619ff95228SGleb Smirnoffpayload after
1629ff95228SGleb Smirnoffeach sweep when sending sweeping pings. The default value is 1.
1631bd10ba2SRuslan Ermilov.It Fl I Ar iface
1641f6a4631SRuslan ErmilovSource multicast packets with the given interface address.
1651f6a4631SRuslan ErmilovThis flag only applies if the ping destination is a multicast address.
1668fae3551SRodney W. Grimes.It Fl i Ar wait
1678fae3551SRodney W. GrimesWait
1688fae3551SRodney W. Grimes.Ar wait
1698fae3551SRodney W. Grimesseconds
1708fae3551SRodney W. Grimes.Em between sending each packet .
1710ed77db8SBruce EvansThe default is to wait for one second between each packet.
1720ed77db8SBruce EvansThe wait time may be fractional, but only the super-user may specify
173074ad115SRuslan Ermilovvalues less than 1 second.
1740ed77db8SBruce EvansThis option is incompatible with the
1758fae3551SRodney W. Grimes.Fl f
1768fae3551SRodney W. Grimesoption.
1771f6a4631SRuslan Ermilov.It Fl L
1781f6a4631SRuslan ErmilovSuppress loopback of multicast packets.
17985456935SBill FennerThis flag only applies if the ping destination is a multicast address.
1808fae3551SRodney W. Grimes.It Fl l Ar preload
1818fae3551SRodney W. GrimesIf
1828fae3551SRodney W. Grimes.Ar preload
1838fae3551SRodney W. Grimesis specified,
184e345a80dSPhilippe Charnier.Nm
1858fae3551SRodney W. Grimessends that many packets as fast as possible before falling into its normal
1868fae3551SRodney W. Grimesmode of behavior.
187ee2bf734SWarner LoshOnly the super-user may use this option.
1881bd10ba2SRuslan Ermilov.It Fl M Cm mask | time
1891bd10ba2SRuslan ErmilovUse
1901bd10ba2SRuslan Ermilov.Dv ICMP_MASKREQ
1911bd10ba2SRuslan Ermilovor
1921bd10ba2SRuslan Ermilov.Dv ICMP_TSTAMP
1931bd10ba2SRuslan Ermilovinstead of
1941bd10ba2SRuslan Ermilov.Dv ICMP_ECHO .
195eb1543c6SMatthew N. DoddFor
1961bd10ba2SRuslan Ermilov.Cm mask ,
1971bd10ba2SRuslan Ermilovprint the netmask of the remote machine.
1981bd10ba2SRuslan ErmilovSet the
1991bd10ba2SRuslan Ermilov.Va net.inet.icmp.maskrepl
2001bd10ba2SRuslan ErmilovMIB variable to enable
2011bd10ba2SRuslan Ermilov.Dv ICMP_MASKREPLY .
2021bd10ba2SRuslan ErmilovFor
2031bd10ba2SRuslan Ermilov.Cm time ,
2041fb474d8SMatthew N. Doddprint the origination, reception and transmission timestamps.
2059b085129SMatthew N. Dodd.It Fl m Ar ttl
2069b085129SMatthew N. DoddSet the IP Time To Live for outgoing packets.
2079b085129SMatthew N. DoddIf not specified, the kernel uses the value of the
2089b085129SMatthew N. Dodd.Va net.inet.ip.ttl
2099b085129SMatthew N. DoddMIB variable.
2108fae3551SRodney W. Grimes.It Fl n
2118fae3551SRodney W. GrimesNumeric output only.
2128fae3551SRodney W. GrimesNo attempt will be made to lookup symbolic names for host addresses.
2138025c44bSDima Dorfman.It Fl o
2148025c44bSDima DorfmanExit successfully after receiving one reply packet.
2151f6a4631SRuslan Ermilov.It Fl P Ar policy
2161f6a4631SRuslan Ermilov.Ar policy
2171f6a4631SRuslan Ermilovspecifies IPsec policy for the ping session.
2181f6a4631SRuslan ErmilovFor details please refer to
2191f6a4631SRuslan Ermilov.Xr ipsec 4
2201f6a4631SRuslan Ermilovand
2211f6a4631SRuslan Ermilov.Xr ipsec_set_policy 3 .
2228fae3551SRodney W. Grimes.It Fl p Ar pattern
22350ceac88SJohn-Mark GurneyYou may specify up to 16
22450ceac88SJohn-Mark Gurney.Dq pad
22550ceac88SJohn-Mark Gurneybytes to fill out the packet you send.
2268fae3551SRodney W. GrimesThis is useful for diagnosing data-dependent problems in a network.
2278fae3551SRodney W. GrimesFor example,
2288fae3551SRodney W. Grimes.Dq Li \-p ff
2298fae3551SRodney W. Grimeswill cause the sent packet to be filled with all
2308fae3551SRodney W. Grimesones.
231ef9e6dc7SBill Fenner.It Fl Q
232ef9e6dc7SBill FennerSomewhat quiet output.
23350ceac88SJohn-Mark Gurney.No Don Ap t
23450ceac88SJohn-Mark Gurneydisplay ICMP error messages that are in response to our query messages.
235ef9e6dc7SBill FennerOriginally, the
236ef9e6dc7SBill Fenner.Fl v
237ef9e6dc7SBill Fennerflag was required to display such errors, but
238ef9e6dc7SBill Fenner.Fl v
2391f6a4631SRuslan Ermilovdisplays all ICMP error messages.
2401f6a4631SRuslan ErmilovOn a busy machine, this output can be overbearing.
2411f6a4631SRuslan ErmilovWithout the
242ef9e6dc7SBill Fenner.Fl Q
243ef9e6dc7SBill Fennerflag,
244ef9e6dc7SBill Fenner.Nm
245ef9e6dc7SBill Fennerprints out any ICMP error messages caused by its own ECHO_REQUEST
246ef9e6dc7SBill Fennermessages.
2478fae3551SRodney W. Grimes.It Fl q
2488fae3551SRodney W. GrimesQuiet output.
2498fae3551SRodney W. GrimesNothing is displayed except the summary lines at startup time and
2508fae3551SRodney W. Grimeswhen finished.
2518fae3551SRodney W. Grimes.It Fl R
2528fae3551SRodney W. GrimesRecord route.
2538fae3551SRodney W. GrimesIncludes the
2548fae3551SRodney W. Grimes.Tn RECORD_ROUTE
2558fae3551SRodney W. Grimesoption in the
2568fae3551SRodney W. Grimes.Tn ECHO_REQUEST
2578fae3551SRodney W. Grimespacket and displays
2588fae3551SRodney W. Grimesthe route buffer on returned packets.
25943470e3bSGarrett WollmanNote that the IP header is only large enough for nine such routes;
26043470e3bSGarrett Wollmanthe
26143470e3bSGarrett Wollman.Xr traceroute 8
26243470e3bSGarrett Wollmancommand is usually better at determining the route packets take to a
26343470e3bSGarrett Wollmanparticular destination.
264c03e877aSWarner LoshIf more routes come back than should, such as due to an illegal spoofed
265c03e877aSWarner Loshpacket, ping will print the route list and then truncate it at the correct
266c03e877aSWarner Loshspot.
26743470e3bSGarrett WollmanMany hosts ignore or discard the
26843470e3bSGarrett Wollman.Tn RECORD_ROUTE
26943470e3bSGarrett Wollmanoption.
2708fae3551SRodney W. Grimes.It Fl r
2718fae3551SRodney W. GrimesBypass the normal routing tables and send directly to a host on an attached
2728fae3551SRodney W. Grimesnetwork.
2738fae3551SRodney W. GrimesIf the host is not on a directly-attached network, an error is returned.
2748fae3551SRodney W. GrimesThis option can be used to ping a local host through an interface
27550ceac88SJohn-Mark Gurneythat has no route through it
276c4d9468eSRuslan Ermilov(e.g., after the interface was dropped by
277c4d9468eSRuslan Ermilov.Xr routed 8 ) .
2781f6a4631SRuslan Ermilov.It Fl S Ar src_addr
2791f6a4631SRuslan ErmilovUse the following IP address as the source address in outgoing packets.
2801f6a4631SRuslan ErmilovOn hosts with more than one IP address, this option can be used to
2811f6a4631SRuslan Ermilovforce the source address to be something other than the IP address
2821f6a4631SRuslan Ermilovof the interface the probe packet is sent on.
2831f6a4631SRuslan ErmilovIf the IP address
2841f6a4631SRuslan Ermilovis not one of this machine's interface addresses, an error is
2851f6a4631SRuslan Ermilovreturned and nothing is sent.
2868fae3551SRodney W. Grimes.It Fl s Ar packetsize
287e345a80dSPhilippe CharnierSpecify the number of data bytes to be sent.
2888fae3551SRodney W. GrimesThe default is 56, which translates into 64
2898fae3551SRodney W. Grimes.Tn ICMP
2908fae3551SRodney W. Grimesdata bytes when combined
2918fae3551SRodney W. Grimeswith the 8 bytes of
2928fae3551SRodney W. Grimes.Tn ICMP
2930ed77db8SBruce Evansheader data.
294fb7d32c7SMaxim KonovalovOnly the super-user may specify values more than default.
2959ff95228SGleb SmirnoffThis option cannot be used with ping sweeps.
29685456935SBill Fenner.It Fl T Ar ttl
29785456935SBill FennerSet the IP Time To Live for multicasted packets.
29885456935SBill FennerThis flag only applies if the ping destination is a multicast address.
2991f6a4631SRuslan Ermilov.It Fl t Ar timeout
3001f6a4631SRuslan ErmilovSpecify a timeout, in seconds, before ping exits regardless of how
3011f6a4631SRuslan Ermilovmany packets have been received.
3028fae3551SRodney W. Grimes.It Fl v
3038fae3551SRodney W. GrimesVerbose output.
3048fae3551SRodney W. Grimes.Tn ICMP
3058fae3551SRodney W. Grimespackets other than
3068fae3551SRodney W. Grimes.Tn ECHO_RESPONSE
3078fae3551SRodney W. Grimesthat are received are listed.
3080b2f8b3fSMaxim Konovalov.It Fl z Ar tos
3090b2f8b3fSMaxim KonovalovUse the specified type of service.
3108fae3551SRodney W. Grimes.El
3118fae3551SRodney W. Grimes.Pp
3128fae3551SRodney W. GrimesWhen using
31350ceac88SJohn-Mark Gurney.Nm
3148fae3551SRodney W. Grimesfor fault isolation, it should first be run on the local host, to verify
3158fae3551SRodney W. Grimesthat the local network interface is up and running.
31650ceac88SJohn-Mark GurneyThen, hosts and gateways further and further away should be
31750ceac88SJohn-Mark Gurney.Dq pinged .
3188fae3551SRodney W. GrimesRound-trip times and packet loss statistics are computed.
3198fae3551SRodney W. GrimesIf duplicate packets are received, they are not included in the packet
3208fae3551SRodney W. Grimesloss calculation, although the round trip time of these packets is used
3213109a910SGarrett Wollmanin calculating the round-trip time statistics.
32250ceac88SJohn-Mark GurneyWhen the specified number of packets have been sent
323c4d9468eSRuslan Ermilov(and received)
32450ceac88SJohn-Mark Gurneyor if the program is terminated with a
3258fae3551SRodney W. Grimes.Dv SIGINT ,
3263109a910SGarrett Wollmana brief summary is displayed, showing the number of packets sent and
327605af08dSMaxim Konovalovreceived, and the minimum, mean, maximum, and standard deviation of
3283109a910SGarrett Wollmanthe round-trip times.
3298fae3551SRodney W. Grimes.Pp
330605af08dSMaxim KonovalovIf
331605af08dSMaxim Konovalov.Nm
332605af08dSMaxim Konovalovreceives a
333605af08dSMaxim Konovalov.Dv SIGINFO
334605af08dSMaxim Konovalov(see the
335605af08dSMaxim Konovalov.Cm status
336605af08dSMaxim Konovalovargument for
337605af08dSMaxim Konovalov.Xr stty 1 )
338605af08dSMaxim Konovalovsignal, the current number of packets sent and received, and the
339605af08dSMaxim Konovalovminimum, mean, and maximum of the round-trip times will be written to
340605af08dSMaxim Konovalovthe standard error output.
341605af08dSMaxim Konovalov.Pp
3428fae3551SRodney W. GrimesThis program is intended for use in network testing, measurement and
3438fae3551SRodney W. Grimesmanagement.
3448fae3551SRodney W. GrimesBecause of the load it can impose on the network, it is unwise to use
34550ceac88SJohn-Mark Gurney.Nm
3468fae3551SRodney W. Grimesduring normal operations or from automated scripts.
3478fae3551SRodney W. Grimes.Sh ICMP PACKET DETAILS
3488fae3551SRodney W. GrimesAn IP header without options is 20 bytes.
3498fae3551SRodney W. GrimesAn
3508fae3551SRodney W. Grimes.Tn ICMP
3518fae3551SRodney W. Grimes.Tn ECHO_REQUEST
35250ceac88SJohn-Mark Gurneypacket contains an additional 8 bytes worth of
3538fae3551SRodney W. Grimes.Tn ICMP
3548fae3551SRodney W. Grimesheader followed by an arbitrary amount of data.
3558fae3551SRodney W. GrimesWhen a
3568fae3551SRodney W. Grimes.Ar packetsize
35750ceac88SJohn-Mark Gurneyis given, this indicated the size of this extra piece of data
358c4d9468eSRuslan Ermilov(the default is 56).
3598fae3551SRodney W. GrimesThus the amount of data received inside of an IP packet of type
3608fae3551SRodney W. Grimes.Tn ICMP
3618fae3551SRodney W. Grimes.Tn ECHO_REPLY
3628fae3551SRodney W. Grimeswill always be 8 bytes more than the requested data space
363c4d9468eSRuslan Ermilov(the
364c4d9468eSRuslan Ermilov.Tn ICMP
365c4d9468eSRuslan Ermilovheader).
3668fae3551SRodney W. Grimes.Pp
3678fae3551SRodney W. GrimesIf the data space is at least eight bytes large,
36850ceac88SJohn-Mark Gurney.Nm
3698fae3551SRodney W. Grimesuses the first eight bytes of this space to include a timestamp which
3708fae3551SRodney W. Grimesit uses in the computation of round trip times.
3718fae3551SRodney W. GrimesIf less than eight bytes of pad are specified, no round trip times are
3728fae3551SRodney W. Grimesgiven.
3738fae3551SRodney W. Grimes.Sh DUPLICATE AND DAMAGED PACKETS
374e1205e80SPhilippe CharnierThe
375e1205e80SPhilippe Charnier.Nm
376e1205e80SPhilippe Charnierutility will report duplicate and damaged packets.
37785456935SBill FennerDuplicate packets should never occur when pinging a unicast address,
37885456935SBill Fennerand seem to be caused by
3798fae3551SRodney W. Grimesinappropriate link-level retransmissions.
38050ceac88SJohn-Mark GurneyDuplicates may occur in many situations and are rarely
381c4d9468eSRuslan Ermilov(if ever)
38250ceac88SJohn-Mark Gurneya good sign, although the presence of low levels of duplicates may not
3838fae3551SRodney W. Grimesalways be cause for alarm.
38485456935SBill FennerDuplicates are expected when pinging a broadcast or multicast address,
38585456935SBill Fennersince they are not really duplicates but replies from different hosts
38685456935SBill Fennerto the same request.
3878fae3551SRodney W. Grimes.Pp
3888fae3551SRodney W. GrimesDamaged packets are obviously serious cause for alarm and often
3898fae3551SRodney W. Grimesindicate broken hardware somewhere in the
390e345a80dSPhilippe Charnier.Nm
3913109a910SGarrett Wollmanpacket's path (in the network or in the hosts).
3928fae3551SRodney W. Grimes.Sh TRYING DIFFERENT DATA PATTERNS
39350ceac88SJohn-Mark GurneyThe
3943109a910SGarrett Wollman(inter)network
39550ceac88SJohn-Mark Gurneylayer should never treat packets differently depending on the data
39650ceac88SJohn-Mark Gurneycontained in the data portion.
3978fae3551SRodney W. GrimesUnfortunately, data-dependent problems have been known to sneak into
3988fae3551SRodney W. Grimesnetworks and remain undetected for long periods of time.
3998fae3551SRodney W. GrimesIn many cases the particular pattern that will have problems is something
4003109a910SGarrett Wollmanthat does not have sufficient
40150ceac88SJohn-Mark Gurney.Dq transitions ,
40250ceac88SJohn-Mark Gurneysuch as all ones or all zeros, or a pattern right at the edge, such as
40350ceac88SJohn-Mark Gurneyalmost all zeros.
4043109a910SGarrett WollmanIt is not
4053109a910SGarrett Wollmannecessarily enough to specify a data pattern of all zeros (for example)
40650ceac88SJohn-Mark Gurneyon the command line because the pattern that is of interest is
4078fae3551SRodney W. Grimesat the data link level, and the relationship between what you type and
4088fae3551SRodney W. Grimeswhat the controllers transmit can be complicated.
4098fae3551SRodney W. Grimes.Pp
4108fae3551SRodney W. GrimesThis means that if you have a data-dependent problem you will probably
4118fae3551SRodney W. Grimeshave to do a lot of testing to find it.
41250ceac88SJohn-Mark GurneyIf you are lucky, you may manage to find a file that either
4133109a910SGarrett Wollmancannot
41450ceac88SJohn-Mark Gurneybe sent across your network or that takes much longer to transfer than
41550ceac88SJohn-Mark Gurneyother similar length files.
4168fae3551SRodney W. GrimesYou can then examine this file for repeated patterns that you can test
4178fae3551SRodney W. Grimesusing the
4188fae3551SRodney W. Grimes.Fl p
4198fae3551SRodney W. Grimesoption of
4207c7fb079SRuslan Ermilov.Nm .
4218fae3551SRodney W. Grimes.Sh TTL DETAILS
4228fae3551SRodney W. GrimesThe
4238fae3551SRodney W. Grimes.Tn TTL
4248fae3551SRodney W. Grimesvalue of an IP packet represents the maximum number of IP routers
4258fae3551SRodney W. Grimesthat the packet can go through before being thrown away.
4268fae3551SRodney W. GrimesIn current practice you can expect each router in the Internet to decrement
4278fae3551SRodney W. Grimesthe
4288fae3551SRodney W. Grimes.Tn TTL
4298fae3551SRodney W. Grimesfield by exactly one.
4308fae3551SRodney W. Grimes.Pp
4318fae3551SRodney W. GrimesThe
4328fae3551SRodney W. Grimes.Tn TCP/IP
433a70dc556SRuslan Ermilovspecification recommends setting the
4348fae3551SRodney W. Grimes.Tn TTL
4358fae3551SRodney W. Grimesfield for
436a70dc556SRuslan Ermilov.Tn IP
437a70dc556SRuslan Ermilovpackets to 64, but many systems use smaller values
438c4d9468eSRuslan Ermilov.No ( Bx 4.3
4393109a910SGarrett Wollmanuses 30,
4403109a910SGarrett Wollman.Bx 4.2
441c4d9468eSRuslan Ermilovused 15).
4428fae3551SRodney W. Grimes.Pp
443e345a80dSPhilippe CharnierThe maximum possible value of this field is 255, and most
444e345a80dSPhilippe Charnier.Ux
445e345a80dSPhilippe Charniersystems set
4468fae3551SRodney W. Grimesthe
4478fae3551SRodney W. Grimes.Tn TTL
4488fae3551SRodney W. Grimesfield of
4498fae3551SRodney W. Grimes.Tn ICMP ECHO_REQUEST
4508fae3551SRodney W. Grimespackets to 255.
45150ceac88SJohn-Mark GurneyThis is why you will find you can
45250ceac88SJohn-Mark Gurney.Dq ping
45350ceac88SJohn-Mark Gurneysome hosts, but not reach them with
4548fae3551SRodney W. Grimes.Xr telnet 1
4558fae3551SRodney W. Grimesor
4568fae3551SRodney W. Grimes.Xr ftp 1 .
4578fae3551SRodney W. Grimes.Pp
458e345a80dSPhilippe CharnierIn normal operation
459e345a80dSPhilippe Charnier.Nm
460e345a80dSPhilippe Charnierprints the ttl value from the packet it receives.
4618fae3551SRodney W. GrimesWhen a remote system receives a ping packet, it can do one of three things
4628fae3551SRodney W. Grimeswith the
4638fae3551SRodney W. Grimes.Tn TTL
4648fae3551SRodney W. Grimesfield in its response:
4658fae3551SRodney W. Grimes.Bl -bullet
4668fae3551SRodney W. Grimes.It
467e345a80dSPhilippe CharnierNot change it; this is what
468e345a80dSPhilippe Charnier.Bx
469e345a80dSPhilippe Charniersystems did before the
4708fae3551SRodney W. Grimes.Bx 4.3 tahoe
4718fae3551SRodney W. Grimesrelease.
4728fae3551SRodney W. GrimesIn this case the
4738fae3551SRodney W. Grimes.Tn TTL
4748fae3551SRodney W. Grimesvalue in the received packet will be 255 minus the
4758fae3551SRodney W. Grimesnumber of routers in the round-trip path.
4768fae3551SRodney W. Grimes.It
4773109a910SGarrett WollmanSet it to 255; this is what current
478e345a80dSPhilippe Charnier.Bx
4793109a910SGarrett Wollmansystems do.
4808fae3551SRodney W. GrimesIn this case the
4818fae3551SRodney W. Grimes.Tn TTL
4828fae3551SRodney W. Grimesvalue in the received packet will be 255 minus the
4838fae3551SRodney W. Grimesnumber of routers in the path
48450ceac88SJohn-Mark Gurney.Em from
4858fae3551SRodney W. Grimesthe remote system
4868fae3551SRodney W. Grimes.Em to
4878fae3551SRodney W. Grimesthe
48850ceac88SJohn-Mark Gurney.Nm Ns Em ing
4898fae3551SRodney W. Grimeshost.
4908fae3551SRodney W. Grimes.It
4918fae3551SRodney W. GrimesSet it to some other value.
4928fae3551SRodney W. GrimesSome machines use the same value for
4938fae3551SRodney W. Grimes.Tn ICMP
4948fae3551SRodney W. Grimespackets that they use for
4958fae3551SRodney W. Grimes.Tn TCP
4968fae3551SRodney W. Grimespackets, for example either 30 or 60.
4978fae3551SRodney W. GrimesOthers may use completely wild values.
4988fae3551SRodney W. Grimes.El
49943470e3bSGarrett Wollman.Sh RETURN VALUES
50043470e3bSGarrett WollmanThe
50150ceac88SJohn-Mark Gurney.Nm
502e1205e80SPhilippe Charnierutility returns an exit status of zero if at least one response was
50343470e3bSGarrett Wollmanheard from the specified
50443470e3bSGarrett Wollman.Ar host ;
50543470e3bSGarrett Wollmana status of two if the transmission was successful but no responses
50643470e3bSGarrett Wollmanwere received; or another value
507c4d9468eSRuslan Ermilov(from
508fe08efe6SRuslan Ermilov.In sysexits.h )
50943470e3bSGarrett Wollmanif an error occurred.
51043470e3bSGarrett Wollman.Sh SEE ALSO
51143470e3bSGarrett Wollman.Xr netstat 1 ,
51243470e3bSGarrett Wollman.Xr ifconfig 8 ,
51343470e3bSGarrett Wollman.Xr routed 8 ,
51443470e3bSGarrett Wollman.Xr traceroute 8
51543470e3bSGarrett Wollman.Sh HISTORY
51643470e3bSGarrett WollmanThe
51743470e3bSGarrett Wollman.Nm
518e1205e80SPhilippe Charnierutility appeared in
51943470e3bSGarrett Wollman.Bx 4.3 .
52043470e3bSGarrett Wollman.Sh AUTHORS
52143470e3bSGarrett WollmanThe original
52243470e3bSGarrett Wollman.Nm
523e1205e80SPhilippe Charnierutility was written by
52468085a0eSPhilippe Charnier.An Mike Muuss
52568085a0eSPhilippe Charnierwhile at the US Army Ballistics
52643470e3bSGarrett WollmanResearch Laboratory.
5278fae3551SRodney W. Grimes.Sh BUGS
5288fae3551SRodney W. GrimesMany Hosts and Gateways ignore the
5298fae3551SRodney W. Grimes.Tn RECORD_ROUTE
5308fae3551SRodney W. Grimesoption.
5318fae3551SRodney W. Grimes.Pp
5328fae3551SRodney W. GrimesThe maximum IP header length is too small for options like
5338fae3551SRodney W. Grimes.Tn RECORD_ROUTE
53450ceac88SJohn-Mark Gurneyto be completely useful.
53550ceac88SJohn-Mark Gurney.No There Ap s
53650ceac88SJohn-Mark Gurneynot much that can be done about this, however.
5378fae3551SRodney W. Grimes.Pp
5388fae3551SRodney W. GrimesFlood pinging is not recommended in general, and flood pinging the
5398fae3551SRodney W. Grimesbroadcast address should only be done under very controlled conditions.
540ef9e6dc7SBill Fenner.Pp
541ef9e6dc7SBill FennerThe
542ef9e6dc7SBill Fenner.Fl v
543ef9e6dc7SBill Fenneroption is not worth much on busy hosts.
544