Debian Codegraph @

upstream/mageia-cauldron/man8/traceroute.8

raw
1 .\" Copyright (c) 2006 Dmitry Butskoy ([email protected])
2 .\" License: GPL v2 or any later version
3 .\" See COPYING for the status of this software
4 .TH TRACEROUTE 8 "11 October 2006" "Traceroute" "Traceroute For Linux"
5 .\" .UC 6
6 .SH NAME
7 traceroute \- print the route packets trace to network host
8 .SH SYNOPSIS
9 .na
10 .BR traceroute " [" \-46dFITUnreAV "] [" "\-f first_ttl" "] [" "\-g gate,..." ]
11 .br
12 .ti +8
13 .BR "" [ "-i device" "] [" "-m max_ttl" "] [" "-p port" "] [" "-s src_addr" ]
14 .br
15 .ti +8
16 .BR "" [ "-q nqueries" "] [" "-N squeries" "] [" "-t tos" ]
17 .br
18 .ti +8
19 .BR "" [ "-l flow_label" "] [" "-w waittimes" "] [" "-z sendwait" "] [" "-UL" "] [" "-D" ]
20 .br
21 .ti +8
22 .BR "" [ "-P proto" "] [" "--sport=port" "] [" "-M method" "] [" "-O mod_options" ]
23 .br
24 .ti +8
25 .BR "" [ "--mtu" "] [" "--back" ]
26 .br
27 .ti +8
28 .BR host " [" "packet_len" "]"
29 .br
30 .BR traceroute6
31 .RI " [" options ]
32 .ad
33 .SH DESCRIPTION
34 .I traceroute
35 tracks the route packets taken from an IP network on their
36 way to a given host. It utilizes the IP protocol's time to live (TTL) field
37 and attempts to elicit an ICMP TIME_EXCEEDED response from each gateway
38 along the path to the host.
39 .P
40 .I traceroute6
41 is equivalent to
42 .I traceroute
43 .B \-6
44 .PP
45 The only required parameter is the name or IP address of the
46 destination
47 .BR host \ .
48 The optional
49 .B packet_len\fR`gth
50 is the total size of the probing packet (default 60 bytes
51 for IPv4 and 80 for IPv6). The specified size can be ignored
52 in some situations or increased up to a minimal value.
53 .PP
54 This program attempts to trace the route an IP packet would follow to some
55 internet host by launching probe
56 packets with a small ttl (time to live) then listening for an
57 ICMP "time exceeded" reply from a gateway. We start our probes
58 with a ttl of one and increase by one until we get an ICMP "port
59 unreachable" (or TCP reset), which means we got to the "host", or hit a max (which
60 defaults to 30 hops). Three probes (by default) are sent at each ttl setting
61 and a line is printed showing the ttl, address of the gateway and
62 round trip time of each probe. The address can be followed by additional
63 information when requested. If the probe answers come from
64 different gateways, the address of each responding system will
65 be printed. If there is no response within a certain timeout,
66 an "*" (asterisk) is printed for that probe.
67 .PP
68 After the trip time, some additional annotation can be printed:
69 .BR !H ,
70 .BR !N ,
71 or
72 .B !P
73 (host, network or protocol unreachable),
74 .B !S
75 (source route failed),
76 .B !F
77 (fragmentation needed),
78 .B !X
79 (communication administratively prohibited),
80 .B !V
81 (host precedence violation),
82 .B !C
83 (precedence cutoff in effect), or
84 .B !<num>
85 (ICMP unreachable code <num>).
86 If almost all the probes result in some kind of unreachable, traceroute
87 will give up and exit.
88 .PP
89 We don't want the destination host to process the UDP probe packets,
90 so the destination port is set to an unlikely value (you can change it with the
91 .B \-p
92 flag). There is no such a problem for ICMP or TCP tracerouting (for TCP we
93 use half-open technique, which prevents our probes to be seen by applications
94 on the destination host).
95 .PP
96 In the modern network environment the traditional traceroute methods
97 can not be always applicable, because of widespread use of firewalls.
98 Such firewalls filter the "unlikely" UDP ports, or even ICMP echoes.
99 To solve this, some additional tracerouting methods are implemented
100 (including tcp), see
101 .B LIST OF AVAILABLE METHODS
102 below. Such methods try to use particular protocol
103 and source/destination port, in order to bypass firewalls (to be seen
104 by firewalls just as a start of allowed type of a network session).
105 .SH OPTIONS
106 .TP
107 .BI \--help
108 Print help info and exit.
109 .TP
110 .BR \-4 ", " \-6
111 Explicitly force IPv4 or IPv6 tracerouting. By default, the program
112 will try to resolve the name given, and choose the appropriate
113 protocol automatically. If resolving a host name returns both
114 IPv4 and IPv6 addresses,
115 .I traceroute
116 will use IPv4.
117 .TP
118 .B \-I, \-\-icmp
119 Use ICMP ECHO for probes
120 .TP
121 .B \-T, \-\-tcp
122 Use TCP SYN for probes
123 .TP
124 .B \-d, --debug
125 Enable socket level debugging (when the Linux kernel supports it)
126 .TP
127 .B \-F, --dont-fragment
128 Do not fragment probe packets. (For IPv4 it also sets DF bit, which tells
129 intermediate routers not to fragment remotely as well).
130 .br
131
132 .br
133 Varying the size of the probing packet by the
134 .B packet_len
135 command line parameter, you can manually obtain information
136 about the MTU of individual network hops. The
137 .B \--mtu
138 option (see below) tries to do this automatically.
139 .br
140
141 .br
142 Note, that non-fragmented features (like
143 .B \-F
144 or
145 .B \--mtu\fR)
146 work properly since the Linux kernel 2.6.22 only.
147 Before that version, IPv6 was always fragmented, IPv4 could use
148 the once the discovered final mtu only (from the route cache), which can be
149 less than the actual mtu of a device.
150 .TP
151 .BI \-f " first_ttl" ", --first=" first_ttl
152 Specifies with what TTL to start. Defaults to 1.
153 .TP
154 .BI \-g " gateway" ", --gateway=" gateway
155 Tells traceroute to add an IP source routing option to the outgoing
156 packet that tells the network to route the packet through the
157 specified
158 .IR gateway
159 (most routers have disabled source routing for security reasons).
160 In general, several
161 .IR gateway\fR's
162 is allowed (comma separated). For IPv6, the form of
163 .IR num\fB,\fIaddr\fB,\fIaddr...
164 is allowed, where
165 .IR num
166 is a route header type (default is type 2). Note the type 0 route header
167 is now deprecated (rfc5095).
168 .TP
169 .BI \-i " interface" ", --interface=" interface
170 Specifies the interface through which
171 .I traceroute
172 should send packets. By default, the interface is selected
173 according to the routing table.
174 .TP
175 .BI \-m " max_ttl" ", --max-hops=" max_ttl
176 Specifies the maximum number of hops (max time-to-live value)
177 .I traceroute
178 will probe. The default is 30.
179 .TP
180 .BI \-N " squeries" ", --sim-queries=" squeries
181 Specifies the number of probe packets sent out simultaneously.
182 Sending several probes concurrently can speed up
183 .I traceroute
184 considerably. The default value is 16.
185 .br
186 Note that some routers and hosts can use ICMP rate throttling. In such
187 a situation specifying too large number can lead to loss of some responses.
188 .TP
189 .BI \-n
190 Do not try to map IP addresses to host names when displaying them.
191 .TP
192 .BI \-p " port" ", --port=" port
193 For UDP tracing, specifies the destination port base
194 .I traceroute
195 will use (the destination port number will be incremented by each probe).
196 .br
197 For ICMP tracing, specifies the initial ICMP sequence value (incremented
198 by each probe too).
199 .br
200 For TCP and others specifies just the (constant) destination
201 port to connect.
202 .TP
203 .BI \-t " tos" ", --tos=" tos
204 For IPv4, set the Type of Service (TOS) and Precedence value. Useful values
205 are 16 (low delay) and 8 (high throughput). Note that in order to use
206 some TOS precedence values, you have to be super user.
207 .br
208 For IPv6, set the Traffic Control value.
209 .TP
210 .BI \-l " flow_label" ", --flowlabel=" flow_label
211 Use specified flow_label for IPv6 packets.
212 .TP
213 .BI \-w " max\fR[\fB,\fIhere\fB,\fInear\fR]" ", --wait=" max\fR[\fB,\fIhere\fB,\fInear\fR]
214 Determines how long to wait for a response to a probe.
215 .br
216
217 .br
218 There are three (in general) float values separated by a comma
219 (or a slash).
220 .IR Max
221 specifies the maximum time (in seconds, default 5.0) to wait, in any case.
222 .br
223
224 .br
225 Traditional traceroute implementation always waited whole
226 .IR max
227 seconds for any probe. But if we already have some replies from the
228 .B same
229 hop, or even from some
230 .B next
231 hop, we can use the round trip time of such a reply as a hint
232 to determine the actual reasonable amount of time to wait.
233 .br
234
235 .br
236 The optional
237 .IR here
238 (default 3.0) specifies a factor to multiply the round trip time of an already
239 received response from the
240 .B same
241 hop. The resulting value is used as a timeout for the probe, instead of
242 (but no more than)
243 .IR max\fR.
244 The optional
245 .IR near
246 (default 10.0) specifies a similar factor for a response from some
247 .B next
248 hop.
249 (The time of the first found result is used in both cases).
250 .br
251
252 .br
253 First, we look for the
254 .B same
255 hop (of the probe which will be printed first from now).
256 If nothing found, then look for some
257 .B next
258 hop. If nothing found, use
259 .IR max\fR.
260 If
261 .IR here
262 and/or
263 .IR near
264 have zero values, the corresponding computation is skipped.
265 .br
266 .IR Here
267 and
268 .IR near
269 are always set to zero if only
270 .IR max
271 is specified (for compatibility with previous versions).
272 .TP
273 .BI \-q " nqueries" ", --queries=" nqueries
274 Sets the number of probe packets per hop. The default is 3.
275 .TP
276 .BI \-r
277 Bypass the normal routing tables and send directly to a host on
278 an attached network. If the host is not on a directly-attached
279 network, an error is returned. This option can be used to ping a
280 local host through an interface that has no route through it.
281 .TP
282 .BI \-s " source_addr" ", --source=" source_addr
283 Chooses an alternative source address. Note that you must select the
284 address of one of the interfaces.
285 By default, the address of the outgoing interface is used.
286 .TP
287 .BI \-z " sendwait" ", --sendwait=" sendwait
288 Minimal time interval between probes (default 0).
289 If the value is more than 10, then it specifies a number in milliseconds,
290 else it is a number of seconds (float point values allowed too).
291 Useful when some routers use rate-limit for ICMP messages.
292 .TP
293 .B \-e, \-\-extensions
294 Show ICMP extensions (rfc4884). The general form is
295 .I CLASS\fB/\fITYPE\fB:
296 followed by a hexadecimal dump.
297 The MPLS (rfc4950) is shown parsed, in a form:
298 .B MPLS:L=\fIlabel\fB,E=\fIexp_use\fB,S=\fIstack_bottom\fB,T=\fITTL
299 (more objects separated by
300 .B /
301 ). The Interface Information (rfc5837) is shown parsed as well, in a following form:
302 .B \fR{\fBINC\fR|\fBSUB\fR|\fBOUT\fR|\fBNXT\fR}\fB:\fIindex\fB,\fIIP_addr\fB,"\fIname\fB",mtu=\fIMTU\fB
303 (all four fields may be missing).
304 .TP
305 .B \-A, \-\-as\-path\-lookups
306 Perform AS path lookups in routing registries and print results
307 directly after the corresponding addresses.
308 .TP
309 .B \-V, \-\-version
310 Print the version and exit.
311 .br
312 .P
313 There are additional options intended for advanced usage
314 (such as alternate trace methods etc.):
315 .TP
316 .B \--sport\fR=\fIport
317 Chooses the source port to use. Implies
318 .B \-N\ 1\fR\ -w\ 5 .
319 Normally source ports (if applicable) are chosen by the system.
320 .TP
321 .B \--fwmark\fR=\fImark
322 Set the firewall mark for outgoing packets (since the Linux kernel 2.6.25).
323 .TP
324 .BI \-M " method" ", --module=" name
325 Use specified method for traceroute operations. Default traditional udp method
326 has name
327 .IR default ,
328 icmp
329 .BR "" ( "-I" ) "
330 and tcp
331 .BR "" ( "-T" ) "
332 have names
333 .I icmp
334 and
335 .I tcp
336 respectively.
337 .br
338 Method-specific options can be passed by
339 .BR \-O\ .
340 Most methods have their simple shortcuts,
341 .BR "" ( "-I " means " -M icmp" ,
342 etc).
343 .TP
344 .BI \-O " option" ", --options=" options
345 Specifies some method-specific option. Several options are separated by comma (or use several
346 .B \-O
347 on cmdline).
348 Each method may have its own specific options, or many not have them at all.
349 To print information about available options, use
350 .BR \-O\ help .
351 .TP
352 .B \-U, \-\-udp
353 Use UDP to particular destination port for tracerouting (instead of increasing
354 the port per each probe). Default port is 53 (dns).
355 .TP
356 .BI \-UL
357 Use UDPLITE for tracerouting (default port is 53).
358 .TP
359 .B \-D, \-\-dccp
360 Use DCCP Requests for probes.
361 .TP
362 .BI \-P " protocol" ", --protocol=" protocol
363 Use raw packet of specified protocol for tracerouting. Default protocol is
364 253 (rfc3692).
365 .TP
366 .BI \--mtu
367 Discover MTU along the path being traced. Implies
368 .BR \-F\ \-N\ 1 .
369 New
370 .I mtu
371 is printed once in a form of
372 .B F=\fINUM
373 at the first probe of a hop which requires such
374 .I mtu
375 to be reached. (Actually, the correspond "frag needed" icmp message
376 normally is sent by the previous hop).
377 .br
378
379 .br
380 Note, that some routers might cache once the seen information
381 on a fragmentation. Thus you can receive the final mtu from a closer hop.
382 Try to specify an unusual
383 .I tos
384 by
385 .B \-t
386 , this can help for one attempt (then it can be cached there as well).
387 .br
388 See
389 .B \-F
390 option for more info.
391 .TP
392 .BI \--back
393 Print the number of backward hops when it seems different with the forward
394 direction. This number is guessed in assumption that remote hops send reply
395 packets with initial ttl set to either 64, or 128 or 255 (which seems
396 a common practice). It is printed as a negate value in a form of '-NUM' .
397 .SH LIST OF AVAILABLE METHODS
398 In general, a particular traceroute method may have to be chosen by
399 .BR \-M\ name ,
400 but most of the methods have their simple cmdline switches
401 (you can see them after the method name, if present).
402 .SS default
403 The traditional, ancient method of tracerouting. Used by default.
404 .P
405 Probe packets are udp datagrams with so-called "unlikely" destination ports.
406 The "unlikely" port of the first probe is 33434, then for each next probe
407 it is incremented by one. Since the ports are expected to be unused,
408 the destination host normally returns "icmp unreach port" as a final response.
409 (Nobody knows what happens when some application listens for such ports,
410 though).
411 .P
412 This method is allowed for unprivileged users.
413 .SS icmp \ \ \ \-I
414 Most usual method for now, which uses icmp echo packets for probes.
415 .br
416 If you can ping(8) the destination host, icmp tracerouting is applicable
417 as well.
418 .P
419 This method may be allowed for unprivileged users
420 since the kernel 3.0 (IPv4, for IPv6 since 3.11), which supports new
421 .I dgram icmp
422 (or
423 .IR \fR"\fIping\fR")
424 sockets. To allow such sockets, sysadmin should provide
425 .I net/ipv4/ping_group_range
426 sysctl range to match any group of the user.
427 .br
428 Options:
429 .TP
430 .B raw
431 Use only raw sockets (the traditional way).
432 .br
433 This way is tried first by default (for compatibility reasons),
434 then new dgram icmp sockets as fallback.
435 .TP
436 .B dgram
437 Use only dgram icmp sockets.
438 .SS tcp \ \ \ \ \-T
439 Well-known modern method, intended to bypass firewalls.
440 .br
441 Uses the constant destination port (default is 80, http).
442 .P
443 If some filters are present in the network path, then most probably
444 any "unlikely" udp ports (as for
445 .I default
446 method) or even icmp echoes (as for
447 .IR icmp )
448 are filtered, and whole tracerouting will just stop at such a firewall.
449 To bypass a network filter, we have to use only allowed protocol/port
450 combinations. If we trace for some, say, mailserver, then more likely
451 .B \-T \-p 25
452 can reach it, even when
453 .B \-I
454 can not.
455 .P
456 This method uses well-known "half-open technique", which prevents
457 applications on the destination host from seeing our probes at all.
458 Normally, a tcp syn is sent. For non-listened ports we receive tcp reset,
459 and all is done. For active listening ports we receive tcp syn+ack, but
460 answer by tcp reset (instead of expected tcp ack), this way the remote tcp
461 session is dropped even without the application ever taking notice.
462 .P
463 There is a couple of options for
464 .I tcp
465 method:
466 .TP
467 .B syn,ack,fin,rst,psh,urg,ece,cwr
468 Sets specified tcp flags for probe packet, in any combination.
469 .TP
470 .B flags\fR=\fInum
471 Sets the flags field in the tcp header exactly to
472 .IR num .
473 .TP
474 .B ecn
475 Send syn packet with tcp flags ECE and CWR (for Explicit Congestion
476 Notification, rfc3168).
477 .TP
478 .B sack,timestamps,window_scaling
479 Use the corresponding tcp header option in the outgoing probe packet.
480 .TP
481 .B sysctl
482 Use current sysctl
483 .IR "" ( "/proc/sys/net/*" )
484 setting for the tcp header options above and
485 .BR ecn .
486 Always set by default, if nothing else specified.
487 .TP
488 .B fastopen
489 Use fastopen tcp option (when
490 .BR syn ),
491 for initial cookie negotiation only.
492 .TP
493 .B mss\fR=[\fInum\fR]
494 Use value of
495 .I num
496 (or unchanged) for maxseg tcp header option (when
497 .BR syn ),
498 and discover its clamping along the path being traced.
499 New changed
500 .I mss
501 is printed once in a form of
502 .B M=\fINUM
503 at the first probe on which it was detected.
504 Note, some routers may return too short original fragment
505 in the time exceeded message, making the check impossible.
506 Besides that the responses may come in a different order.
507 All this can lead to a later place of the report
508 (using
509 .BR \-N\ 1
510 can help for the order).
511 .TP
512 .B info
513 Print tcp flags and supported options
514 of final tcp replies when the target host is reached.
515 Allows to determine whether an application listens the port and
516 other useful things.
517 Supported tcp options are all that can be set by
518 .BR \-T\ \-O ,
519 ie.
520 .IR mss ,
521 .IR sack ,
522 .IR timestamps ,
523 .IR window_scaling
524 and
525 .IR fastopen ,
526 with the similar output format (a value for
527 .IR mss
528 and just presence for others).
529 .P
530 Default options is
531 .BR syn,sysctl .
532 .SS tcpconn
533 An initial implementation of tcp method, simple using connect(2) call,
534 which does full tcp session opening. Not recommended for normal use, because
535 a destination application is always affected (and can be confused).
536 .SS udp \ \ \ \ \-U
537 Use udp datagram with constant destination port (default 53, dns).
538 .br
539 Intended to bypass firewall as well.
540 .P
541 Note, that unlike in
542 .I tcp
543 method, the correspond application on the destination host
544 .B always
545 receive our probes (with random data), and most can easily be confused
546 by them. Most cases it will not respond to our packets though, so we will never
547 see the final hop in the trace. (Fortunately, it seems that at least
548 dns servers replies with something angry).
549 .P
550 This method is allowed for unprivileged users.
551 .SS udplite \ \ \-UL
552 Use udplite datagram for probes (with constant destination port,
553 default 53).
554 .P
555 This method is allowed for unprivileged users.
556 .br
557 Options:
558 .TP
559 .B coverage\fR=\fInum
560 Set udplite send coverage to
561 .IR num .
562 .SS dccp \ \ \-D
563 Use DCCP Request packets for probes (rfc4340).
564 .P
565 This method uses the same "half-open technique" as used for TCP.
566 The default destination port is 33434.
567 .P
568 Options:
569 .TP
570 .B service\fR=\fInum
571 Set DCCP service code to
572 .IR num
573 (default is 1885957735).
574 .SS raw \ \ \ \ \-P proto
575 Send raw packet of protocol
576 .IR proto .
577 .br
578 No protocol-specific headers are used, just IP header only.
579 .br
580 Implies
581 .B \-N\ 1\fR\ -w\ 5 .
582 .br
583 Options:
584 .TP
585 .B protocol\fR=\fIproto
586 Use IP protocol
587 .I proto
588 (default 253).
589 .SH NOTES
590 .PP
591 To speed up work, normally several probes are sent simultaneously.
592 On the other hand, it creates a "storm of packages", especially
593 in the reply direction. Routers can throttle the rate of icmp responses,
594 and some of replies can be lost. To avoid this, decrease the number
595 of simultaneous probes, or even set it to 1 (like in initial traceroute
596 implementation), i.e.
597 .B \-N 1
598 .PP
599 The final (target) host can drop some of the simultaneous probes,
600 and might even answer only the latest ones. It can lead to extra
601 "looks like expired" hops near the final hop. We use a smart algorithm
602 to auto-detect such a situation, but if it cannot help in your case, just use
603 .B \-N 1
604 too.
605 .PP
606 For even greater stability you can slow down the program's work by
607 .B \-z
608 option, for example use
609 .B \-z 0.5
610 for half-second pause between probes.
611 .PP
612 To avoid an extra waiting, we use adaptive algorithm for timeouts (see
613 .B \-w
614 option for more info). It can lead to premature expiry
615 (especially when response times differ at times) and printing "*"
616 instead of a time. In such a case, switch this algorithm off, by specifying
617 .B \-w
618 with the desired timeout only (for example,
619 .B \-w 5\fR).
620 .PP
621 If some hops report nothing for every method, the last chance to obtain
622 something is to use
623 .B ping -R
624 command (IPv4, and for nearest 8 hops only).
625 .SH SEE ALSO
626 .BR ping (8),
627 .BR ping6 (8),
628 .BR tcpdump (8),
629 .BR netstat (8)