Traceroute command explained
Traceroute is a built-in command with a command-line interface that you can use through the Terminal application. It serves as a diagnostic tool most commonly used to trace a route from the computer, sending the traceroute request to a hostname or IP address. It will send the query and get back a result, showing the query’s route and statistics about time and packets lost.
You can find Traceroute on Linux (almost all distros), macOS, Windows (there it is called tracert), and even Android (though you will need extra installation).
The software’s benefits are that it is free, easy to use, and serves well its purpose of tracing the route to a target.
How does traceroute work?
When you are using the traceroute, your device will send packets of data starting from your IP address, going through various hops, and reaching its target – hostname or IP address. The software will use packets with a short TTL (time to live) value and listen for the ICMP replays. The probes continue until a message “port unreachable (ICMP) or rest (TCP), which will indicate host.
As a result, you will see TTLs, addresses of the hops, and round time per probe, and extra data if you used some of the options.
If you need more detailed information about the Traceroute command we recommend you this article – Traceroute command and its options
Traceroute syntax Linux
To get to the syntax on Linux, you will need to write the following in the Terminal:
traceroute [options] host_Address [pathlength]
You will also see all the options for the traceroute command on Linux. They will help you perform better probes and get richer results.
Traceroute Linux options
This is a complete list of Traceroute options on Linux. Use it on Debian, Ubuntu, CentOS, or whatever distro you have.
|This will allow socket level debugging in case that the kernel supports it.
|Only use IPv4. Yhe default will give results for IPv4 and IPv6 both.
|Only use IPv6.
|Specify only TCP for the probes.
|Specify only ICMP ECHO for the probes.
|Forbid packet’s fragmentation.
|Set, TTL value for starting (default is 1).
|Say through which gateway you want the query to pass.
|Decide which interface to use for traceroute.
|Set the maximum hop number (default is 30).
|Set the number of queries send simultaneously (default is 16).
|Don’t map the IP addresses to the hostnames.
|Choose the port for probing.
|Type of service and precedence value.
|The waiting time for probes (default is 5 seconds).
|The number of packets per hop (default is 3 seconds).
|Send directly to a host, bypassing the normal routing table.
|Alternative source address.
|The minimum interval, between sending of packets (default is 0).
|See the ICMP extensions.
|See the version and exit.
|UDP for the probes.
|UDPLITE for the probes.
|Choose the protocol for the probes.
Suggested article: How to use the MTR command?
Traceroute syntax for macOS and Windows?
Here we are focused on Linux-only, but not to be bad with the rest of the readers, we will tell you how to use traceroute on macOS and Windows.
Use the Terminal. Traceroute exists, and it is very similar. The syntax for macOS is:
traceroute [options] host [packetsize]
To see all the options, you can write:
- Windows 10
On Windows, the Traceroute command has a slightly different name – tracert. The functionality is very similar.
The tracert sytax is:
tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name
It shows all the available options like –R for roundtrip, -S srcaddr source address, -4 for IPv4, and -6 for IPv6.
Traceroute is an easy to use, fast, and small command that you can easily use, no matter your Linux distro. Use it to monitor your servers or other network diagnostics.