What is the Tracert Command?:
You might also sometimes see the tracert command referred to as the trace route command or traceroute command.
Tracert Command Syntax:
tracert [-d] [-h MaxHops] [-w TimeOut] [-4] [-6] target [/?]
-h MaxHops = This tracert option specifies the maximum number of hops in the search for the target. If you do not specify MaxHops, and target has not been found by 30 hops, tracert will stop looking.
-w TimeOut = You can specify the time, in milliseconds, to allow each reply before timeout using this tracert option.
-4 = This option forces tracert to use IPv4 only.
-6 = This option forces tracert to use IPv6 only.
target = This is the destination, either an IP address or hostname.
/? = Use the help switch with the tracert command to show detailed help about the command's several options.
Other less commonly used options for the tracert command also exist including [-j HostList], [-R], and [-S SourceAddress]. Use the help switch with the tracert command for more information on these options.
Tip: Save the lengthy results of a tracert command to a file with a redirection operator. Take a look at How To Redirect Command Output to a File for help or see Command Prompt Tricks for this and other helpful tips.
Tracert Command Examples:
In the above example, the tracert command is used to show the path from the networked computer on which the tracert command is being executed to a network device, in this case a router on a local network, that's assigned the 192.168.1.1 IP address. The result displayed on screen will look something like this:
Tracing route to 192.168.1.1 over a maximum of 30 hops 1 <1 ms <1 ms <1 ms 192.168.1.254 2 <1 ms <1 ms <1 ms 192.168.1.1 Trace complete.
In this example, you can see that tracert found a network device using the IP address of 192.168.1.254, let's say a network switch, followed by the destination, 192.168.1.1, the router.
Using the tracert command as shown above, we're asking tracert to show us the path from the local computer all the way to the network device with the hostname www.google.com.
Tracing route to www.l.google.com [184.108.40.206] over a maximum of 30 hops: 1 <1 ms <1 ms <1 ms 10.1.0.1 2 35 ms 19 ms 29 ms 220.127.116.11 3 11 ms 27 ms 9 ms te-0-3.dnv.comcast.net [18.104.22.168] ... 13 81 ms 76 ms 75 ms 22.214.171.124 14 84 ms 91 ms 87 ms 126.96.36.199 15 76 ms 112 ms 76 ms iy-f104.1e100.net [188.8.131.52] Trace complete.
In this example we can see that tracert identified fifteen network devices including our router at 10.1.0.1 and all the way through to the target of www.google.com which we now know uses the public IP address of 184.108.40.206.
Note: I excluded hops 4 through 12 above just to keep the example simple. If you were executing a real tracert, those results would all show up on screen.
tracert -d www.yahoo.com
In this final tracert command example, you can see that I'm again requesting the path to a website, this time www.yahoo.com, but now I'm preventing tracert from resolving hostnames by using the -d option.
Tracing route to any-fp.wa1.b.yahoo.com [220.127.116.11] over a maximum of 30 hops: 1 <1 ms <1 ms <1 ms 10.1.0.1 2 29 ms 23 ms 20 ms 18.104.22.168 3 9 ms 16 ms 14 ms 22.214.171.124 ... 13 98 ms 77 ms 79 ms 126.96.36.199 14 80 ms 88 ms 89 ms 188.8.131.52 15 77 ms 79 ms 78 ms 184.108.40.206 Trace complete.
In this example we can see that tracert again identified fifteen network devices including our router at 10.1.0.1 and all the way through to the target of www.yahoo.com which we can assume uses the public IP address of 220.127.116.11.
As you can see, tracert did not resolve any hostnames this time which I assure you significantly sped up the process.
Tracert Command Availability:
Note: The availability of certain tracert command switches and other tracert command syntax may differ from operating system to operating system.