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 waittime] [-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
38 default) 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
40 address can be followed by additional information when requested. If
41 the probe answers come from different gateways, the address of each
42 responding system will be printed. If there is no response within a
43 5.0 seconds (default), 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
65 bypass firewalls (to be seen by firewalls just as a start of allowed
66 type 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
139 (incremented 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 waittime, --wait=waittime
154 Set the time (in seconds) to wait for a response to a probe
155 (default 5.0 sec).
156
157 -q nqueries, --queries=nqueries
158 Sets the number of probe packets per hop. The default is 3.
159
160 -r Bypass the normal routing tables and send directly to a host on
161 an attached network. If the host is not on a directly-attached
162 network, an error is returned. This option can be used to ping
163 a local host through an interface that has no route through it.
164
165 -s source_addr, --source=source_addr
166 Chooses an alternative source address. Note that you must select
167 the address of one of the interfaces. By default, the address
168 of the outgoing interface is used.
169
170 -z sendwait, --sendwait=sendwait
171 Minimal time interval between probes (default 0). If the value
172 is more than 10, then it specifies a number in milliseconds,
173 else it is a number of seconds (float point values allowed too).
174 Useful when some routers use rate-limit for ICMP messages.
175
176 -e, --extensions
177 Show ICMP extensions (rfc4884). The general form is CLASS/TYPE:
178 followed by a hexadecimal dump. The MPLS (rfc4950) is shown
179 parsed, in a form: MPLS:L=label,E=exp_use,S=stack_bottom,T=TTL
180 (more objects separated by / ).
181
182 -A, --as-path-lookups
183 Perform AS path lookups in routing registries and print results
184 directly after the corresponding addresses.
185
186 -V, --version
187 Print the version and exit.
188
189 There are additional options intended for advanced usage (such as
190 alternate trace methods etc.):
191
192 --sport=port
193 Chooses the source port to use. Implies -N 1. Normally source
194 ports (if applicable) are chosen by the system.
195
196 --fwmark=mark
197 Set the firewall mark for outgoing packets (since the Linux ker‐
198 nel 2.6.25).
199
200 -M method, --module=name
201 Use specified method for traceroute operations. Default tradi‐
202 tional udp method has name default, icmp (-I) and tcp (-T) have
203 names icmp and tcp respectively.
204 Method-specific options can be passed by -O . Most methods have
205 their simple shortcuts, (-I means -M icmp, etc).
206
207 -O option, --options=options
208 Specifies some method-specific option. Several options are sepa‐
209 rated by comma (or use several -O on cmdline). Each method may
210 have its own specific options, or many not have them at all. To
211 print information about available options, use -O help.
212
213 -U, --udp
214 Use UDP to particular destination port for tracerouting (instead
215 of increasing the port per each probe). Default port is 53
216 (dns).
217
218 -UL Use UDPLITE for tracerouting (default port is 53).
219
220 -D, --dccp
221 Use DCCP Requests for probes.
222
223 -P protocol, --protocol=protocol
224 Use raw packet of specified protocol for tracerouting. Default
225 protocol is 253 (rfc3692).
226
227 --mtu Discover MTU along the path being traced. Implies -F -N 1. New
228 mtu is printed once in a form of F=NUM at the first probe of a
229 hop which requires such mtu to be reached. (Actually, the corre‐
230 spond "frag needed" icmp message normally is sent by the previ‐
231 ous hop).
232
233 Note, that some routers might cache once the seen information on
234 a fragmentation. Thus you can receive the final mtu from a
235 closer hop. Try to specify an unusual tos by -t , this can help
236 for one attempt (then it can be cached there as well).
237 See -F option for more info.
238
239 --back Print the number of backward hops when it seems different with
240 the forward direction. This number is guessed in assumption that
241 remote hops send reply packets with initial ttl set to either
242 64, or 128 or 255 (which seems a common practice). It is printed
243 as a negate value in a form of '-NUM' .
244
246 In general, a particular traceroute method may have to be chosen by
247 -M name, but most of the methods have their simple cmdline switches
248 (you can see them after the method name, if present).
249
250 default
251 The traditional, ancient method of tracerouting. Used by default.
252
253 Probe packets are udp datagrams with so-called "unlikely" destination
254 ports. The "unlikely" port of the first probe is 33434, then for each
255 next probe it is incremented by one. Since the ports are expected to be
256 unused, the destination host normally returns "icmp unreach port" as a
257 final response. (Nobody knows what happens when some application lis‐
258 tens for such ports, though).
259
260 This method is allowed for unprivileged users.
261
262 icmp -I
263 Most usual method for now, which uses icmp echo packets for probes.
264 If you can ping(8) the destination host, icmp tracerouting is applica‐
265 ble as well.
266
267 This method may be allowed for unprivileged users since the kernel 3.0
268 (IPv4 only), which supports new dgram icmp (or "ping") sockets. To
269 allow such sockets, sysadmin should provide net/ipv4/ping_group_range
270 sysctl range to match any group of the user.
271 Options:
272
273 raw Use only raw sockets (the traditional way).
274 This way is tried first by default (for compatibility reasons),
275 then new dgram icmp sockets as fallback.
276
277 dgram Use only dgram icmp sockets.
278
279 tcp -T
280 Well-known modern method, intended to bypass firewalls.
281 Uses the constant destination port (default is 80, http).
282
283 If some filters are present in the network path, then most probably any
284 "unlikely" udp ports (as for default method) or even icmp echoes (as
285 for icmp) are filtered, and whole tracerouting will just stop at such a
286 firewall. To bypass a network filter, we have to use only allowed pro‐
287 tocol/port combinations. If we trace for some, say, mailserver, then
288 more likely -T -p 25 can reach it, even when -I can not.
289
290 This method uses well-known "half-open technique", which prevents
291 applications on the destination host from seeing our probes at all.
292 Normally, a tcp syn is sent. For non-listened ports we receive tcp
293 reset, and all is done. For active listening ports we receive tcp
294 syn+ack, but answer by tcp reset (instead of expected tcp ack), this
295 way the remote tcp session is dropped even without the application ever
296 taking notice.
297
298 There is a couple of options for tcp method:
299
300 syn,ack,fin,rst,psh,urg,ece,cwr
301 Sets specified tcp flags for probe packet, in any combination.
302
303 flags=num
304 Sets the flags field in the tcp header exactly to num.
305
306 ecn Send syn packet with tcp flags ECE and CWR (for Explicit Conges‐
307 tion Notification, rfc3168).
308
309 sack,timestamps,window_scaling
310 Use the corresponding tcp header option in the outgoing probe
311 packet.
312
313 sysctl Use current sysctl (/proc/sys/net/*) setting for the tcp header
314 options above and ecn. Always set by default, if nothing else
315 specified.
316
317 mss=num
318 Use value of num for maxseg tcp header option (when syn).
319
320 info Print tcp flags of final tcp replies when the target host is
321 reached. Allows to determine whether an application listens the
322 port and other useful things.
323
324 Default options is syn,sysctl.
325
326 tcpconn
327 An initial implementation of tcp method, simple using connect(2) call,
328 which does full tcp session opening. Not recommended for normal use,
329 because a destination application is always affected (and can be con‐
330 fused).
331
332 udp -U
333 Use udp datagram with constant destination port (default 53, dns).
334 Intended to bypass firewall as well.
335
336 Note, that unlike in tcp method, the correspond application on the des‐
337 tination host always receive our probes (with random data), and most
338 can easily be confused by them. Most cases it will not respond to our
339 packets though, so we will never see the final hop in the trace. (For‐
340 tunately, it seems that at least dns servers replies with something
341 angry).
342
343 This method is allowed for unprivileged users.
344
345 udplite -UL
346 Use udplite datagram for probes (with constant destination port,
347 default 53).
348
349 This method is allowed for unprivileged users.
350 Options:
351
352 coverage=num
353 Set udplite send coverage to num.
354
355 dccp -D
356 Use DCCP Request packets for probes (rfc4340).
357
358 This method uses the same "half-open technique" as used for TCP. The
359 default destination port is 33434.
360
361 Options:
362
363 service=num
364 Set DCCP service code to num (default is 1885957735).
365
366 raw -P proto
367 Send raw packet of protocol proto.
368 No protocol-specific headers are used, just IP header only.
369 Implies -N 1.
370 Options:
371
372 protocol=proto
373 Use IP protocol proto (default 253).
374
376 To speed up work, normally several probes are sent simultaneously. On
377 the other hand, it creates a "storm of packages", especially in the
378 reply direction. Routers can throttle the rate of icmp responses, and
379 some of replies can be lost. To avoid this, decrease the number of
380 simultaneous probes, or even set it to 1 (like in initial traceroute
381 implementation), i.e. -N 1
382
383 The final (target) host can drop some of the simultaneous probes, and
384 might even answer only the latest ones. It can lead to extra "looks
385 like expired" hops near the final hop. We use a smart algorithm to
386 auto-detect such a situation, but if it cannot help in your case, just
387 use -N 1 too.
388
389 For even greater stability you can slow down the program's work by -z
390 option, for example use -z 0.5 for half-second pause between probes.
391
392 If some hops report nothing for every method, the last chance to obtain
393 something is to use ping -R command (IPv4, and for nearest 8 hops
394 only).
395
397 ping(8), ping6(8), tcpdump(8), netstat(8)
398
399
400
401Traceroute 11 October 2006 TRACEROUTE(8)