]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - 6/contrib/traceroute/traceroute.8
merge fix for boot-time hang on centos' xen
[FreeBSD/FreeBSD.git] / 6 / contrib / traceroute / traceroute.8
1 .\" Copyright (c) 1989, 1995, 1996, 1997, 1999, 2000
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms are permitted
5 .\" provided that the above copyright notice and this paragraph are
6 .\" duplicated in all such forms and that any documentation,
7 .\" advertising materials, and other materials related to such
8 .\" distribution and use acknowledge that the software was developed
9 .\" by the University of California, Berkeley.  The name of the
10 .\" University may not be used to endorse or promote products derived
11 .\" from this software without specific prior written permission.
12 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 .\" WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
15 .\"
16 .\"     $Id: traceroute.8,v 1.19 2000/09/21 08:44:19 leres Exp $
17 .\"     $FreeBSD$
18 .\"
19 .TH TRACEROUTE 8 "21 September 2000"
20 .UC 6
21 .SH NAME
22 traceroute \- print the route packets take to network host
23 .SH SYNOPSIS
24 .na
25 .B traceroute
26 [
27 .B \-dDeFISnrvx
28 ] [
29 .B \-f
30 .I first_ttl
31 ] [
32 .B \-g
33 .I gateway
34 ]
35 .br
36 .ti +8
37 [
38 .B \-i
39 .I iface
40 ] [
41 .B \-M
42 .I first_ttl
43
44 .br
45 .ti +8
46 [
47 .B \-m
48 .I max_ttl
49 ] [
50 .B \-P
51 .I proto
52 ] [
53 .B \-p
54 .I port
55 ]
56 .br
57 .ti +8
58 [
59 .B \-q
60 .I nqueries
61 ] [
62 .B \-s
63 .I src_addr
64 ] [
65 .B \-t
66 .I tos
67 ]
68 .br
69 .ti +8
70 [
71 .B \-w
72 .I waittime
73 ] [
74 .B \-z
75 .I pausemsecs
76 ]
77 .br
78 .ti +8
79 .I host
80 [
81 .I packetlen
82 ]
83 .ad
84 .SH DESCRIPTION
85 The Internet is a large and complex aggregation of
86 network hardware, connected together by gateways.
87 Tracking the route one's packets follow (or finding the miscreant
88 gateway that's discarding your packets) can be difficult.
89 .I Traceroute
90 utilizes the IP protocol `time to live' field and attempts to elicit an
91 ICMP TIME_EXCEEDED response from each gateway along the path to some
92 host.
93 .PP
94 The only mandatory parameter is the destination host name or IP number.
95 The default probe datagram length is 40 bytes, but this may be increased
96 by specifying a packet length (in bytes) after the destination host
97 name.
98 .PP
99 Other options are:
100 .TP
101 .B \-e
102 Firewall evasion mode.
103 Use fixed destination ports for UDP and TCP probes.
104 The destination port does NOT increment with each packet sent.
105 .TP
106 .B \-f
107 Set the initial time-to-live used in the first outgoing probe packet.
108 .TP
109 .B \-F
110 Set the "don't fragment" bit.
111 .TP
112 .B \-d
113 Enable socket level debugging.
114 .TP
115 .B \-D
116 When an ICMP response to our probe datagram is received,
117 print the differences between the transmitted packet and
118 the packet quoted by the ICMP response.
119 A key showing the location of fields within the transmitted packet is printed,
120 followed by the original packet in hex,
121 followed by the quoted packet in hex.
122 Bytes that are unchanged in the quoted packet are shown as underscores.
123 Note,
124 the IP checksum and the TTL of the quoted packet are not expected to match.
125 By default, only one probe per hop is sent with this option.
126 .TP
127 .B \-g
128 Specify a loose source route gateway (8 maximum).
129 .TP
130 .B \-i
131 Specify a network interface to obtain the source IP address for
132 outgoing probe packets. This is normally only useful on a multi-homed
133 host. (See the
134 .B \-s
135 flag for another way to do this.)
136 .TP
137 .B \-I
138 Use ICMP ECHO instead of UDP datagrams.  (A synonym for "-P icmp").
139 .TP
140 .B \-M
141 Set the initial time-to-live value used in outgoing probe packets.
142 The default is 1, i.e., start with the first hop.
143 .TP
144 .B \-m
145 Set the max time-to-live (max number of hops) used in outgoing probe
146 packets.  The default is
147 .I net.inet.ip.ttl
148 hops (the same default used for TCP
149 connections).
150 .TP
151 .B \-n
152 Print hop addresses numerically rather than symbolically and numerically
153 (saves a nameserver address-to-name lookup for each gateway found on the
154 path).
155 .TP
156 .B \-P
157 Send packets of specified IP protocol. The currently supported protocols
158 are: UDP, TCP, GRE and ICMP. Other protocols may also be specified (either by
159 name or by number), though
160 .I traceroute
161 does not implement any special knowledge of their packet formats. This
162 option is useful for determining which router along a path may be
163 blocking packets based on IP protocol number. But see BUGS below.
164 .TP
165 .B \-p
166 Protocol specific. For UDP and TCP, sets
167 the base port number used in probes (default is 33434).
168 Traceroute hopes that nothing is listening on UDP ports
169 .I base
170 to
171 .I base + nhops * nprobes - 1
172 at the destination host (so an ICMP PORT_UNREACHABLE message will
173 be returned to terminate the route tracing).  If something is
174 listening on a port in the default range, this option can be used
175 to pick an unused port range.
176 .TP
177 .B \-q
178 Set the number of probes per hop (default is 3,
179 unless
180 .B -D
181 is specified,
182 when it is 1).
183 .TP
184 .B \-r
185 Bypass the normal routing tables and send directly to a host on an attached
186 network.
187 If the host is not on a directly-attached network,
188 an error is returned.
189 This option can be used to ping a local host through an interface
190 that has no route through it (e.g., after the interface was dropped by
191 .IR routed (8C)).
192 .TP
193 .B \-s
194 Use the following IP address (which usually is given as an IP number, not
195 a hostname) as the source address in outgoing probe packets.  On
196 multi-homed hosts (those with more than one IP
197 address), this option can be used to
198 force the source address to be something other than the IP address
199 of the interface the probe packet is sent on.  If the IP address
200 is not one of this machine's interface addresses, an error is
201 returned and nothing is sent. (See the
202 .B \-i
203 flag for another way to do this.)
204 .TP
205 .B \-S
206 Print a summary of how many probes were not answered for each hop.
207 .TP
208 .B \-t
209 Set the
210 .I type-of-service
211 in probe packets to the following value (default zero).  The value must be
212 a decimal integer in the range 0 to 255.  This option can be used to
213 see if different types-of-service result in different paths.  (If you
214 are not running 4.4bsd, this may be academic since the normal network
215 services like telnet and ftp don't let you control the TOS).
216 Not all values of TOS are legal or
217 meaningful \- see the IP spec for definitions.  Useful values are
218 probably
219 .RB ` -t
220 .IR 16 '
221 (low delay) and
222 .RB ` -t
223 .IR 8 '
224 (high throughput).
225 .TP
226 .B \-v
227 Verbose output.  Received ICMP packets other than TIME_EXCEEDED and
228 UNREACHABLEs are listed.
229 .TP
230 .B \-w
231 Set the time (in seconds) to wait for a response to a probe (default 5
232 sec.).
233 .TP
234 .B \-x
235 Toggle ip checksums. Normally, this prevents traceroute from calculating
236 ip checksums. In some cases, the operating system can overwrite parts of
237 the outgoing packet but not recalculate the checksum (so in some cases
238 the default is to not calculate checksums and using
239 .B \-x
240 causes them to be calculated). Note that checksums are usually required
241 for the last hop when using ICMP ECHO probes
242 .RB ( \-I ).
243 So they are always calculated when using ICMP.
244 .TP
245 .B \-z
246 Set the time (in milliseconds) to pause between probes (default 0).
247 Some systems such as Solaris and routers such as Ciscos rate limit
248 icmp messages. A good value to use with this this is 500 (e.g. 1/2 second).
249 .PP
250 This program attempts to trace the route an IP packet would follow to some
251 internet host by launching UDP probe
252 packets with a small ttl (time to live) then listening for an
253 ICMP "time exceeded" reply from a gateway.  We start our probes
254 with a ttl of one and increase by one until we get an ICMP "port
255 unreachable" (which means we got to "host") or hit a max (which
256 defaults to
257 .I net.inet.ip.ttl
258 hops & can be changed with the
259 .B \-m
260 flag).  Three
261 probes (change with
262 .B \-q
263 flag) are sent at each ttl setting and a
264 line is printed showing the ttl, address of the gateway and
265 round trip time of each probe.  If the probe answers come from
266 different gateways, the address of each responding system will
267 be printed.  If there is no response within a 5 sec. timeout
268 interval (changed with the
269 .B \-w
270 flag), a "*" is printed for that
271 probe.
272 .PP
273 We don't want the destination
274 host to process the UDP probe packets so the destination port is set to an
275 unlikely value (if some clod on the destination is using that
276 value, it can be changed with the
277 .B \-p
278 flag).
279 .PP
280 A sample use and output might be:
281
282 .RS
283 .nf
284 [yak 71]% traceroute nis.nsf.net.
285 traceroute to nis.nsf.net (35.1.1.48), 64 hops max, 38 byte packet
286  1  helios.ee.lbl.gov (128.3.112.1)  19 ms  19 ms  0 ms
287  2  lilac-dmc.Berkeley.EDU (128.32.216.1)  39 ms  39 ms  19 ms
288  3  lilac-dmc.Berkeley.EDU (128.32.216.1)  39 ms  39 ms  19 ms
289  4  ccngw-ner-cc.Berkeley.EDU (128.32.136.23)  39 ms  40 ms  39 ms
290  5  ccn-nerif22.Berkeley.EDU (128.32.168.22)  39 ms  39 ms  39 ms
291  6  128.32.197.4 (128.32.197.4)  40 ms  59 ms  59 ms
292  7  131.119.2.5 (131.119.2.5)  59 ms  59 ms  59 ms
293  8  129.140.70.13 (129.140.70.13)  99 ms  99 ms  80 ms
294  9  129.140.71.6 (129.140.71.6)  139 ms  239 ms  319 ms
295 10  129.140.81.7 (129.140.81.7)  220 ms  199 ms  199 ms
296 11  nic.merit.edu (35.1.1.48)  239 ms  239 ms  239 ms
297 .fi
298 .RE
299
300 Note that lines 2 & 3 are the same.  This is due to a buggy
301 kernel on the 2nd hop system \- lilac-dmc.Berkeley.EDU \- that forwards
302 packets with a zero ttl (a bug in the distributed version
303 of 4.3BSD).  Note that you have to guess what path
304 the packets are taking cross-country since the NSFNet (129.140)
305 doesn't supply address-to-name translations for its NSSes.
306 .PP
307 A more interesting example is:
308
309 .RS
310 .nf
311 [yak 72]% traceroute allspice.lcs.mit.edu.
312 traceroute to allspice.lcs.mit.edu (18.26.0.115), 64 hops max
313  1  helios.ee.lbl.gov (128.3.112.1)  0 ms  0 ms  0 ms
314  2  lilac-dmc.Berkeley.EDU (128.32.216.1)  19 ms  19 ms  19 ms
315  3  lilac-dmc.Berkeley.EDU (128.32.216.1)  39 ms  19 ms  19 ms
316  4  ccngw-ner-cc.Berkeley.EDU (128.32.136.23)  19 ms  39 ms  39 ms
317  5  ccn-nerif22.Berkeley.EDU (128.32.168.22)  20 ms  39 ms  39 ms
318  6  128.32.197.4 (128.32.197.4)  59 ms  119 ms  39 ms
319  7  131.119.2.5 (131.119.2.5)  59 ms  59 ms  39 ms
320  8  129.140.70.13 (129.140.70.13)  80 ms  79 ms  99 ms
321  9  129.140.71.6 (129.140.71.6)  139 ms  139 ms  159 ms
322 10  129.140.81.7 (129.140.81.7)  199 ms  180 ms  300 ms
323 11  129.140.72.17 (129.140.72.17)  300 ms  239 ms  239 ms
324 12  * * *
325 13  128.121.54.72 (128.121.54.72)  259 ms  499 ms  279 ms
326 14  * * *
327 15  * * *
328 16  * * *
329 17  * * *
330 18  ALLSPICE.LCS.MIT.EDU (18.26.0.115)  339 ms  279 ms  279 ms
331 .fi
332 .RE
333
334 Note that the gateways 12, 14, 15, 16 & 17 hops away
335 either don't send ICMP "time exceeded" messages or send them
336 with a ttl too small to reach us.  14 \- 17 are running the
337 MIT C Gateway code that doesn't send "time exceeded"s.  God
338 only knows what's going on with 12.
339 .PP
340 The silent gateway 12 in the above may be the result of a bug in
341 the 4.[23]BSD network code (and its derivatives):  4.x (x <= 3)
342 sends an unreachable message using whatever ttl remains in the
343 original datagram.  Since, for gateways, the remaining ttl is
344 zero, the ICMP "time exceeded" is guaranteed to not make it back
345 to us.  The behavior of this bug is slightly more interesting
346 when it appears on the destination system:
347
348 .RS
349 .nf
350  1  helios.ee.lbl.gov (128.3.112.1)  0 ms  0 ms  0 ms
351  2  lilac-dmc.Berkeley.EDU (128.32.216.1)  39 ms  19 ms  39 ms
352  3  lilac-dmc.Berkeley.EDU (128.32.216.1)  19 ms  39 ms  19 ms
353  4  ccngw-ner-cc.Berkeley.EDU (128.32.136.23)  39 ms  40 ms  19 ms
354  5  ccn-nerif35.Berkeley.EDU (128.32.168.35)  39 ms  39 ms  39 ms
355  6  csgw.Berkeley.EDU (128.32.133.254)  39 ms  59 ms  39 ms
356  7  * * *
357  8  * * *
358  9  * * *
359 10  * * *
360 11  * * *
361 12  * * *
362 13  rip.Berkeley.EDU (128.32.131.22)  59 ms !  39 ms !  39 ms !
363 .fi
364 .RE
365
366 Notice that there are 12 "gateways" (13 is the final
367 destination) and exactly the last half of them are "missing".
368 What's really happening is that rip (a Sun-3 running Sun OS3.5)
369 is using the ttl from our arriving datagram as the ttl in its
370 ICMP reply.  So, the reply will time out on the return path
371 (with no notice sent to anyone since ICMP's aren't sent for
372 ICMP's) until we probe with a ttl that's at least twice the path
373 length.  I.e., rip is really only 7 hops away.  A reply that
374 returns with a ttl of 1 is a clue this problem exists.
375 Traceroute prints a "!" after the time if the ttl is <= 1.
376 Since vendors ship a lot of obsolete (DEC's Ultrix, Sun 3.x) or
377 non-standard (HPUX) software, expect to see this problem
378 frequently and/or take care picking the target host of your
379 probes.
380
381 Other possible annotations after the time are
382 .BR !H ,
383 .BR !N ,
384 or
385 .B !P
386 (host, network or protocol unreachable),
387 .B !S
388 (source route failed),
389 .B !F\-<pmtu>
390 (fragmentation needed \- the RFC1191 Path MTU Discovery value is displayed),
391 .B !U
392 or
393 .B !W
394 (destination network/host unknown),
395 .B !I
396 (source host is isolated),
397 .B !A
398 (communication with destination network administratively prohibited),
399 .B !Z
400 (communication with destination host administratively prohibited),
401 .B !Q
402 (for this ToS the destination network is unreachable),
403 .B !T
404 (for this ToS the destination host is unreachable),
405 .B !X
406 (communication administratively prohibited),
407 .B !V
408 (host precedence violation),
409 .B !C
410 (precedence cutoff in effect), or
411 .B !<num>
412 (ICMP unreachable code <num>).
413 These are defined by RFC1812 (which supersedes RFC1716).
414 If almost all the probes result in some kind of unreachable, traceroute
415 will give up and exit.
416 .PP
417 This program is intended for use in network testing, measurement
418 and management.
419 It should be used primarily for manual fault isolation.
420 Because of the load it could impose on the network, it is unwise to use
421 .I traceroute
422 during normal operations or from automated scripts.
423 .SH SEE ALSO
424 pathchar(8), netstat(1), ping(8)
425 .SH AUTHOR
426 Implemented by Van Jacobson from a suggestion by Steve Deering.  Debugged
427 by a cast of thousands with particularly cogent suggestions or fixes from
428 C. Philip Wood, Tim Seaver and Ken Adelman.
429 .LP
430 The current version is available via anonymous ftp:
431 .LP
432 .RS
433 .I ftp://ftp.ee.lbl.gov/traceroute.tar.gz
434 .RE
435 .SH BUGS
436 When using protocols other than UDP, functionality is reduced.
437 In particular, the last packet will often appear to be lost, because
438 even though it reaches the destination host, there's no way to know
439 that because no ICMP message is sent back.
440 In the TCP case,
441 .I traceroute
442 should listen for a RST from the destination host (or an intermediate
443 router that's filtering packets), but this is not implemented yet.
444 .PP
445 Please send bug reports to traceroute@ee.lbl.gov.