What is the traceroute/tracert command and how is it used?

What is tracert/traceroute?

The tracert command (in Windows) or traceroute command (in Linux or Mac) is a network analysis tool that can be used to know the path a packeta message or piece of information sent over a network goes through or follows from the source to destination.

The time duration for this transfer to happen is also recorded with the IPInternet Protocol addresses of all routers encountered during its movement returned. Hop is the movement of the packet from one router to another. The number of routers encountered is the hop count.

When to use the traceroute command

The tracerroute command allows you to:

  • Track the path followed or nodes met by your packet en-route to its destination.
  • Analyze the different paths in your local network to determine the fastest path following the shortest path protocol.

The routes followed by a packet could be tracked with the traceroute command in real-time using the IP addresses of the different network gatewaysrouters encountered from the source to the destination. This records the time it takes to make a hop.

Result of traceroute command

The traceroute command returns the number of hops encountered by the packet on its way to its destination. The tracert command will also return the IP addresses of all the hopsrouters it encounters on the way to its destination.


Although many routers on the internet today are set to block the tracert messages automatically, the result of the command is inaccurate most of the time.

Advantages of tracert

  • It can determine the cause of a response delay in a network.

  • It determines the routing loops present in a network pathway across nodes that send and receive packets.

  • It finds the location of failed points in the network while packets move from source to destination.

Meaning of the tracert command result

Let’s explore what the returned result of a tracert command means. To do this, we head straight to our command prompt or terminal.

Let’s create a traceroute to educative.io. We do this by entering the following command in our terminal or command prompt:

For windows:


tracert www.educative.io 

For Linux/Mac:


traceroute www. educative.io

Output

The output might look like the diagram below:


Understanding the output from traceroute

From the example above, the result appears to have five columns.

Columns

  1. The first column from the left represents the serial number of the hop count.

  2. The second, third, and fourth columns are the time it took for the traditional three packetsnetwork messages sent by the tracert command to reach a hop.

  3. The last column represents the IP addresses of all hops encountered.

Rows

  1. The rows each represent information about individual hops.

  2. The first row 1 is the address of the device. It connects the network from which this command was made to the internet. This is called the network internet gateway.

  3. The second row 2 is usually the address of the router from which the ISPInternet Service Provider of the device is communicating while sending the request.

  4. Rows 3-9 are all hops of other networks, some global networks, and other third-party internet business organizations. Some still belong to your ISP.

  5. Usually, the one before the last, in this case 10, is the hop address of the network the device is hosting. Therefore, www.educative.io can be located.

  6. The last row 11 is the IP of the device (server) hosting the website educative.io.

Some useful tips

For a compelling diagnosis of your network, try to combine the tracert command with the ping command to get the best results.

Example

  • Suppose you have problems with timeout or unreachable error messages for a site you hosted.

  • Before running to your ISP or the hosting company to make complaints, you can run some basic checks with the tracert and then the ping commands to discover what the problem is.

Note: You can also use it to know where the network delays are and which path is faulty in your local network. You can start diagnosis from there. Type the command tracert, without any address, in the command prompt, and you will view the different tracert options which can help you refine your tracert output.

Free Resources