1TRACEROUTE(8) Traceroute For Linux TRACEROUTE(8)
2
3
4
6 traceroute - print the route packets trace to network host
7
9 traceroute [-46dFITUnreAV] [-f first_ttl] [-g gate,...]
10 [-i device] [-m max_ttl] [-p port] [-s src_addr]
11 [-q nqueries] [-N squeries] [-t tos]
12 [-l flow_label] [-w waittimes] [-z sendwait] [-UL] [-D]
13 [-P proto] [--sport=port] [-M method] [-O mod_options]
14 [--mtu] [--back]
15 host [packet_len]
16 traceroute6 [options]
17
19 traceroute tracks the route packets taken from an IP network on their
20 way to a given host. It utilizes the IP protocol's time to live (TTL)
21 field and attempts to elicit an ICMP TIME_EXCEEDED response from each
22 gateway along the path to the host.
23
24 traceroute6 is equivalent to traceroute -6
25
26 The only required parameter is the name or IP address of the destina‐
27 tion host . The optional packet_len`gth is the total size of the prob‐
28 ing packet (default 60 bytes for IPv4 and 80 for IPv6). The specified
29 size can be ignored in some situations or increased up to a minimal
30 value.
31
32 This program attempts to trace the route an IP packet would follow to
33 some internet host by launching probe packets with a small ttl (time to
34 live) then listening for an ICMP "time exceeded" reply from a gateway.
35 We start our probes with a ttl of one and increase by one until we get
36 an ICMP "port unreachable" (or TCP reset), which means we got to the
37 "host", or hit a max (which defaults to 30 hops). Three probes (by de‐
38 fault) are sent at each ttl setting and a line is printed showing the
39 ttl, address of the gateway and round trip time of each probe. The ad‐
40 dress can be followed by additional information when requested. If the
41 probe answers come from different gateways, the address of each re‐
42 sponding system will be printed. If there is no response within a cer‐
43 tain timeout, an "*" (asterisk) is printed for that probe.
44
45 After the trip time, some additional annotation can be printed: !H, !N,
46 or !P (host, network or protocol unreachable), !S (source route
47 failed), !F (fragmentation needed), !X (communication administratively
48 prohibited), !V (host precedence violation), !C (precedence cutoff in
49 effect), or !<num> (ICMP unreachable code <num>). If almost all the
50 probes result in some kind of unreachable, traceroute will give up and
51 exit.
52
53 We don't want the destination host to process the UDP probe packets, so
54 the destination port is set to an unlikely value (you can change it
55 with the -p flag). There is no such a problem for ICMP or TCP tracer‐
56 outing (for TCP we use half-open technique, which prevents our probes
57 to be seen by applications on the destination host).
58
59 In the modern network environment the traditional traceroute methods
60 can not be always applicable, because of widespread use of firewalls.
61 Such firewalls filter the "unlikely" UDP ports, or even ICMP echoes.
62 To solve this, some additional tracerouting methods are implemented
63 (including tcp), see LIST OF AVAILABLE METHODS below. Such methods try
64 to use particular protocol and source/destination port, in order to by‐
65 pass firewalls (to be seen by firewalls just as a start of allowed type
66 of a network session).
67
69 --help Print help info and exit.
70
71 -4, -6 Explicitly force IPv4 or IPv6 tracerouting. By default, the pro‐
72 gram will try to resolve the name given, and choose the appro‐
73 priate protocol automatically. If resolving a host name returns
74 both IPv4 and IPv6 addresses, traceroute will use IPv4.
75
76 -I, --icmp
77 Use ICMP ECHO for probes
78
79 -T, --tcp
80 Use TCP SYN for probes
81
82 -d, --debug
83 Enable socket level debugging (when the Linux kernel supports
84 it)
85
86 -F, --dont-fragment
87 Do not fragment probe packets. (For IPv4 it also sets DF bit,
88 which tells intermediate routers not to fragment remotely as
89 well).
90
91 Varying the size of the probing packet by the packet_len command
92 line parameter, you can manually obtain information about the
93 MTU of individual network hops. The --mtu option (see below)
94 tries to do this automatically.
95
96 Note, that non-fragmented features (like -F or --mtu) work prop‐
97 erly since the Linux kernel 2.6.22 only. Before that version,
98 IPv6 was always fragmented, IPv4 could use the once the discov‐
99 ered final mtu only (from the route cache), which can be less
100 than the actual mtu of a device.
101
102 -f first_ttl, --first=first_ttl
103 Specifies with what TTL to start. Defaults to 1.
104
105 -g gateway, --gateway=gateway
106 Tells traceroute to add an IP source routing option to the out‐
107 going packet that tells the network to route the packet through
108 the specified gateway (most routers have disabled source routing
109 for security reasons). In general, several gateway's is allowed
110 (comma separated). For IPv6, the form of num,addr,addr... is
111 allowed, where num is a route header type (default is type 2).
112 Note the type 0 route header is now deprecated (rfc5095).
113
114 -i interface, --interface=interface
115 Specifies the interface through which traceroute should send
116 packets. By default, the interface is selected according to the
117 routing table.
118
119 -m max_ttl, --max-hops=max_ttl
120 Specifies the maximum number of hops (max time-to-live value)
121 traceroute will probe. The default is 30.
122
123 -N squeries, --sim-queries=squeries
124 Specifies the number of probe packets sent out simultaneously.
125 Sending several probes concurrently can speed up traceroute con‐
126 siderably. The default value is 16.
127 Note that some routers and hosts can use ICMP rate throttling.
128 In such a situation specifying too large number can lead to loss
129 of some responses.
130
131 -n Do not try to map IP addresses to host names when displaying
132 them.
133
134 -p port, --port=port
135 For UDP tracing, specifies the destination port base traceroute
136 will use (the destination port number will be incremented by
137 each probe).
138 For ICMP tracing, specifies the initial ICMP sequence value (in‐
139 cremented by each probe too).
140 For TCP and others specifies just the (constant) destination
141 port to connect.
142
143 -t tos, --tos=tos
144 For IPv4, set the Type of Service (TOS) and Precedence value.
145 Useful values are 16 (low delay) and 8 (high throughput). Note
146 that in order to use some TOS precedence values, you have to be
147 super user.
148 For IPv6, set the Traffic Control value.
149
150 -l flow_label, --flowlabel=flow_label
151 Use specified flow_label for IPv6 packets.
152
153 -w max[,here,near], --wait=max[,here,near]
154 Determines how long to wait for a response to a probe.
155
156 There are three (in general) float values separated by a comma
157 (or a slash). Max specifies the maximum time (in seconds, de‐
158 fault 5.0) to wait, in any case.
159
160 Traditional traceroute implementation always waited whole max
161 seconds for any probe. But if we already have some replies from
162 the same hop, or even from some next hop, we can use the round
163 trip time of such a reply as a hint to determine the actual rea‐
164 sonable amount of time to wait.
165
166 The optional here (default 3.0) specifies a factor to multiply
167 the round trip time of an already received response from the
168 same hop. The resulting value is used as a timeout for the
169 probe, instead of (but no more than) max. The optional near
170 (default 10.0) specifies a similar factor for a response from
171 some next hop. (The time of the first found result is used in
172 both cases).
173
174 First, we look for the same hop (of the probe which will be
175 printed first from now). If nothing found, then look for some
176 next hop. If nothing found, use max. If here and/or near have
177 zero values, the corresponding computation is skipped.
178 Here and near are always set to zero if only max is specified
179 (for compatibility with previous versions).
180
181 -q nqueries, --queries=nqueries
182 Sets the number of probe packets per hop. The default is 3.
183
184 -r Bypass the normal routing tables and send directly to a host on
185 an attached network. If the host is not on a directly-attached
186 network, an error is returned. This option can be used to ping
187 a local host through an interface that has no route through it.
188
189 -s source_addr, --source=source_addr
190 Chooses an alternative source address. Note that you must select
191 the address of one of the interfaces. By default, the address
192 of the outgoing interface is used.
193
194 -z sendwait, --sendwait=sendwait
195 Minimal time interval between probes (default 0). If the value
196 is more than 10, then it specifies a number in milliseconds,
197 else it is a number of seconds (float point values allowed too).
198 Useful when some routers use rate-limit for ICMP messages.
199
200 -e, --extensions
201 Show ICMP extensions (rfc4884). The general form is CLASS/TYPE:
202 followed by a hexadecimal dump. The MPLS (rfc4950) is shown
203 parsed, in a form: MPLS:L=label,E=exp_use,S=stack_bottom,T=TTL
204 (more objects separated by / ). The Interface Information
205 (rfc5837) is shown parsed as well, in a following form:
206 {INC|SUB|OUT|NXT}:index,IP_addr,"name",mtu=MTU (all four fields
207 may be missing).
208
209 -A, --as-path-lookups
210 Perform AS path lookups in routing registries and print results
211 directly after the corresponding addresses.
212
213 -V, --version
214 Print the version and exit.
215
216 There are additional options intended for advanced usage (such as al‐
217 ternate trace methods etc.):
218
219 --sport=port
220 Chooses the source port to use. Implies -N 1 -w 5 . Normally
221 source ports (if applicable) are chosen by the system.
222
223 --fwmark=mark
224 Set the firewall mark for outgoing packets (since the Linux ker‐
225 nel 2.6.25).
226
227 -M method, --module=name
228 Use specified method for traceroute operations. Default tradi‐
229 tional udp method has name default, icmp (-I) and tcp (-T) have
230 names icmp and tcp respectively.
231 Method-specific options can be passed by -O . Most methods have
232 their simple shortcuts, (-I means -M icmp, etc).
233
234 -O option, --options=options
235 Specifies some method-specific option. Several options are sepa‐
236 rated by comma (or use several -O on cmdline). Each method may
237 have its own specific options, or many not have them at all. To
238 print information about available options, use -O help.
239
240 -U, --udp
241 Use UDP to particular destination port for tracerouting (instead
242 of increasing the port per each probe). Default port is 53
243 (dns).
244
245 -UL Use UDPLITE for tracerouting (default port is 53).
246
247 -D, --dccp
248 Use DCCP Requests for probes.
249
250 -P protocol, --protocol=protocol
251 Use raw packet of specified protocol for tracerouting. Default
252 protocol is 253 (rfc3692).
253
254 --mtu Discover MTU along the path being traced. Implies -F -N 1. New
255 mtu is printed once in a form of F=NUM at the first probe of a
256 hop which requires such mtu to be reached. (Actually, the corre‐
257 spond "frag needed" icmp message normally is sent by the previ‐
258 ous hop).
259
260 Note, that some routers might cache once the seen information on
261 a fragmentation. Thus you can receive the final mtu from a
262 closer hop. Try to specify an unusual tos by -t , this can help
263 for one attempt (then it can be cached there as well).
264 See -F option for more info.
265
266 --back Print the number of backward hops when it seems different with
267 the forward direction. This number is guessed in assumption that
268 remote hops send reply packets with initial ttl set to either
269 64, or 128 or 255 (which seems a common practice). It is printed
270 as a negate value in a form of '-NUM' .
271
273 In general, a particular traceroute method may have to be chosen by
274 -M name, but most of the methods have their simple cmdline switches
275 (you can see them after the method name, if present).
276
277 default
278 The traditional, ancient method of tracerouting. Used by default.
279
280 Probe packets are udp datagrams with so-called "unlikely" destination
281 ports. The "unlikely" port of the first probe is 33434, then for each
282 next probe it is incremented by one. Since the ports are expected to be
283 unused, the destination host normally returns "icmp unreach port" as a
284 final response. (Nobody knows what happens when some application lis‐
285 tens for such ports, though).
286
287 This method is allowed for unprivileged users.
288
289 icmp -I
290 Most usual method for now, which uses icmp echo packets for probes.
291 If you can ping(8) the destination host, icmp tracerouting is applica‐
292 ble as well.
293
294 This method may be allowed for unprivileged users since the kernel 3.0
295 (IPv4, for IPv6 since 3.11), which supports new dgram icmp (or "ping")
296 sockets. To allow such sockets, sysadmin should provide
297 net/ipv4/ping_group_range sysctl range to match any group of the user.
298 Options:
299
300 raw Use only raw sockets (the traditional way).
301 This way is tried first by default (for compatibility reasons),
302 then new dgram icmp sockets as fallback.
303
304 dgram Use only dgram icmp sockets.
305
306 tcp -T
307 Well-known modern method, intended to bypass firewalls.
308 Uses the constant destination port (default is 80, http).
309
310 If some filters are present in the network path, then most probably any
311 "unlikely" udp ports (as for default method) or even icmp echoes (as
312 for icmp) are filtered, and whole tracerouting will just stop at such a
313 firewall. To bypass a network filter, we have to use only allowed pro‐
314 tocol/port combinations. If we trace for some, say, mailserver, then
315 more likely -T -p 25 can reach it, even when -I can not.
316
317 This method uses well-known "half-open technique", which prevents ap‐
318 plications on the destination host from seeing our probes at all. Nor‐
319 mally, a tcp syn is sent. For non-listened ports we receive tcp reset,
320 and all is done. For active listening ports we receive tcp syn+ack, but
321 answer by tcp reset (instead of expected tcp ack), this way the remote
322 tcp session is dropped even without the application ever taking notice.
323
324 There is a couple of options for tcp method:
325
326 syn,ack,fin,rst,psh,urg,ece,cwr
327 Sets specified tcp flags for probe packet, in any combination.
328
329 flags=num
330 Sets the flags field in the tcp header exactly to num.
331
332 ecn Send syn packet with tcp flags ECE and CWR (for Explicit Conges‐
333 tion Notification, rfc3168).
334
335 sack,timestamps,window_scaling
336 Use the corresponding tcp header option in the outgoing probe
337 packet.
338
339 sysctl Use current sysctl (/proc/sys/net/*) setting for the tcp header
340 options above and ecn. Always set by default, if nothing else
341 specified.
342
343 fastopen
344 Use fastopen tcp option (when syn), for initial cookie negotia‐
345 tion only.
346
347 mss=[num]
348 Use value of num (or unchanged) for maxseg tcp header option
349 (when syn), and discover its clamping along the path being
350 traced. New changed mss is printed once in a form of M=NUM at
351 the first probe on which it was detected. Note, some routers
352 may return too short original fragment in the time exceeded mes‐
353 sage, making the check impossible. Besides that the responses
354 may come in a different order. All this can lead to a later
355 place of the report (using -N 1 can help for the order).
356
357 info Print tcp flags and supported options of final tcp replies when
358 the target host is reached. Allows to determine whether an ap‐
359 plication listens the port and other useful things. Supported
360 tcp options are all that can be set by -T -O, ie. mss, sack,
361 timestamps, window_scaling and fastopen, with the similar output
362 format (a value for mss and just presence for others).
363
364 Default options is syn,sysctl.
365
366 tcpconn
367 An initial implementation of tcp method, simple using connect(2) call,
368 which does full tcp session opening. Not recommended for normal use,
369 because a destination application is always affected (and can be con‐
370 fused).
371
372 udp -U
373 Use udp datagram with constant destination port (default 53, dns).
374 Intended to bypass firewall as well.
375
376 Note, that unlike in tcp method, the correspond application on the des‐
377 tination host always receive our probes (with random data), and most
378 can easily be confused by them. Most cases it will not respond to our
379 packets though, so we will never see the final hop in the trace. (For‐
380 tunately, it seems that at least dns servers replies with something an‐
381 gry).
382
383 This method is allowed for unprivileged users.
384
385 udplite -UL
386 Use udplite datagram for probes (with constant destination port, de‐
387 fault 53).
388
389 This method is allowed for unprivileged users.
390 Options:
391
392 coverage=num
393 Set udplite send coverage to num.
394
395 dccp -D
396 Use DCCP Request packets for probes (rfc4340).
397
398 This method uses the same "half-open technique" as used for TCP. The
399 default destination port is 33434.
400
401 Options:
402
403 service=num
404 Set DCCP service code to num (default is 1885957735).
405
406 raw -P proto
407 Send raw packet of protocol proto.
408 No protocol-specific headers are used, just IP header only.
409 Implies -N 1 -w 5 .
410 Options:
411
412 protocol=proto
413 Use IP protocol proto (default 253).
414
416 To speed up work, normally several probes are sent simultaneously. On
417 the other hand, it creates a "storm of packages", especially in the re‐
418 ply direction. Routers can throttle the rate of icmp responses, and
419 some of replies can be lost. To avoid this, decrease the number of si‐
420 multaneous probes, or even set it to 1 (like in initial traceroute im‐
421 plementation), i.e. -N 1
422
423 The final (target) host can drop some of the simultaneous probes, and
424 might even answer only the latest ones. It can lead to extra "looks
425 like expired" hops near the final hop. We use a smart algorithm to
426 auto-detect such a situation, but if it cannot help in your case, just
427 use -N 1 too.
428
429 For even greater stability you can slow down the program's work by -z
430 option, for example use -z 0.5 for half-second pause between probes.
431
432 To avoid an extra waiting, we use adaptive algorithm for timeouts (see
433 -w option for more info). It can lead to premature expiry (especially
434 when response times differ at times) and printing "*" instead of a
435 time. In such a case, switch this algorithm off, by specifying -w with
436 the desired timeout only (for example, -w 5).
437
438 If some hops report nothing for every method, the last chance to obtain
439 something is to use ping -R command (IPv4, and for nearest 8 hops
440 only).
441
443 ping(8), ping6(8), tcpdump(8), netstat(8)
444
445
446
447Traceroute 11 October 2006 TRACEROUTE(8)