What Is Traceroute?
traceroute is a command used in network troubleshooting for mapping the path packets travel through the network. The tool aids in the discovery of possible routes of information from source to destination. Additionally, the command also helps calculate the transfer times between points.
When applied to network troubleshooting,
traceroute helps locate where traffic slows down between the source and destination.
How Does Traceroute Work?
The protocol sends ICMP (Internet Control Message Protocol) packets to every router transferring between the source and destination. When you run a traceroute, the output displays:
- The IP address of the router that successfully received the packet.
- The travel latency, or the amount of time it took to get a response for each of the three probes.
Traceroute acts as a series of ping commands. While ping requests a response from the destination, traceroute gathers the intermediate information as well.
To gather the information available between the source and destination, a traceroute lowers the packet’s TTL (time to live) to a minimum (1). When a router receives the information, it decrements the TTL value to 0, indicating it should send information back to the source. The source gathers the intermediate router information, resets the TTL value to 1, and increments it.
This way, the packet reaches the next router in the network. The iterative process repeats until the final package reaches the destination IP. Then, traceroute recognizes the destination IP and outputs all the intermediate information gathered.
The command sends out three probes by default for each TTL value and prints out the round-trip time for each packet.
How to Run a Traceroute?
Traceroute is available on most modern machines. The program is a command line tool with different options and syntax depending on the operating system.
By default, a traceroute is 30 hops for a packet size of 60 bytes for IPv4 and 80 bytes for IPv6.
Run a Traceroute on Linux
On Ubuntu, the
traceroute command is not available by default. Install the tool using the apt package manager.
1. Open the terminal (CTLR+ALT+T) and install traceroute with:
sudo apt install traceroute
2. In the terminal, run a traceroute with:
traceroute [options] <hostname or IP> [packet length]
For example, traceroute one of Stromonic’s test IP:
Alternatively, use a hostname:
Advanced Options for Traceroute on Linux
By default, a traceroute sends UDP packets. Add the option
-I for ICMP probe packets:
traceroute -I <hostname or IP>
-n option to hide the device names for a cleaner output:
traceroute -In <hostname or IP>
By default, the number of packets sent is three. Change the number with the
-q option followed by the number of packets:
traceroute -Inq <number> <hostname or IP>
Lowering the number of packets to one increases the speed of a traceroute.
For all additional options of
traceroute, check the manual page in the terminal with the man command:
The manual contains information on all available command options and how to apply them to the command.
Run a Traceroute in Windows
Traceroute is available for Windows using the shorter name
tracert. To run a traceroute on Windows, follow these steps:
1. Press the Windows key and type CMD.
2. Press Enter and open the command prompt.
3. Lastly, run traceroute with:
tracert [options] <hostname or IP>
The output prints Trace complete to the console when the traceroute completes.
Run a Traceroute on macOS
To run a traceroute on macOS using the GUI, follow the steps below:
1. Click the Spotlight (magnifying glass) icon.
2. Next, search for Network Utility in the search field.
3. Double-click the Network Utility from the search result.
4. Locate and click the Traceroute tab.
5. Lastly, enter the IP address or host of the destination and click Trace. The textbox below the Trace button outputs the Traceroute results.
> <filename>.txt at the end of the
tracert command to save the results into a text file for later use and analysis. For example, on Linux and macOS:
traceroute 18.104.22.168 > results.txt
Windows users can follow the same steps:
tracert 22.214.171.124 > result.txt
In both cases, the output does not print anything out and returns to the regular command line input. The file saves to the location where the command runs.
Was this helpful?
1 / 0