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]
13 [-UL] [-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 traceouting. 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 Use ICMP ECHO for probes
77
78 -T Use TCP SYN for probes
79
80 -d Enable socket level debugging (when the Linux kernel supports
81 it)
82
83 -F Do not fragment probe packets. (For IPv4 it also sets DF bit,
84 which tells intermediate routers not to fragment remotely as
85 well).
86
87 Varying the size of the probing packet by the packet_len command
88 line parameter, you can manually obtain information about the
89 MTU of individual network hops. The --mtu option (see below)
90 tries to do this automatically.
91
92 Note, that non-fragmented features (like -F or --mtu) work prop‐
93 erly since the Linux kernel 2.6.22 only. Before that version,
94 IPv6 was always fragmented, IPv4 could use the once the discov‐
95 ered final mtu only (from the route cache), which can be less
96 than the actual mtu of a device.
97
98 -f first_ttl
99 Specifies with what TTL to start. Defaults to 1.
100
101 -g gateway
102 Tells traceroute to add an IP source routing option to the out‐
103 going packet that tells the network to route the packet through
104 the specified gateway (most routers have disabled source routing
105 for security reasons). In general, several gateway's is allowed
106 (comma separated). For IPv6, the form of num,addr,addr... is
107 allowed, where num is a route header type (default is type 2).
108 Note the type 0 route header is now deprecated (rfc5095).
109
110 -i interface
111 Specifies the interface through which traceroute should send
112 packets. By default, the interface is selected according to the
113 routing table.
114
115 -m max_ttl
116 Specifies the maximum number of hops (max time-to-live value)
117 traceroute will probe. The default is 30.
118
119 -N squeries
120 Specifies the number of probe packets sent out simultaneously.
121 Sending several probes concurrently can speed up traceroute con‐
122 siderably. The default value is 16.
123 Note that some routers and hosts can use ICMP rate throttling.
124 In such a situation specifying too large number can lead to loss
125 of some responses.
126
127 -n Do not try to map IP addresses to host names when displaying
128 them.
129
130 -p port
131 For UDP tracing, specifies the destination port base traceroute
132 will use (the destination port number will be incremented by
133 each probe).
134 For ICMP tracing, specifies the initial icmp sequence value
135 (incremented by each probe too).
136 For TCP specifies just the (constant) destination port to con‐
137 nect.
138
139 -t tos For IPv4, set the Type of Service (TOS) and Precedence value.
140 Useful values are 16 (low delay) and 8 (high throughput). Note
141 that in order to use some TOS precendence values, you have to be
142 super user.
143 For IPv6, set the Traffic Control value.
144
145 -w waittime
146 Set the time (in seconds) to wait for a response to a probe
147 (default 5.0 sec).
148
149 -q nqueries
150 Sets the number of probe packets per hop. The default is 3.
151
152 -r Bypass the normal routing tables and send directly to a host on
153 an attached network. If the host is not on a directly-attached
154 network, an error is returned. This option can be used to ping
155 a local host through an interface that has no route through it.
156
157 -s source_addr
158 Chooses an alternative source address. Note that you must select
159 the address of one of the interfaces. By default, the address
160 of the outgoing interface is used.
161
162 -z sendwait
163 Minimal time interval between probes (default 0). If the value
164 is more than 10, then it specifies a number in milliseconds,
165 else it is a number of seconds (float point values allowed too).
166 Useful when some routers use rate-limit for icmp messages.
167
168 -e Show ICMP extensions (rfc4884). The general form is CLASS/TYPE:
169 followed by a hexadecimal dump. The MPLS (rfc4950) is shown
170 parsed, in a form: MPLS:L=label,E=exp_use,S=stack_bottom,T=TTL
171 (more objects separated by / ).
172
173 -A Perform AS path lookups in routing registries and print results
174 directly after the corresponding addresses.
175
176 -V Print the version and exit.
177
178 There is a couple of additional options, intended for an advanced usage
179 (another trace methods etc.):
180
181 --sport=port
182 Chooses the source port to use. Implies -N 1. Normally source
183 ports (if applicable) are chosen by the system.
184
185 -M method
186 Use specified method for traceroute operations. Default tradi‐
187 tional udp method has name default, icmp (-I) and tcp (-T) have
188 names icmp and tcp respectively.
189 Method-specific options can be passed by -O . Most methods have
190 their simple shortcuts, (-I means -M icmp, etc).
191
192 -O option
193 Specifies some method-specific option. Several options are sepa‐
194 rated by comma (or use several -O on cmdline). Each method may
195 have its own specific options, or many not have them at all. To
196 print information about available options, use -O help.
197
198 -U Use UDP to particular destination port for tracerouting (instead
199 of increasing the port per each probe). Default port is 53
200 (dns).
201
202 -UL Use UDPLITE for tracerouting (default port is 53).
203
204 -P protocol
205 Use raw packet of specified protocol for tracerouting. Default
206 protocol is 253 (rfc3692).
207
208 --mtu Discover MTU along the path being traced. Implies -F -N 1. New
209 mtu is printed once in a form of F=NUM at the first probe of a
210 hop which requires such mtu to be reached. (Actually, the corre‐
211 spond "frag needed" icmp message normally is sent by the previ‐
212 ous hop).
213
214 Note, that some routers might cache once the seen information on
215 a fragmentation. Thus you can receive the final mtu from a
216 closer hop. Try to specify an unusual tos by -t , this can help
217 for one attempt (then it can be cached there as well).
218 See -F option for more info.
219
220 --back Print the number of backward hops when it seems different with
221 the forward direction. This number is guessed in assumption that
222 remote hops send reply packets with initial ttl set to either
223 64, or 128 or 255 (which seems a common practice). It is printed
224 as a negate value in a form of '-NUM' .
225
227 In general, a particular traceroute method may have to be chosen by
228 -M name, but most of the methods have their simple cmdline switches
229 (you can see them after the method name, if present).
230
231 default
232 The traditional, ancient method of tracerouting. Used by default.
233
234 Probe packets are udp datagrams with so-called "unlikely" destination
235 ports. The "unlikely" port of the first probe is 33434, then for each
236 next probe it is incremented by one. Since the ports are expected to be
237 unused, the destination host normally returns "icmp unreach port" as a
238 final response. (Nobody knows what happens when some application lis‐
239 tens for such ports, though).
240
241 This method is allowed for unprivileged users.
242
243 icmp -I
244 Most usual method for now, which uses icmp echo packets for probes.
245 If you can ping(8) the destination host, icmp tracerouting is applica‐
246 ble as well.
247
248 tcp -T
249 Well-known modern method, intended to bypass firewalls.
250 Uses the constant destination port (default is 80, http).
251
252 If some filters are present in the network path, then most probably any
253 "unlikely" udp ports (as for default method) or even icmp echoes (as
254 for icmp) are filtered, and whole tracerouting will just stop at such a
255 firewall. To bypass a network filter, we have to use only allowed pro‐
256 tocol/port combinations. If we trace for some, say, mailserver, then
257 more likely -T -p 25 can reach it, even when -I can not.
258
259 This method uses well-known "half-open technique", which prevents
260 applications on the destination host from seeing our probes at all.
261 Normally, a tcp syn is sent. For non-listened ports we receive tcp
262 reset, and all is done. For active listening ports we receive tcp
263 syn+ack, but answer by tcp reset (instead of expected tcp ack), this
264 way the remote tcp session is dropped even without the application ever
265 taking notice.
266
267 There is a couple of options for tcp method:
268
269 syn,ack,fin,rst,psh,urg,ece,cwr
270 Sets specified tcp flags for probe packet, in any combination.
271
272 flags=num
273 Sets the flags field in the tcp header exactly to num.
274
275 ecn Send syn packet with tcp flags ECE and CWR (for Explicit Conges‐
276 tion Notification, rfc3168)
277
278 sack,timestamps,window_scaling
279 Use the corresponding tcp header option in the outgoing probe
280 packet.
281
282 sysctl Use current sysctl (/proc/sys/net/*) setting for the tcp header
283 options above and ecn. Always set by default, if nothing else
284 specified.
285
286 mss=num
287 Use value of num for maxseg tcp header option (when syn).
288
289 Default options is syn,sysctl.
290
291 tcpconn
292 An initial implementation of tcp method, simple using connect(2) call,
293 which does full tcp session opening. Not recommended for normal use,
294 because a destination application is always affected (and can be con‐
295 fused).
296
297 udp -U
298 Use udp datagram with constant destination port (default 53, dns).
299 Intended to bypass firewall as well.
300
301 Note, that unlike in tcp method, the correspond application on the des‐
302 tination host always receive our probes (with random data), and most
303 can easily be confused by them. Most cases it will not respond to our
304 packets though, so we will never see the final hop in the trace. (For‐
305 tunately, it seems that at least dns servers replies with something
306 angry).
307
308 This method is allowed for unprivileged users.
309
310 udplite -UL
311 Use udplite datagram for probes (with constant destination port,
312 default 53).
313
314 This method is allowed for unprivileged users.
315 Options:
316
317 coverage=num
318 Set udplite send coverage to num.
319
320 raw -P proto
321 Send raw packet of protocol proto.
322 No protocol-specific headers are used, just IP header only.
323 Implies -N 1.
324 Options:
325
326 protocol=proto
327 Use IP protocol proto (default 253).
328
330 To speed up work, normally several probes are sent simultaneously. On
331 the other hand, it creates a "storm of packages", especially in the
332 reply direction. Routers can throttle the rate of icmp responses, and
333 some of replies can be lost. To avoid this, decrease the number of
334 simultaneous probes, or even set it to 1 (like in initial traceroute
335 implementation), i.e. -N 1
336
337 The final (target) host can drop some of the simultaneous probes, and
338 might even answer only the latest ones. It can lead to extra "looks
339 like expired" hops near the final hop. We use a smart algorithm to
340 auto-detect such a situation, but if it cannot help in your case, just
341 use -N 1 too.
342
343 For even greater stability you can slow down the program's work by -z
344 option, for example use -z 0.5 for half-second pause between probes.
345
346 If some hops report nothing for every method, the last chance to obtain
347 something is to use ping -R command (IPv4, and for nearest 8 hops
348 only).
349
351 ping(8), ping6(8), tcpdump(8), netstat(8)
352
353
354
355Traceroute 11 October 2006 TRACEROUTE(8)