xref: /freebsd/sbin/ping/ping.8 (revision 81a6f4c7ae69d0f3acf564418b3a38153df6f26d)
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.
12fbbd9655SWarner Losh.\" 3. 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.\"
31*81a6f4c7SRichard Scheffenegger.Dd October 2, 2020
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
4199f13ae1SAlan Somers.Op Fl AaDdfHnoQqRrv
42*81a6f4c7SRichard Scheffenegger.Op Fl C Ar pcp
438fae3551SRodney W. Grimes.Op Fl c Ar count
449ff95228SGleb Smirnoff.Op Fl G Ar sweepmaxsize
459ff95228SGleb Smirnoff.Op Fl g Ar sweepminsize
469ff95228SGleb Smirnoff.Op Fl h Ar sweepincrsize
478fae3551SRodney W. Grimes.Op Fl i Ar wait
488fae3551SRodney W. Grimes.Op Fl l Ar preload
491bd10ba2SRuslan Ermilov.Op Fl M Cm mask | time
50211bfbd2SRuslan Ermilov.Op Fl m Ar ttl
519a4365d0SYoshinobu Inoue.Op Fl P Ar policy
521f6a4631SRuslan Ermilov.Op Fl p Ar pattern
5399490edeSWarner Losh.Op Fl S Ar src_addr
541f6a4631SRuslan Ermilov.Op Fl s Ar packetsize
55bf113f1bSBill Fumerola.Op Fl t Ar timeout
56d6cd1497SGleb Smirnoff.Op Fl W Ar waittime
570b2f8b3fSMaxim Konovalov.Op Fl z Ar tos
581bd10ba2SRuslan Ermilov.Ar host
591bd10ba2SRuslan Ermilov.Nm
6099f13ae1SAlan Somers.Op Fl AaDdfHLnoQqRrv
61*81a6f4c7SRichard Scheffenegger.Op Fl C Ar pcp
621bd10ba2SRuslan Ermilov.Op Fl c Ar count
631bd10ba2SRuslan Ermilov.Op Fl I Ar iface
641bd10ba2SRuslan Ermilov.Op Fl i Ar wait
651bd10ba2SRuslan Ermilov.Op Fl l Ar preload
661bd10ba2SRuslan Ermilov.Op Fl M Cm mask | time
671bd10ba2SRuslan Ermilov.Op Fl m Ar ttl
681bd10ba2SRuslan Ermilov.Op Fl P Ar policy
691bd10ba2SRuslan Ermilov.Op Fl p Ar pattern
701bd10ba2SRuslan Ermilov.Op Fl S Ar src_addr
711bd10ba2SRuslan Ermilov.Op Fl s Ar packetsize
72f78ac61bSWarner Losh.Op Fl T Ar ttl
731bd10ba2SRuslan Ermilov.Op Fl t Ar timeout
74d6cd1497SGleb Smirnoff.Op Fl W Ar waittime
751bd10ba2SRuslan Ermilov.Op Fl z Ar tos
76f78ac61bSWarner Losh.Ar mcast-group
778fae3551SRodney W. Grimes.Sh DESCRIPTION
78e1205e80SPhilippe CharnierThe
79e1205e80SPhilippe Charnier.Nm
80e1205e80SPhilippe Charnierutility uses the
818fae3551SRodney W. Grimes.Tn ICMP
8250ceac88SJohn-Mark Gurney.No protocol Ap s mandatory
838fae3551SRodney W. Grimes.Tn ECHO_REQUEST
848fae3551SRodney W. Grimesdatagram to elicit an
858fae3551SRodney W. Grimes.Tn ICMP ECHO_RESPONSE
868fae3551SRodney W. Grimesfrom a host or gateway.
878fae3551SRodney W. Grimes.Tn ECHO_REQUEST
8850ceac88SJohn-Mark Gurneydatagrams
8950ceac88SJohn-Mark Gurney.Pq Dq pings
9050ceac88SJohn-Mark Gurneyhave an IP and
918fae3551SRodney W. Grimes.Tn ICMP
9250ceac88SJohn-Mark Gurneyheader, followed by a
938fae3551SRodney W. Grimes.Dq struct timeval
9450ceac88SJohn-Mark Gurneyand then an arbitrary number of
9550ceac88SJohn-Mark Gurney.Dq pad
961f6a4631SRuslan Ermilovbytes used to fill out the packet.
971f6a4631SRuslan ErmilovThe options are as follows:
98e345a80dSPhilippe Charnier.Bl -tag -width indent
99ca517ad8SPoul-Henning Kamp.It Fl A
100ca517ad8SPoul-Henning KampAudible.
10125107197SIan DowseOutput a bell
102c4d9468eSRuslan Ermilov.Tn ( ASCII
103c4d9468eSRuslan Ermilov0x07)
10425107197SIan Dowsecharacter when no packet is received before the next packet
105ca517ad8SPoul-Henning Kampis transmitted.
10625107197SIan DowseTo cater for round-trip times that are longer than the interval
10725107197SIan Dowsebetween transmissions, further missing packets cause a bell only
10825107197SIan Dowseif the maximum number of unreceived packets has increased.
109772dfa72SDaniel O'Callaghan.It Fl a
110ef8f7ac9SSheldon HearnAudible.
111ef8f7ac9SSheldon HearnInclude a bell
112c4d9468eSRuslan Ermilov.Tn ( ASCII
113c4d9468eSRuslan Ermilov0x07)
114ef8f7ac9SSheldon Hearncharacter in the output when any packet is received.
115ef8f7ac9SSheldon HearnThis option is ignored
11650ceac88SJohn-Mark Gurneyif other format options are present.
117*81a6f4c7SRichard Scheffenegger.It Fl C Ar pcp
118*81a6f4c7SRichard ScheffeneggerAdd an 802.1p Ethernet Priority Code Point when sending a packet.
119*81a6f4c7SRichard Scheffenegger0..7 uses that specific PCP, -1 uses the interface default PCP (or none).
1208fae3551SRodney W. Grimes.It Fl c Ar count
12150ceac88SJohn-Mark GurneyStop after sending
122c4d9468eSRuslan Ermilov(and receiving)
1238fae3551SRodney W. Grimes.Ar count
1248fae3551SRodney W. Grimes.Tn ECHO_RESPONSE
1250ed77db8SBruce Evanspackets.
1260ed77db8SBruce EvansIf this option is not specified,
1270ed77db8SBruce Evans.Nm
1280ed77db8SBruce Evanswill operate until interrupted.
1299ff95228SGleb SmirnoffIf this option is specified in conjunction with ping sweeps,
1309ff95228SGleb Smirnoffeach sweep will consist of
1319ff95228SGleb Smirnoff.Ar count
1329ff95228SGleb Smirnoffpackets.
1331f6a4631SRuslan Ermilov.It Fl D
1341f6a4631SRuslan ErmilovSet the Don't Fragment bit.
1358fae3551SRodney W. Grimes.It Fl d
1368fae3551SRodney W. GrimesSet the
1378fae3551SRodney W. Grimes.Dv SO_DEBUG
1388fae3551SRodney W. Grimesoption on the socket being used.
1398fae3551SRodney W. Grimes.It Fl f
1408fae3551SRodney W. GrimesFlood ping.
1418fae3551SRodney W. GrimesOutputs packets as fast as they come back or one hundred times per second,
1428fae3551SRodney W. Grimeswhichever is more.
1438fae3551SRodney W. GrimesFor every
1448fae3551SRodney W. Grimes.Tn ECHO_REQUEST
14550ceac88SJohn-Mark Gurneysent a period
1461252c1bbSRuslan Ermilov.Dq .\&
14750ceac88SJohn-Mark Gurneyis printed, while for every
1488fae3551SRodney W. Grimes.Tn ECHO_REPLY
1490ed77db8SBruce Evansreceived a backspace is printed.
1508fae3551SRodney W. GrimesThis provides a rapid display of how many packets are being dropped.
1518fae3551SRodney W. GrimesOnly the super-user may use this option.
1528fae3551SRodney W. Grimes.Bf -emphasis
1538fae3551SRodney W. GrimesThis can be very hard on a network and should be used with caution.
1548fae3551SRodney W. Grimes.Ef
1559ff95228SGleb Smirnoff.It Fl G Ar sweepmaxsize
1569ff95228SGleb SmirnoffSpecify the maximum size of
1579ff95228SGleb Smirnoff.Tn ICMP
1589ff95228SGleb Smirnoffpayload when sending sweeping pings.
1599ff95228SGleb SmirnoffThis option is required for ping sweeps.
1609ff95228SGleb Smirnoff.It Fl g Ar sweepminsize
1619ff95228SGleb SmirnoffSpecify the size of
1629ff95228SGleb Smirnoff.Tn ICMP
1639ff95228SGleb Smirnoffpayload to start with when sending sweeping pings.
1649ff95228SGleb SmirnoffThe default value is 0.
16599f13ae1SAlan Somers.It Fl H
16699f13ae1SAlan SomersHostname output.
16799f13ae1SAlan SomersTry to do a reverse DNS lookup when displaying addresses.
168299e2c58SAlan SomersThis is the opposite of the
169299e2c58SAlan Somers.Fl n
170299e2c58SAlan Somersoption.
1719ff95228SGleb Smirnoff.It Fl h Ar sweepincrsize
1729ff95228SGleb SmirnoffSpecify the number of bytes to increment the size of
1739ff95228SGleb Smirnoff.Tn ICMP
1749ff95228SGleb Smirnoffpayload after
1754e9e907dSRuslan Ermiloveach sweep when sending sweeping pings.
1764e9e907dSRuslan ErmilovThe default value is 1.
1771bd10ba2SRuslan Ermilov.It Fl I Ar iface
1781f6a4631SRuslan ErmilovSource multicast packets with the given interface address.
1791f6a4631SRuslan ErmilovThis flag only applies if the ping destination is a multicast address.
1808fae3551SRodney W. Grimes.It Fl i Ar wait
1818fae3551SRodney W. GrimesWait
1828fae3551SRodney W. Grimes.Ar wait
1838fae3551SRodney W. Grimesseconds
1848fae3551SRodney W. Grimes.Em between sending each packet .
1850ed77db8SBruce EvansThe default is to wait for one second between each packet.
1860ed77db8SBruce EvansThe wait time may be fractional, but only the super-user may specify
187074ad115SRuslan Ermilovvalues less than 1 second.
1880ed77db8SBruce EvansThis option is incompatible with the
1898fae3551SRodney W. Grimes.Fl f
1908fae3551SRodney W. Grimesoption.
1911f6a4631SRuslan Ermilov.It Fl L
1921f6a4631SRuslan ErmilovSuppress loopback of multicast packets.
19385456935SBill FennerThis flag only applies if the ping destination is a multicast address.
1948fae3551SRodney W. Grimes.It Fl l Ar preload
1958fae3551SRodney W. GrimesIf
1968fae3551SRodney W. Grimes.Ar preload
1978fae3551SRodney W. Grimesis specified,
198e345a80dSPhilippe Charnier.Nm
1998fae3551SRodney W. Grimessends that many packets as fast as possible before falling into its normal
2008fae3551SRodney W. Grimesmode of behavior.
201ee2bf734SWarner LoshOnly the super-user may use this option.
2021bd10ba2SRuslan Ermilov.It Fl M Cm mask | time
2031bd10ba2SRuslan ErmilovUse
2041bd10ba2SRuslan Ermilov.Dv ICMP_MASKREQ
2051bd10ba2SRuslan Ermilovor
2061bd10ba2SRuslan Ermilov.Dv ICMP_TSTAMP
2071bd10ba2SRuslan Ermilovinstead of
2081bd10ba2SRuslan Ermilov.Dv ICMP_ECHO .
209eb1543c6SMatthew N. DoddFor
2101bd10ba2SRuslan Ermilov.Cm mask ,
2111bd10ba2SRuslan Ermilovprint the netmask of the remote machine.
2121bd10ba2SRuslan ErmilovSet the
2131bd10ba2SRuslan Ermilov.Va net.inet.icmp.maskrepl
2141bd10ba2SRuslan ErmilovMIB variable to enable
2154323cae0SMaxim Konovalov.Dv ICMP_MASKREPLY
2164323cae0SMaxim Konovalovand
2174323cae0SMaxim Konovalov.Va net.inet.icmp.maskfake
2184323cae0SMaxim Konovalovif you want to override the netmask in the response.
2191bd10ba2SRuslan ErmilovFor
2201bd10ba2SRuslan Ermilov.Cm time ,
2211fb474d8SMatthew N. Doddprint the origination, reception and transmission timestamps.
2224323cae0SMaxim KonovalovSet the
2234323cae0SMaxim Konovalov.Va net.inet.icmp.tstamprepl
2244323cae0SMaxim KonovalovMIB variable to enable or disable
2254323cae0SMaxim Konovalov.Dv ICMP_TSTAMPREPLY .
2269b085129SMatthew N. Dodd.It Fl m Ar ttl
2279b085129SMatthew N. DoddSet the IP Time To Live for outgoing packets.
2289b085129SMatthew N. DoddIf not specified, the kernel uses the value of the
2299b085129SMatthew N. Dodd.Va net.inet.ip.ttl
2309b085129SMatthew N. DoddMIB variable.
2318fae3551SRodney W. Grimes.It Fl n
2328fae3551SRodney W. GrimesNumeric output only.
2338fae3551SRodney W. GrimesNo attempt will be made to lookup symbolic names for host addresses.
234299e2c58SAlan SomersThis is the opposite of
235299e2c58SAlan Somers.Fl H ,
236299e2c58SAlan Somersand it is the default behavior.
2378025c44bSDima Dorfman.It Fl o
2388025c44bSDima DorfmanExit successfully after receiving one reply packet.
2391f6a4631SRuslan Ermilov.It Fl P Ar policy
2401f6a4631SRuslan Ermilov.Ar policy
2411f6a4631SRuslan Ermilovspecifies IPsec policy for the ping session.
2421f6a4631SRuslan ErmilovFor details please refer to
2431f6a4631SRuslan Ermilov.Xr ipsec 4
2441f6a4631SRuslan Ermilovand
2451f6a4631SRuslan Ermilov.Xr ipsec_set_policy 3 .
2468fae3551SRodney W. Grimes.It Fl p Ar pattern
24750ceac88SJohn-Mark GurneyYou may specify up to 16
24850ceac88SJohn-Mark Gurney.Dq pad
24950ceac88SJohn-Mark Gurneybytes to fill out the packet you send.
2508fae3551SRodney W. GrimesThis is useful for diagnosing data-dependent problems in a network.
2518fae3551SRodney W. GrimesFor example,
2528fae3551SRodney W. Grimes.Dq Li \-p ff
2538fae3551SRodney W. Grimeswill cause the sent packet to be filled with all
2548fae3551SRodney W. Grimesones.
255ef9e6dc7SBill Fenner.It Fl Q
256ef9e6dc7SBill FennerSomewhat quiet output.
25750ceac88SJohn-Mark Gurney.No Don Ap t
25850ceac88SJohn-Mark Gurneydisplay ICMP error messages that are in response to our query messages.
259ef9e6dc7SBill FennerOriginally, the
260ef9e6dc7SBill Fenner.Fl v
261ef9e6dc7SBill Fennerflag was required to display such errors, but
262ef9e6dc7SBill Fenner.Fl v
2631f6a4631SRuslan Ermilovdisplays all ICMP error messages.
2641f6a4631SRuslan ErmilovOn a busy machine, this output can be overbearing.
2651f6a4631SRuslan ErmilovWithout the
266ef9e6dc7SBill Fenner.Fl Q
267ef9e6dc7SBill Fennerflag,
268ef9e6dc7SBill Fenner.Nm
269ef9e6dc7SBill Fennerprints out any ICMP error messages caused by its own ECHO_REQUEST
270ef9e6dc7SBill Fennermessages.
2718fae3551SRodney W. Grimes.It Fl q
2728fae3551SRodney W. GrimesQuiet output.
2738fae3551SRodney W. GrimesNothing is displayed except the summary lines at startup time and
2748fae3551SRodney W. Grimeswhen finished.
2758fae3551SRodney W. Grimes.It Fl R
2768fae3551SRodney W. GrimesRecord route.
2778fae3551SRodney W. GrimesIncludes the
2788fae3551SRodney W. Grimes.Tn RECORD_ROUTE
2798fae3551SRodney W. Grimesoption in the
2808fae3551SRodney W. Grimes.Tn ECHO_REQUEST
2818fae3551SRodney W. Grimespacket and displays
2828fae3551SRodney W. Grimesthe route buffer on returned packets.
28343470e3bSGarrett WollmanNote that the IP header is only large enough for nine such routes;
28443470e3bSGarrett Wollmanthe
28543470e3bSGarrett Wollman.Xr traceroute 8
28643470e3bSGarrett Wollmancommand is usually better at determining the route packets take to a
28743470e3bSGarrett Wollmanparticular destination.
288c03e877aSWarner LoshIf more routes come back than should, such as due to an illegal spoofed
289c03e877aSWarner Loshpacket, ping will print the route list and then truncate it at the correct
290c03e877aSWarner Loshspot.
29143470e3bSGarrett WollmanMany hosts ignore or discard the
29243470e3bSGarrett Wollman.Tn RECORD_ROUTE
29343470e3bSGarrett Wollmanoption.
2948fae3551SRodney W. Grimes.It Fl r
2958fae3551SRodney W. GrimesBypass the normal routing tables and send directly to a host on an attached
2968fae3551SRodney W. Grimesnetwork.
2978fae3551SRodney W. GrimesIf the host is not on a directly-attached network, an error is returned.
2988fae3551SRodney W. GrimesThis option can be used to ping a local host through an interface
29950ceac88SJohn-Mark Gurneythat has no route through it
300c4d9468eSRuslan Ermilov(e.g., after the interface was dropped by
301c4d9468eSRuslan Ermilov.Xr routed 8 ) .
3021f6a4631SRuslan Ermilov.It Fl S Ar src_addr
3031f6a4631SRuslan ErmilovUse the following IP address as the source address in outgoing packets.
3041f6a4631SRuslan ErmilovOn hosts with more than one IP address, this option can be used to
3051f6a4631SRuslan Ermilovforce the source address to be something other than the IP address
3061f6a4631SRuslan Ermilovof the interface the probe packet is sent on.
3071f6a4631SRuslan ErmilovIf the IP address
3081f6a4631SRuslan Ermilovis not one of this machine's interface addresses, an error is
3091f6a4631SRuslan Ermilovreturned and nothing is sent.
3108fae3551SRodney W. Grimes.It Fl s Ar packetsize
311e345a80dSPhilippe CharnierSpecify the number of data bytes to be sent.
3128fae3551SRodney W. GrimesThe default is 56, which translates into 64
3138fae3551SRodney W. Grimes.Tn ICMP
3148fae3551SRodney W. Grimesdata bytes when combined
3158fae3551SRodney W. Grimeswith the 8 bytes of
3168fae3551SRodney W. Grimes.Tn ICMP
3170ed77db8SBruce Evansheader data.
318fb7d32c7SMaxim KonovalovOnly the super-user may specify values more than default.
3199ff95228SGleb SmirnoffThis option cannot be used with ping sweeps.
32085456935SBill Fenner.It Fl T Ar ttl
32185456935SBill FennerSet the IP Time To Live for multicasted packets.
32285456935SBill FennerThis flag only applies if the ping destination is a multicast address.
3231f6a4631SRuslan Ermilov.It Fl t Ar timeout
3241f6a4631SRuslan ErmilovSpecify a timeout, in seconds, before ping exits regardless of how
3251f6a4631SRuslan Ermilovmany packets have been received.
3268fae3551SRodney W. Grimes.It Fl v
3278fae3551SRodney W. GrimesVerbose output.
3288fae3551SRodney W. Grimes.Tn ICMP
3298fae3551SRodney W. Grimespackets other than
3308fae3551SRodney W. Grimes.Tn ECHO_RESPONSE
3318fae3551SRodney W. Grimesthat are received are listed.
332d6cd1497SGleb Smirnoff.It Fl W Ar waittime
333d6cd1497SGleb SmirnoffTime in milliseconds to wait for a reply for each packet sent.
334d6cd1497SGleb SmirnoffIf a reply arrives later, the packet is not printed as replied, but
335d6cd1497SGleb Smirnoffconsidered as replied when calculating statistics.
3360b2f8b3fSMaxim Konovalov.It Fl z Ar tos
3370b2f8b3fSMaxim KonovalovUse the specified type of service.
3388fae3551SRodney W. Grimes.El
3398fae3551SRodney W. Grimes.Pp
3408fae3551SRodney W. GrimesWhen using
34150ceac88SJohn-Mark Gurney.Nm
3428fae3551SRodney W. Grimesfor fault isolation, it should first be run on the local host, to verify
3438fae3551SRodney W. Grimesthat the local network interface is up and running.
34450ceac88SJohn-Mark GurneyThen, hosts and gateways further and further away should be
34550ceac88SJohn-Mark Gurney.Dq pinged .
3468fae3551SRodney W. GrimesRound-trip times and packet loss statistics are computed.
3478fae3551SRodney W. GrimesIf duplicate packets are received, they are not included in the packet
3488fae3551SRodney W. Grimesloss calculation, although the round trip time of these packets is used
3493109a910SGarrett Wollmanin calculating the round-trip time statistics.
35050ceac88SJohn-Mark GurneyWhen the specified number of packets have been sent
351c4d9468eSRuslan Ermilov(and received)
35250ceac88SJohn-Mark Gurneyor if the program is terminated with a
3538fae3551SRodney W. Grimes.Dv SIGINT ,
3543109a910SGarrett Wollmana brief summary is displayed, showing the number of packets sent and
355605af08dSMaxim Konovalovreceived, and the minimum, mean, maximum, and standard deviation of
3563109a910SGarrett Wollmanthe round-trip times.
3578fae3551SRodney W. Grimes.Pp
358605af08dSMaxim KonovalovIf
359605af08dSMaxim Konovalov.Nm
360605af08dSMaxim Konovalovreceives a
361605af08dSMaxim Konovalov.Dv SIGINFO
362605af08dSMaxim Konovalov(see the
363605af08dSMaxim Konovalov.Cm status
364605af08dSMaxim Konovalovargument for
365605af08dSMaxim Konovalov.Xr stty 1 )
366605af08dSMaxim Konovalovsignal, the current number of packets sent and received, and the
367605af08dSMaxim Konovalovminimum, mean, and maximum of the round-trip times will be written to
368605af08dSMaxim Konovalovthe standard error output.
369605af08dSMaxim Konovalov.Pp
3708fae3551SRodney W. GrimesThis program is intended for use in network testing, measurement and
3718fae3551SRodney W. Grimesmanagement.
3728fae3551SRodney W. GrimesBecause of the load it can impose on the network, it is unwise to use
37350ceac88SJohn-Mark Gurney.Nm
3748fae3551SRodney W. Grimesduring normal operations or from automated scripts.
3758fae3551SRodney W. Grimes.Sh ICMP PACKET DETAILS
3768fae3551SRodney W. GrimesAn IP header without options is 20 bytes.
3778fae3551SRodney W. GrimesAn
3788fae3551SRodney W. Grimes.Tn ICMP
3798fae3551SRodney W. Grimes.Tn ECHO_REQUEST
38050ceac88SJohn-Mark Gurneypacket contains an additional 8 bytes worth of
3818fae3551SRodney W. Grimes.Tn ICMP
3828fae3551SRodney W. Grimesheader followed by an arbitrary amount of data.
3838fae3551SRodney W. GrimesWhen a
3848fae3551SRodney W. Grimes.Ar packetsize
38550ceac88SJohn-Mark Gurneyis given, this indicated the size of this extra piece of data
386c4d9468eSRuslan Ermilov(the default is 56).
3878fae3551SRodney W. GrimesThus the amount of data received inside of an IP packet of type
3888fae3551SRodney W. Grimes.Tn ICMP
3898fae3551SRodney W. Grimes.Tn ECHO_REPLY
3908fae3551SRodney W. Grimeswill always be 8 bytes more than the requested data space
391c4d9468eSRuslan Ermilov(the
392c4d9468eSRuslan Ermilov.Tn ICMP
393c4d9468eSRuslan Ermilovheader).
3948fae3551SRodney W. Grimes.Pp
3958fae3551SRodney W. GrimesIf the data space is at least eight bytes large,
39650ceac88SJohn-Mark Gurney.Nm
3978fae3551SRodney W. Grimesuses the first eight bytes of this space to include a timestamp which
3988fae3551SRodney W. Grimesit uses in the computation of round trip times.
3998fae3551SRodney W. GrimesIf less than eight bytes of pad are specified, no round trip times are
4008fae3551SRodney W. Grimesgiven.
4018fae3551SRodney W. Grimes.Sh DUPLICATE AND DAMAGED PACKETS
402e1205e80SPhilippe CharnierThe
403e1205e80SPhilippe Charnier.Nm
404e1205e80SPhilippe Charnierutility will report duplicate and damaged packets.
40585456935SBill FennerDuplicate packets should never occur when pinging a unicast address,
40685456935SBill Fennerand seem to be caused by
4078fae3551SRodney W. Grimesinappropriate link-level retransmissions.
40850ceac88SJohn-Mark GurneyDuplicates may occur in many situations and are rarely
409c4d9468eSRuslan Ermilov(if ever)
41050ceac88SJohn-Mark Gurneya good sign, although the presence of low levels of duplicates may not
4118fae3551SRodney W. Grimesalways be cause for alarm.
41285456935SBill FennerDuplicates are expected when pinging a broadcast or multicast address,
41385456935SBill Fennersince they are not really duplicates but replies from different hosts
41485456935SBill Fennerto the same request.
4158fae3551SRodney W. Grimes.Pp
4168fae3551SRodney W. GrimesDamaged packets are obviously serious cause for alarm and often
4178fae3551SRodney W. Grimesindicate broken hardware somewhere in the
418e345a80dSPhilippe Charnier.Nm
4193109a910SGarrett Wollmanpacket's path (in the network or in the hosts).
4208fae3551SRodney W. Grimes.Sh TRYING DIFFERENT DATA PATTERNS
42150ceac88SJohn-Mark GurneyThe
4223109a910SGarrett Wollman(inter)network
42350ceac88SJohn-Mark Gurneylayer should never treat packets differently depending on the data
42450ceac88SJohn-Mark Gurneycontained in the data portion.
4258fae3551SRodney W. GrimesUnfortunately, data-dependent problems have been known to sneak into
4268fae3551SRodney W. Grimesnetworks and remain undetected for long periods of time.
4278fae3551SRodney W. GrimesIn many cases the particular pattern that will have problems is something
4283109a910SGarrett Wollmanthat does not have sufficient
42950ceac88SJohn-Mark Gurney.Dq transitions ,
43050ceac88SJohn-Mark Gurneysuch as all ones or all zeros, or a pattern right at the edge, such as
43150ceac88SJohn-Mark Gurneyalmost all zeros.
4323109a910SGarrett WollmanIt is not
4333109a910SGarrett Wollmannecessarily enough to specify a data pattern of all zeros (for example)
43450ceac88SJohn-Mark Gurneyon the command line because the pattern that is of interest is
4358fae3551SRodney W. Grimesat the data link level, and the relationship between what you type and
4368fae3551SRodney W. Grimeswhat the controllers transmit can be complicated.
4378fae3551SRodney W. Grimes.Pp
4388fae3551SRodney W. GrimesThis means that if you have a data-dependent problem you will probably
4398fae3551SRodney W. Grimeshave to do a lot of testing to find it.
44050ceac88SJohn-Mark GurneyIf you are lucky, you may manage to find a file that either
4413109a910SGarrett Wollmancannot
44250ceac88SJohn-Mark Gurneybe sent across your network or that takes much longer to transfer than
44350ceac88SJohn-Mark Gurneyother similar length files.
4448fae3551SRodney W. GrimesYou can then examine this file for repeated patterns that you can test
4458fae3551SRodney W. Grimesusing the
4468fae3551SRodney W. Grimes.Fl p
4478fae3551SRodney W. Grimesoption of
4487c7fb079SRuslan Ermilov.Nm .
4498fae3551SRodney W. Grimes.Sh TTL DETAILS
4508fae3551SRodney W. GrimesThe
4518fae3551SRodney W. Grimes.Tn TTL
4528fae3551SRodney W. Grimesvalue of an IP packet represents the maximum number of IP routers
4538fae3551SRodney W. Grimesthat the packet can go through before being thrown away.
4548fae3551SRodney W. GrimesIn current practice you can expect each router in the Internet to decrement
4558fae3551SRodney W. Grimesthe
4568fae3551SRodney W. Grimes.Tn TTL
4578fae3551SRodney W. Grimesfield by exactly one.
4588fae3551SRodney W. Grimes.Pp
4598fae3551SRodney W. GrimesThe
4608fae3551SRodney W. Grimes.Tn TCP/IP
461a70dc556SRuslan Ermilovspecification recommends setting the
4628fae3551SRodney W. Grimes.Tn TTL
4638fae3551SRodney W. Grimesfield for
464a70dc556SRuslan Ermilov.Tn IP
465a70dc556SRuslan Ermilovpackets to 64, but many systems use smaller values
466c4d9468eSRuslan Ermilov.No ( Bx 4.3
4673109a910SGarrett Wollmanuses 30,
4683109a910SGarrett Wollman.Bx 4.2
469c4d9468eSRuslan Ermilovused 15).
4708fae3551SRodney W. Grimes.Pp
471e345a80dSPhilippe CharnierThe maximum possible value of this field is 255, and most
472e345a80dSPhilippe Charnier.Ux
473e345a80dSPhilippe Charniersystems set
4748fae3551SRodney W. Grimesthe
4758fae3551SRodney W. Grimes.Tn TTL
4768fae3551SRodney W. Grimesfield of
4778fae3551SRodney W. Grimes.Tn ICMP ECHO_REQUEST
4788fae3551SRodney W. Grimespackets to 255.
47950ceac88SJohn-Mark GurneyThis is why you will find you can
48050ceac88SJohn-Mark Gurney.Dq ping
48150ceac88SJohn-Mark Gurneysome hosts, but not reach them with
4828fae3551SRodney W. Grimes.Xr telnet 1
4838fae3551SRodney W. Grimesor
4848fae3551SRodney W. Grimes.Xr ftp 1 .
4858fae3551SRodney W. Grimes.Pp
486e345a80dSPhilippe CharnierIn normal operation
487e345a80dSPhilippe Charnier.Nm
488e345a80dSPhilippe Charnierprints the ttl value from the packet it receives.
4898fae3551SRodney W. GrimesWhen a remote system receives a ping packet, it can do one of three things
4908fae3551SRodney W. Grimeswith the
4918fae3551SRodney W. Grimes.Tn TTL
4928fae3551SRodney W. Grimesfield in its response:
4938fae3551SRodney W. Grimes.Bl -bullet
4948fae3551SRodney W. Grimes.It
495e345a80dSPhilippe CharnierNot change it; this is what
496e345a80dSPhilippe Charnier.Bx
497e345a80dSPhilippe Charniersystems did before the
4988fae3551SRodney W. Grimes.Bx 4.3 tahoe
4998fae3551SRodney W. Grimesrelease.
5008fae3551SRodney W. GrimesIn this case the
5018fae3551SRodney W. Grimes.Tn TTL
5028fae3551SRodney W. Grimesvalue in the received packet will be 255 minus the
5038fae3551SRodney W. Grimesnumber of routers in the round-trip path.
5048fae3551SRodney W. Grimes.It
5053109a910SGarrett WollmanSet it to 255; this is what current
506e345a80dSPhilippe Charnier.Bx
5073109a910SGarrett Wollmansystems do.
5088fae3551SRodney W. GrimesIn this case the
5098fae3551SRodney W. Grimes.Tn TTL
5108fae3551SRodney W. Grimesvalue in the received packet will be 255 minus the
5118fae3551SRodney W. Grimesnumber of routers in the path
51250ceac88SJohn-Mark Gurney.Em from
5138fae3551SRodney W. Grimesthe remote system
5148fae3551SRodney W. Grimes.Em to
5158fae3551SRodney W. Grimesthe
51650ceac88SJohn-Mark Gurney.Nm Ns Em ing
5178fae3551SRodney W. Grimeshost.
5188fae3551SRodney W. Grimes.It
5198fae3551SRodney W. GrimesSet it to some other value.
5208fae3551SRodney W. GrimesSome machines use the same value for
5218fae3551SRodney W. Grimes.Tn ICMP
5228fae3551SRodney W. Grimespackets that they use for
5238fae3551SRodney W. Grimes.Tn TCP
5248fae3551SRodney W. Grimespackets, for example either 30 or 60.
5258fae3551SRodney W. GrimesOthers may use completely wild values.
5268fae3551SRodney W. Grimes.El
5270c868e90SDaniel Gerzo.Sh EXIT STATUS
52843470e3bSGarrett WollmanThe
52950ceac88SJohn-Mark Gurney.Nm
5307f220ecfSDaniel Gerzoutility exits with one of the following values:
5317f220ecfSDaniel Gerzo.Bl -tag -width indent
5327f220ecfSDaniel Gerzo.It 0
5337f220ecfSDaniel GerzoAt least one response was heard from the specified
5347f220ecfSDaniel Gerzo.Ar host .
5357f220ecfSDaniel Gerzo.It 2
5367f220ecfSDaniel GerzoThe transmission was successful but no responses were received.
5377f220ecfSDaniel Gerzo.It any other value
5387f220ecfSDaniel GerzoAn error occurred.
5397f220ecfSDaniel GerzoThese values are defined in
5407f220ecfSDaniel Gerzo.In sysexits.h .
5417f220ecfSDaniel Gerzo.El
54243470e3bSGarrett Wollman.Sh SEE ALSO
54343470e3bSGarrett Wollman.Xr netstat 1 ,
5443c32812bSMaxim Konovalov.Xr icmp 4 ,
54543470e3bSGarrett Wollman.Xr ifconfig 8 ,
54643470e3bSGarrett Wollman.Xr routed 8 ,
54743470e3bSGarrett Wollman.Xr traceroute 8
54843470e3bSGarrett Wollman.Sh HISTORY
54943470e3bSGarrett WollmanThe
55043470e3bSGarrett Wollman.Nm
551e1205e80SPhilippe Charnierutility appeared in
55243470e3bSGarrett Wollman.Bx 4.3 .
55343470e3bSGarrett Wollman.Sh AUTHORS
55443470e3bSGarrett WollmanThe original
55543470e3bSGarrett Wollman.Nm
556e1205e80SPhilippe Charnierutility was written by
55768085a0eSPhilippe Charnier.An Mike Muuss
55868085a0eSPhilippe Charnierwhile at the US Army Ballistics
55943470e3bSGarrett WollmanResearch Laboratory.
5608fae3551SRodney W. Grimes.Sh BUGS
5618fae3551SRodney W. GrimesMany Hosts and Gateways ignore the
5628fae3551SRodney W. Grimes.Tn RECORD_ROUTE
5638fae3551SRodney W. Grimesoption.
5648fae3551SRodney W. Grimes.Pp
5658fae3551SRodney W. GrimesThe maximum IP header length is too small for options like
5668fae3551SRodney W. Grimes.Tn RECORD_ROUTE
56750ceac88SJohn-Mark Gurneyto be completely useful.
56850ceac88SJohn-Mark Gurney.No There Ap s
56950ceac88SJohn-Mark Gurneynot much that can be done about this, however.
5708fae3551SRodney W. Grimes.Pp
5718fae3551SRodney W. GrimesFlood pinging is not recommended in general, and flood pinging the
5728fae3551SRodney W. Grimesbroadcast address should only be done under very controlled conditions.
573ef9e6dc7SBill Fenner.Pp
574ef9e6dc7SBill FennerThe
575ef9e6dc7SBill Fenner.Fl v
576ef9e6dc7SBill Fenneroption is not worth much on busy hosts.
577