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