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