Traceroute command – an overview

Traceroute command explained.

Traceroute command is one of the built-in commands with a command-line interface (CLI). You are able to use it for any OS, such as Linux, macOS, and it is even available for Windows (tracert command). It servers perfectly for network diagnostic and, more precisely, for tracing the route from a point to a target.

If you want to access it, you should open the Terminal application on your computer. Then you are able to use it to target a particular IP address or a hostname. After you perform a query, it is going to present to you data about every element on the network, from the first hop through all the way to the target. In addition, you will receive helpful statistics. You will see in the results how that precise query travels. With such beneficial information, you could understand the route in a better way. Moreover, to examine if there is some kind of unusual routing going on, also to make a plan about your future network expansion. As a result, you are going to be able to provide better and quicker query answering.

How does it work?

When you put the Traceroute command in action, your device is going to send packets of data starting from your IP address. It will proceed through multiple hops, and finally, it will reach its target, like a hostname or IP address (IPv4 or IPv6). The software is going to operate with a shorter time-to-live (TTL) value and observe the ICMP replays. The process of probing will remain till a message appears “port unreachable” (ICMP) or “rest” (TCP), which will identify a host. As a final result, you are going to receive the hop’s addresses, TTLs, and round time per probe. In case you applied some of the additional options, you will see and extra information.

How to use the Traceroute command?

So, to trace the route to exampledomain.com, you have to open the Terminal application and type the following:

traceroute exampledomain.com

The answer that you are going to receive is divided into several columns.

  • The first one gives information about the hops it needs to reach the target.
  • The second column is for the IP addresses of those hops. 
  • The third column presents the information for every of the ping messages that traceroute have sent, plus the time they needed.

In the end, you have a clear picture of each of the hops that the query takes. You can understand if there are some delays on the route and between which devices appear a problem.

Options of the Traceroute command

Here are some of the essential options of the Traceroute command. You can try them for more precise queries: 

traceroute -m 35 exampledomain.com

In this example, you can increase the TTL to 35. That way, if you are far from your target, you will have five more hops to reach it rather than the default 30. 

traceroute -w 60 exampledomain.com

In this example, you can increase the time to wait, not only the number of hops. That means you can wait longer for an answer, however, and you will actually receive one. 

traceroute -q 8 exampledomain.com

In this example, you can increase the number of packets up to 8 from the default 3. As a result, you will receive a larger picture of the network with more further packets sent. 

traceroute -T exampledomain.com

In this example, you can adjust the interface for your query. Here, you apply T for TCP. However, you can apply -I for ICMP or -U for UDP