Introduction
The tracepath and traceroute terminal programs are crucial in network diagnostics. Both commands map the network and display possible packet routes and transit delays from a source to a destination. However, there is a difference between the available options and which users can use each command.
This article outlines the difference between traceroute
and tracepath
and shows use cases.
Prerequisites
- Stable internet connection.
- A destination to trace (the guide offers an example).
- Access to the terminal with sudo privileges.
Differences between Tracepath vs. Traceroute
The main difference between tracepath
and traceroute
is in the available options and user privileges. With default options, the two commands are similar.
Tracepath traces the path to a specified destination using UDP packets. Without any options, the command outputs:
- TTL (Time To Live) round-trip time for a packet.
- MTU (Maximum Transmission Units) or the largest packet that
tracepath
can send over the network. - The resolved domain name when possible.
Traceroute maps the network path to a designated destination. Without any options, the command sends UDP packets and prints:
- The TTL round-trip time for three packets.
- Maximum hop number and packet size in bytes.
- IP address and resolved domain name when possible.
However, traceroute
offers many advanced options to select from, such as choosing between ICMP and TCP transfer protocols and more. Some options require superuser (sudo) privileges because the command works directly with raw packets.
How is Tracepath Used?
The tracepath
command syntax is:
tracepath <options> <destination IP or domain name>
For example, trace the path to one of phoenixNAP's speed test IP locations:
tracepath 184.95.56.34
The Tracepath program offers some simple options. For instance, display only the IP address for a quicker output:
The output does not show the resolved domain name. For a complete list of options, run the manual using the man command:
man tracepath
In general, use tracepath
for simple network scanning.
How is Traceroute Used?
The traceroute
command syntax is:
traceroute <options> <destination IP or domain name>
Note: Traceroute not installed? Use the apt package manager and install it with:
sudo apt install traceroute
The simplest way to use traceroute is without any options:
traceroute 184.95.56.34
An example command that requires sudo privileges is when specifying the TCP protocol:
sudo traceroute -T 184.95.56.34
The traceroute program offers many more options to customize the packet size, the number of probes sent, setting the maximum TTL, etc. For a detailed list, use:
man traceroute
Use traceroute
when you need more advanced options to analyze the network.
Conclusion
After reading this guide, you know how to use traceroute
and tracepath
and the difference between the two commands. You can use these commands together with other Linux networking commands such as ss, netstat, and ip.