tracert - Trace the Network Route
The tracert command shows which routers (intermediate devices) your traffic passes through, in order, on its way from your PC to a destination server.
ping only tells you whether a destination is reachable and how long it takes to respond. With tracert, you can see where traffic still gets through and where it slows down or stops.
Basic syntax of the tracert command
tracert [-d] [-h <max hops>] [-w <timeout>] [-4] [-6] <host name or IP address>
Only the main options are listed here. Run tracert /? to see the others, such as -S for specifying a source address.
Trace a route
Run the command with the host name or IP address you want to check.
tracert example.com
The output above is only an example (hops whose name is known, such as router.example.net, are shown as “host name [IP address]”). The number of routers, their addresses, and response times depend on your network and when you run the command.
How to read the output
Each line represents one intermediate point, called a hop.
| Item | Description |
|---|---|
| Number on the left | Which hop this is from your PC (hop 1 is usually your home or office router) |
Three times (ms) | The response time for each of the three packets sent to that hop |
| Address on the right | The host name or IP address of the router at that hop |
* | No response arrived in time |
The last line is the destination’s address. If Trace complete. is shown, the destination was reached.
Skip reverse lookups for speed (-d)
By default, tracert looks up the host name for each router’s IP address. This reverse lookup can be slow and make the output pause on every line.
With the -d option, no reverse lookup is done and only IP addresses are shown, so results appear faster.
tracert -d example.com
Specify the maximum number of hops (-h)
By default, tracert follows up to 30 hops. Use the -h option to change this limit.
tracert -h 15 example.com
This is useful when you don’t want to keep following unresponsive hops when the destination can’t be reached.
Specify the timeout (-w)
The -w option sets how long to wait for each response, in milliseconds. The default is 4000 (4 seconds). Three packets are sent to each hop, so a hop that never responds can take up to three times this value.
tracert -w 1000 example.com
Even on a route with many unresponsive hops, this shortens the wait and gets you results sooner.
Specify IPv4 or IPv6 (-4 / -6)
-4 traces the route over IPv4 and -6 over IPv6. Use them when a host name has both kinds of addresses and you want to choose one.
tracert -6 example.com
Main options
| Option | Description |
|---|---|
-d | Do not resolve addresses to host names |
-h <max hops> | Maximum number of hops to follow (default: 30) |
-w <timeout> | Time to wait for each response in ms (default: 4000) |
-4 | Use IPv4 |
-6 | Use IPv6 |
Interpreting results and troubleshooting
When Request timed out. appears
This means that hop did not respond. However, a * does not necessarily mean that hop is where the problem is.
Some routers limit the ICMP responses that tracert relies on, for security or load reasons. If a middle line shows * but later hops respond normally, your traffic is most likely passing through that router without trouble.
If * continues from some hop to the last line and the maximum number of hops is reached, traffic may be blocked beyond the last responding hop. However, the destination itself may simply be configured not to respond, so judge together with the results of ping and your browser.
When responses suddenly get slow from one hop
If every response time from a certain hop onward increases significantly, the cause of the delay may be near that hop.
On the other hand, if only a single line is slow and later lines return to normal, that router is probably just giving the response low priority and real traffic is not affected.
When it stops at the first hop
If nothing gets past the first hop (your home or office router), there may be a problem with the connection between your PC and the router, or with the router’s Internet connection.
Using it in batch files
To keep a record of a route, for example when reporting a problem, save the result to a file.
@echo off
tracert -d example.com > "%~dp0tracert-result.txt"
echo The result has been saved.
The > (redirect) writes the output to a file. %~dp0 is the folder where the batch file itself is located.
In a default Japanese environment, the output of tracert is written in code page 932 (Shift_JIS). If you changed the code page with chcp, the output uses that code page. If the text looks garbled in an editor, reopen the file using the correct character encoding.
First use ping to check whether the destination is reachable. If it isn’t, or it’s slow, use tracert to find where the problem starts. If you suspect name resolution itself is the problem, use nslookup as well.