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 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 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 precedence 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 --fwmark=mark
186 Set the firewall mark for outgoing packets (since the Linux ker‐
187 nel 2.6.25).
188
189 -M method
190 Use specified method for traceroute operations. Default tradi‐
191 tional udp method has name default, icmp (-I) and tcp (-T) have
192 names icmp and tcp respectively.
193 Method-specific options can be passed by -O . Most methods have
194 their simple shortcuts, (-I means -M icmp, etc).
195
196 -O option
197 Specifies some method-specific option. Several options are sepa‐
198 rated by comma (or use several -O on cmdline). Each method may
199 have its own specific options, or many not have them at all. To
200 print information about available options, use -O help.
201
202 -U Use UDP to particular destination port for tracerouting (instead
203 of increasing the port per each probe). Default port is 53
204 (dns).
205
206 -UL Use UDPLITE for tracerouting (default port is 53).
207
208 -P protocol
209 Use raw packet of specified protocol for tracerouting. Default
210 protocol is 253 (rfc3692).
211
212 --mtu Discover MTU along the path being traced. Implies -F -N 1. New
213 mtu is printed once in a form of F=NUM at the first probe of a
214 hop which requires such mtu to be reached. (Actually, the corre‐
215 spond "frag needed" icmp message normally is sent by the previ‐
216 ous hop).
217
218 Note, that some routers might cache once the seen information on
219 a fragmentation. Thus you can receive the final mtu from a
220 closer hop. Try to specify an unusual tos by -t , this can help
221 for one attempt (then it can be cached there as well).
222 See -F option for more info.
223
224 --back Print the number of backward hops when it seems different with
225 the forward direction. This number is guessed in assumption that
226 remote hops send reply packets with initial ttl set to either
227 64, or 128 or 255 (which seems a common practice). It is printed
228 as a negate value in a form of '-NUM' .
229
231 In general, a particular traceroute method may have to be chosen by
232 -M name, but most of the methods have their simple cmdline switches
233 (you can see them after the method name, if present).
234
235 default
236 The traditional, ancient method of tracerouting. Used by default.
237
238 Probe packets are udp datagrams with so-called "unlikely" destination
239 ports. The "unlikely" port of the first probe is 33434, then for each
240 next probe it is incremented by one. Since the ports are expected to be
241 unused, the destination host normally returns "icmp unreach port" as a
242 final response. (Nobody knows what happens when some application lis‐
243 tens for such ports, though).
244
245 This method is allowed for unprivileged users.
246
247 icmp -I
248 Most usual method for now, which uses icmp echo packets for probes.
249 If you can ping(8) the destination host, icmp tracerouting is applica‐
250 ble as well.
251
252 This method may be allowed for unprivileged users since the kernel 3.0
253 (IPv4 only), which supports new dgram icmp (or "ping") sockets. To
254 allow such sockets, sysadmin should provide net/ipv4/ping_group_range
255 sysctl range to match any group of the user.
256 Options:
257
258 raw Use only raw sockets (the traditional way).
259 This way is tried first by default (for compatibility reasons),
260 then new dgram icmp sockets as fallback.
261
262 dgram Use only dgram icmp sockets.
263
264 tcp -T
265 Well-known modern method, intended to bypass firewalls.
266 Uses the constant destination port (default is 80, http).
267
268 If some filters are present in the network path, then most probably any
269 "unlikely" udp ports (as for default method) or even icmp echoes (as
270 for icmp) are filtered, and whole tracerouting will just stop at such a
271 firewall. To bypass a network filter, we have to use only allowed pro‐
272 tocol/port combinations. If we trace for some, say, mailserver, then
273 more likely -T -p 25 can reach it, even when -I can not.
274
275 This method uses well-known "half-open technique", which prevents
276 applications on the destination host from seeing our probes at all.
277 Normally, a tcp syn is sent. For non-listened ports we receive tcp
278 reset, and all is done. For active listening ports we receive tcp
279 syn+ack, but answer by tcp reset (instead of expected tcp ack), this
280 way the remote tcp session is dropped even without the application ever
281 taking notice.
282
283 There is a couple of options for tcp method:
284
285 syn,ack,fin,rst,psh,urg,ece,cwr
286 Sets specified tcp flags for probe packet, in any combination.
287
288 flags=num
289 Sets the flags field in the tcp header exactly to num.
290
291 ecn Send syn packet with tcp flags ECE and CWR (for Explicit Conges‐
292 tion Notification, rfc3168).
293
294 sack,timestamps,window_scaling
295 Use the corresponding tcp header option in the outgoing probe
296 packet.
297
298 sysctl Use current sysctl (/proc/sys/net/*) setting for the tcp header
299 options above and ecn. Always set by default, if nothing else
300 specified.
301
302 mss=num
303 Use value of num for maxseg tcp header option (when syn).
304
305 info Print tcp flags of final tcp replies when the target host is
306 reached. Allows to determine whether an application listens the
307 port and other useful things.
308
309 Default options is syn,sysctl.
310
311 tcpconn
312 An initial implementation of tcp method, simple using connect(2) call,
313 which does full tcp session opening. Not recommended for normal use,
314 because a destination application is always affected (and can be con‐
315 fused).
316
317 udp -U
318 Use udp datagram with constant destination port (default 53, dns).
319 Intended to bypass firewall as well.
320
321 Note, that unlike in tcp method, the correspond application on the des‐
322 tination host always receive our probes (with random data), and most
323 can easily be confused by them. Most cases it will not respond to our
324 packets though, so we will never see the final hop in the trace. (For‐
325 tunately, it seems that at least dns servers replies with something
326 angry).
327
328 This method is allowed for unprivileged users.
329
330 udplite -UL
331 Use udplite datagram for probes (with constant destination port,
332 default 53).
333
334 This method is allowed for unprivileged users.
335 Options:
336
337 coverage=num
338 Set udplite send coverage to num.
339
340 raw -P proto
341 Send raw packet of protocol proto.
342 No protocol-specific headers are used, just IP header only.
343 Implies -N 1.
344 Options:
345
346 protocol=proto
347 Use IP protocol proto (default 253).
348
350 To speed up work, normally several probes are sent simultaneously. On
351 the other hand, it creates a "storm of packages", especially in the
352 reply direction. Routers can throttle the rate of icmp responses, and
353 some of replies can be lost. To avoid this, decrease the number of
354 simultaneous probes, or even set it to 1 (like in initial traceroute
355 implementation), i.e. -N 1
356
357 The final (target) host can drop some of the simultaneous probes, and
358 might even answer only the latest ones. It can lead to extra "looks
359 like expired" hops near the final hop. We use a smart algorithm to
360 auto-detect such a situation, but if it cannot help in your case, just
361 use -N 1 too.
362
363 For even greater stability you can slow down the program's work by -z
364 option, for example use -z 0.5 for half-second pause between probes.
365
366 If some hops report nothing for every method, the last chance to obtain
367 something is to use ping -R command (IPv4, and for nearest 8 hops
368 only).
369
371 ping(8), ping6(8), tcpdump(8), netstat(8)
372
373
374
375Traceroute 11 October 2006 TRACEROUTE(8)