Penguin
Annotated edit history of ping(8) version 2, including all changes. View license author blame.
Rev Author # Line
1 perry 1 ----
2 __NAME__
3
4
5 ping - send ICMP ECHO_REQUEST packets to
6 network hosts
7 __SYNOPSIS__
8
9
10 ping [[-dfnqrvR] [[-c count] [[-i wait] [[-l preload] [[-p
11 pattern] [[-s packetsize]
12 __DESCRIPTION__
13
14
15 Ping uses the ICMP protocol's mandatory
16 ECHO_REQUEST data- gram to elicit an
17 ICMP ECHO_RESPONSE from a host or gateway.
18 ECHO_REQUEST datagrams (``pings'') have an IP
19 and ICMP header, followed by a ``struct
20 timeval'' and then an arbi- trary number of ``pad'' bytes
21 used to fill out the packet. The options are as follows:
22 Other options are:
23 -c count
24
25
26 Stop after sending (and receiving) countECHO_RESPONSE packets.-dSet the SO_DEBUG option on the socket being used.
27
28
29 -f
30 Flood ping. Outputs packets as fast as they come back or one
31 hundred times per second, whichever is more. For every
32 ECHO_REQUEST sent a period ``.'' is printed,
33 while for ever ECHO_REPLY received a
34 backspace is printed. This provides a rapid display of how
35 many packets are being dropped. Only the super-user may use
36 this option. ''This can be very hard on a network and
37 should be used with caution.''
38
39
40 -i wait
41 Wait wait seconds ''between sending each packet''. The
42 default is to wait for one second between each packet. This
43 option is incompatible with the -f option.
44
45
46 -l preload
47 If preload is specified, ping sends that many packets as
48 fast as possible before falling into its normal mode of
49 behavior. Only the super-user may use this
50 option.
51
52
53 -n
54 Numeric output only. No attempt will be made to lookup
55 symbolic names for host addresses.
56
57
58 -p pattern
59 You may specify up to 16 ``pad'' bytes to fill out the
60 packet you send. This is useful for diagnosing
61 data-dependent problems in a network. For example, ``-p
62 ff'' will cause the sent packet to be filled with all
63 ones.
64
65
66 -q
67 Quiet output. Nothing is displayed except the sum- mary
68 lines at startup time and when finished.
69
70
71 -R
72 Record route. Includes the RECORD_ROUTE
73 option in the ECHO_REQUEST packet and
74 displays the route buffer on returned packets. Note that the
75 IP header is only large enough for nine such routes. Many
76 hosts ignore or discard this option.
77
78
79 -r
80 Bypass the normal routing tables and send directly to a host
81 on an attached network. If the host is not on a
82 directly-attached network, an error is returned. This option
83 can be used to ping a local host through an interface that
84 has no route through it (e.g., after the interface was
85 dropped by routed(8)).
86
87
88 -s packetsize
89 Specifies the number of data bytes to be sent. The default
90 is 56, which translates into 64 ICMP data
91 bytes when combined with the 8 bytes of ICMP
92 header data.
93
94
95 -v
96 Verbose output. ICMP packets other than
97 ECHO_RESPONSE that are received are
98 listed.
99
100
101 When using ping for fault isolation, it should first be run
102 on the local host, to verify that the local network inter-
103 face is up and running. Then, hosts and gateways further and
104 further away should be ``pinged''. Round-trip times and
105 packet loss statistics are computed. If duplicate packets
106 are received, they are not included in the packet loss cal-
107 culation, although the round trip time of these packets is
108 used in calculating the minimum/average/maximum round-trip
109 time numbers. When the specified number of packets have been
110 sent (and received) or if the program is terminated with a
111 SIGINT, a brief summary is displayed.
112
113
114 If ping does not receive any reply packets at all it will
115 exit with code 1. On error it exits with code 2. Otherwise
116 it exits with code 0. This makes it possible to use the exit
117 code to see if a host is alive or not.
118
119
120 This program is intended for use in network testing, mea-
121 surement and management. Because of the load it can impose
122 on the network, it is unwise to use ping during normal oper-
123 ations or from automated scripts.
124
125
126 __ICMP PACKET DETAILS__
127
128
129 An IP header without options is 20 bytes. An ICMP
130 ECHO_REQUEST packet contains an additional 8 bytes
131 worth of ICMP header followed by an arbitrary
132 amount of data. When a packetsize is given, this indicated
133 the size of this extra piece of data (the default is 56).
134 Thus the amount of data received inside of an IP packet of
135 type ICMP ECHO_REPLY will always be 8 bytes
136 more than the requested data space (the ICMP
137 header).
138
139
140 If the data space is at least eight bytes large, ping uses
141 the first eight bytes of this space to include a timestamp
142 which it uses in the computation of round trip times. If
143 less than eight bytes of pad are specified, no round trip
144 times are given.
145 __DUPLICATE AND DAMAGED PACKETS__
146
147
148 Ping will report duplicate and damaged packets. Duplicate
149 packets should never occur, and seem to be caused by inap-
150 propriate link-level retransmissions. Duplicates may occur
151 in many situations and are rarely (if ever) a good sign,
152 although the presence of low levels of duplicates may not
153 always be cause for alarm.
154
155
156 Damaged packets are obviously serious cause for alarm and often indicate broken hardware somewhere in the ping packet's path (in the network or in the hosts).
157 __TRYING DIFFERENT DATA PATTERNS__
158
159
160 The (inter)network layer should never treat packets differ-
161 ently depending on the data contained in the data portion.
162 Unfortunately, data-dependent problems have been known to
163 sneak into networks and remain undetected for long periods
164 of time. In many cases the particular pattern that will have
165 problems is something that doesn't have sufficient
166 ``transitions'', such as all ones or all zeros, or a pattern
167 right at the edge, such as almost all zeros. It isn't nec-
168 essarily enough to specify a data pattern of all zeros (for
169 example) on the command line because the pattern that is of
170 interest is at the data link level, and the relationship
171 between what you type and what the controllers transmit can
172 be complicated.
173
174
175 This means that if you have a data-dependent problem you will probably have to do a lot of testing to find it. If you are lucky, you may manage to find a file that either can't be sent across your network or that takes much longer to transfer than other similar length files. You can then examine this file for repeated patterns that you can test using the -p option of ping.
176 __TTL DETAILS__
177
178
179 The TTL value of an IP packet represents the
180 maximum number of IP routers that the packet can go through
181 before being thrown away. In current practice you can expect
182 each router in the Internet to decrement the
183 TTL field by exactly one.
184
185
186 The TCP/IP specification states that the TTL field for TCP packets should be set to 60, but many systems use smaller values (4.3 BSD uses 30, 4.2 used 15).
187
188
189 The maximum possible value of this field is 255, and most
190 Unix systems set the TTL field of ICMP
191 ECHO_REQUEST packets to 255. This is why you will
192 find you can ``ping'' some hosts, but not reach them with
193 telnet(1) or ftp(1).
194
195
196 In normal operation ping prints the ttl value from the
197 packet it receives. When a remote system receives a ping
198 packet, it can do one of three things with the
199 TTL field in its response:
200 Not change it; this is what Berkeley Unix systems didbefore the 4.3BSD-Tahoe release. In this case the TTLvalue in the received packet will be 255 minus the numberof routers in the round-trip path.
201
202
203 Set it to 255; this is what current Berkeley Unix systemsdo. In this case the TTL value in the received packetwill be 255 minus the number of routers in the path from the remote system ''to'' the ping''ing'' host.
204
205
206 Set it to some other value. Some machines use the same value
207 for ICMP packets that they use for
208 TCP packets, for example either 30 or 60.
209 Others may use completely wild values.
210
211
212 __BUGS__
213
214
215 Many Hosts and Gateways ignore the
216 RECORD_ROUTE option.
217
218
219 The maximum IP header length is too small for options like
220 RECORD_ROUTE to be completely useful. There's
221 not much that that can be done about this,
222 however.
223
224
225 Flood pinging is not recommended in general, and flood ping-
226 ing the broadcast address should only be done under very
227 controlled conditions.
228 __SEE ALSO__
229
230
231 netstat(1), ifconfig(8),
232 routed(8)
233 __HISTORY__
234
235
236 The ping command appeared in 4.3 BSD
237 .
238
239
2 perry 240 Linux !NetKit 0.09 August 30, 1996 1
1 perry 241 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.