Debian Codegraph @

upstream/opensuse-leap-16-1/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 ).
302 .TP
303 .B \-A, \-\-as\-path\-lookups
304 Perform AS path lookups in routing registries and print results
305 directly after the corresponding addresses.
306 .TP
307 .B \-V, \-\-version
308 Print the version and exit.
309 .br
310 .P
311 There are additional options intended for advanced usage
312 (such as alternate trace methods etc.):
313 .TP
314 .B \--sport\fR=\fIport
315 Chooses the source port to use. Implies
316 .B \-N\ 1\fR\ -w\ 5 .
317 Normally source ports (if applicable) are chosen by the system.
318 .TP
319 .B \--fwmark\fR=\fImark
320 Set the firewall mark for outgoing packets (since the Linux kernel 2.6.25).
321 .TP
322 .BI \-M " method" ", --module=" name
323 Use specified method for traceroute operations. Default traditional udp method
324 has name
325 .IR default ,
326 icmp
327 .BR "" ( "-I" ) "
328 and tcp
329 .BR "" ( "-T" ) "
330 have names
331 .I icmp
332 and
333 .I tcp
334 respectively.
335 .br
336 Method-specific options can be passed by
337 .BR \-O\ .
338 Most methods have their simple shortcuts,
339 .BR "" ( "-I " means " -M icmp" ,
340 etc).
341 .TP
342 .BI \-O " option" ", --options=" options
343 Specifies some method-specific option. Several options are separated by comma (or use several
344 .B \-O
345 on cmdline).
346 Each method may have its own specific options, or many not have them at all.
347 To print information about available options, use
348 .BR \-O\ help .
349 .TP
350 .B \-U, \-\-udp
351 Use UDP to particular destination port for tracerouting (instead of increasing
352 the port per each probe). Default port is 53 (dns).
353 .TP
354 .BI \-UL
355 Use UDPLITE for tracerouting (default port is 53).
356 .TP
357 .B \-D, \-\-dccp
358 Use DCCP Requests for probes.
359 .TP
360 .BI \-P " protocol" ", --protocol=" protocol
361 Use raw packet of specified protocol for tracerouting. Default protocol is
362 253 (rfc3692).
363 .TP
364 .BI \--mtu
365 Discover MTU along the path being traced. Implies
366 .BR \-F\ \-N\ 1 .
367 New
368 .I mtu
369 is printed once in a form of
370 .B F=\fINUM
371 at the first probe of a hop which requires such
372 .I mtu
373 to be reached. (Actually, the correspond "frag needed" icmp message
374 normally is sent by the previous hop).
375 .br
376
377 .br
378 Note, that some routers might cache once the seen information
379 on a fragmentation. Thus you can receive the final mtu from a closer hop.
380 Try to specify an unusual
381 .I tos
382 by
383 .B \-t
384 , this can help for one attempt (then it can be cached there as well).
385 .br
386 See
387 .B \-F
388 option for more info.
389 .TP
390 .BI \--back
391 Print the number of backward hops when it seems different with the forward
392 direction. This number is guessed in assumption that remote hops send reply
393 packets with initial ttl set to either 64, or 128 or 255 (which seems
394 a common practice). It is printed as a negate value in a form of '-NUM' .
395 .SH LIST OF AVAILABLE METHODS
396 In general, a particular traceroute method may have to be chosen by
397 .BR \-M\ name ,
398 but most of the methods have their simple cmdline switches
399 (you can see them after the method name, if present).
400 .SS default
401 The traditional, ancient method of tracerouting. Used by default.
402 .P
403 Probe packets are udp datagrams with so-called "unlikely" destination ports.
404 The "unlikely" port of the first probe is 33434, then for each next probe
405 it is incremented by one. Since the ports are expected to be unused,
406 the destination host normally returns "icmp unreach port" as a final response.
407 (Nobody knows what happens when some application listens for such ports,
408 though).
409 .P
410 This method is allowed for unprivileged users.
411 .SS icmp \ \ \ \-I
412 Most usual method for now, which uses icmp echo packets for probes.
413 .br
414 If you can ping(8) the destination host, icmp tracerouting is applicable
415 as well.
416 .P
417 This method may be allowed for unprivileged users
418 since the kernel 3.0 (IPv4, for IPv6 since 3.11), which supports new
419 .I dgram icmp
420 (or
421 .IR \fR"\fIping\fR")
422 sockets. To allow such sockets, sysadmin should provide
423 .I net/ipv4/ping_group_range
424 sysctl range to match any group of the user.
425 .br
426 Options:
427 .TP
428 .B raw
429 Use only raw sockets (the traditional way).
430 .br
431 This way is tried first by default (for compatibility reasons),
432 then new dgram icmp sockets as fallback.
433 .TP
434 .B dgram
435 Use only dgram icmp sockets.
436 .SS tcp \ \ \ \ \-T
437 Well-known modern method, intended to bypass firewalls.
438 .br
439 Uses the constant destination port (default is 80, http).
440 .P
441 If some filters are present in the network path, then most probably
442 any "unlikely" udp ports (as for
443 .I default
444 method) or even icmp echoes (as for
445 .IR icmp )
446 are filtered, and whole tracerouting will just stop at such a firewall.
447 To bypass a network filter, we have to use only allowed protocol/port
448 combinations. If we trace for some, say, mailserver, then more likely
449 .B \-T \-p 25
450 can reach it, even when
451 .B \-I
452 can not.
453 .P
454 This method uses well-known "half-open technique", which prevents
455 applications on the destination host from seeing our probes at all.
456 Normally, a tcp syn is sent. For non-listened ports we receive tcp reset,
457 and all is done. For active listening ports we receive tcp syn+ack, but
458 answer by tcp reset (instead of expected tcp ack), this way the remote tcp
459 session is dropped even without the application ever taking notice.
460 .P
461 There is a couple of options for
462 .I tcp
463 method:
464 .TP
465 .B syn,ack,fin,rst,psh,urg,ece,cwr
466 Sets specified tcp flags for probe packet, in any combination.
467 .TP
468 .B flags\fR=\fInum
469 Sets the flags field in the tcp header exactly to
470 .IR num .
471 .TP
472 .B ecn
473 Send syn packet with tcp flags ECE and CWR (for Explicit Congestion
474 Notification, rfc3168).
475 .TP
476 .B sack,timestamps,window_scaling
477 Use the corresponding tcp header option in the outgoing probe packet.
478 .TP
479 .B sysctl
480 Use current sysctl
481 .IR "" ( "/proc/sys/net/*" )
482 setting for the tcp header options above and
483 .BR ecn .
484 Always set by default, if nothing else specified.
485 .TP
486 .B mss\fR=\fInum
487 Use value of
488 .I num
489 for maxseg tcp header option (when
490 .BR syn ).
491 .TP
492 .B info
493 Print tcp flags of final tcp replies when the target host is reached.
494 Allows to determine whether an application listens the port and
495 other useful things.
496 .P
497 Default options is
498 .BR syn,sysctl .
499 .SS tcpconn
500 An initial implementation of tcp method, simple using connect(2) call,
501 which does full tcp session opening. Not recommended for normal use, because
502 a destination application is always affected (and can be confused).
503 .SS udp \ \ \ \ \-U
504 Use udp datagram with constant destination port (default 53, dns).
505 .br
506 Intended to bypass firewall as well.
507 .P
508 Note, that unlike in
509 .I tcp
510 method, the correspond application on the destination host
511 .B always
512 receive our probes (with random data), and most can easily be confused
513 by them. Most cases it will not respond to our packets though, so we will never
514 see the final hop in the trace. (Fortunately, it seems that at least
515 dns servers replies with something angry).
516 .P
517 This method is allowed for unprivileged users.
518 .SS udplite \ \ \-UL
519 Use udplite datagram for probes (with constant destination port,
520 default 53).
521 .P
522 This method is allowed for unprivileged users.
523 .br
524 Options:
525 .TP
526 .B coverage\fR=\fInum
527 Set udplite send coverage to
528 .IR num .
529 .SS dccp \ \ \-D
530 Use DCCP Request packets for probes (rfc4340).
531 .P
532 This method uses the same "half-open technique" as used for TCP.
533 The default destination port is 33434.
534 .P
535 Options:
536 .TP
537 .B service\fR=\fInum
538 Set DCCP service code to
539 .IR num
540 (default is 1885957735).
541 .SS raw \ \ \ \ \-P proto
542 Send raw packet of protocol
543 .IR proto .
544 .br
545 No protocol-specific headers are used, just IP header only.
546 .br
547 Implies
548 .B \-N\ 1\fR\ -w\ 5 .
549 .br
550 Options:
551 .TP
552 .B protocol\fR=\fIproto
553 Use IP protocol
554 .I proto
555 (default 253).
556 .SH NOTES
557 .PP
558 To speed up work, normally several probes are sent simultaneously.
559 On the other hand, it creates a "storm of packages", especially
560 in the reply direction. Routers can throttle the rate of icmp responses,
561 and some of replies can be lost. To avoid this, decrease the number
562 of simultaneous probes, or even set it to 1 (like in initial traceroute
563 implementation), i.e.
564 .B \-N 1
565 .PP
566 The final (target) host can drop some of the simultaneous probes,
567 and might even answer only the latest ones. It can lead to extra
568 "looks like expired" hops near the final hop. We use a smart algorithm
569 to auto-detect such a situation, but if it cannot help in your case, just use
570 .B \-N 1
571 too.
572 .PP
573 For even greater stability you can slow down the program's work by
574 .B \-z
575 option, for example use
576 .B \-z 0.5
577 for half-second pause between probes.
578 .PP
579 To avoid an extra waiting, we use adaptive algorithm for timeouts (see
580 .B \-w
581 option for more info). It can lead to premature expiry
582 (especially when response times differ at times) and printing "*"
583 instead of a time. In such a case, switch this algorithm off, by specifying
584 .B \-w
585 with the desired timeout only (for example,
586 .B \-w 5\fR).
587 .PP
588 If some hops report nothing for every method, the last chance to obtain
589 something is to use
590 .B ping -R
591 command (IPv4, and for nearest 8 hops only).
592 .SH SEE ALSO
593 .BR ping (8),
594 .BR ping6 (8),
595 .BR tcpdump (8),
596 .BR netstat (8)