Traceroute

Traceroute is a command-line tool used to trace the route of the data sent from your computer to a host server over one or many networks.

Traceroute is a command-line tool used to trace the route of the data sent from your computer to a host server over one or many networks.

The traceroute command is used to identify where a problem lies in the network if a data packet cannot reach the destination.

How traceroute works

Traceroute how it works

traceroute works by sending 3 data packets, in each hop, aimed at a particular destination, and records the information about the router that it hops to. Each packet will have a TTL value (Time-to-live), which is a count to the number of hops a packet can take before it self-destructs and sends information back to you. After the packet is destroyed, traceroute will increment the TTL value of the next hop packets by 1. This process is repeated until a packet reaches the destination.

For example, calling a traceroute command will initially send 3 packets with TTL = 1, so that they can hop to the first router along the path to the target before it self-destructs. Once a packet is destroyed, it will send a packet back to you, along with additional information about the router and the time it takes to travel there. Next, the command will send 3 packets with TTL = 2 so that it can hop the next router towards the destination. This process is repeated until it reaches the target.

Example of the traceroute command and output

Here is an example of running trecert google.com on Windows systems:

Traceroute example command

traceroute uses the following syntax in Mac and Linux systems:

traceroute [-n] [-w wait_time] [-i initial_ttl] [-m max_ttl] [-p dest_port] [-q nqueries] [-t tos] host [data_size]

On Windows system, the traceroute command is tracert and uses the following syntax:

tracert [-d] [-h maximum hops] [-j host list] [-w timeout] [-R] [-S scraddr] [-4] [-6] target_name