Network or system administrators are responsible for ensuring that a network or system provides uninterrupted service, and they must ensure that the network is properly maintained. They must execute many network tests to continuously monitor network operation; several diagnostic tools, such as ping, allow network administrators to evaluate network connectivity. For network diagnostics, however, another command called “traceroute” is used in Linux and macOS, whereas the identical program is called “tracert” in Windows. The traceroute command is used to map the data from the source to the destination of a route. It can also be used to track the paths that data packets take from their origin to their destination.
In this comprehensive article, we’ll look at how to use the traceroute command in Ubuntu with various examples.
How to Install Traceroute
If you haven’t installed the traceroute, it will give you an error when you try to use it. As a result, you must first install it before running the command to use it. Run the following mentioned command to install it:
$ sudo apt install traceroute
Uses of Traceroute in Ubuntu
You will be able to use traceroute in Ubuntu once it’s been installed. Before we dive into the specifics, let’s have a look at how to utilize traceroute in its most simple form:
To acquire the full scope of the traceroute’s capabilities, run the following command:
Furthermore, the command below is used to display the tracerouting for youtube.com.
$ traceroute www.youtube.com
$ traceroute youtube.com
There are a few key ideas we can glean from the output; the details of the few values that appear on the first line of the output are described below:
- 184.108.40.206 represents the destination’s IP address.
- The number of hops is a numerical value that indicates how long the traceroute will attempt to reach the destination (the default value is 30).
- You can send a certain number of probes per hop or a certain number of packets each hop (the default value is 3)
- The final key item to consider is the size of the packets you’re transmitting. (60 bytes is the default value).
How to Set the Number of Probes
By default, 16 probes are passed at once; you can change this number of probes by using the “-N” option: Run the following command to reset the number of probes:
$ traceroute –N 12 youtube.com
How to use Traceroute to Limit the Number of Hops
By default, there are 30 hops; however, by using the “-m” option, you can specify a different value: for example, the command below would scan the website for only 6 hops to reach the target. You can see that the tracerouting is only carried out until 6 hops.
$ traceroute –m 6 youtube.com
How to Limit the Probes
The “-q” parameter in traceroute allows you to specify several probes; by default, three probes are presented at each hop: When you need speedy responses, choose this option:
Run the following mentioned command to reduce the number of probes to “2”:
$ traceroute –q 2 youtube.com
How to Change the Packet Size
The default size of packets sent by each hop is 60 bytes; using the following command, packets will be resized to 30 bytes.
$ traceroute youtube.com 30
How to Use the “-f” Option to Change the Number of Hops
The traceroute command “-f” option prints the result starting at the hop number you indicate; you can specify the number of hops from which the result will be printed; for example, the example below will start publishing the result at the 12th hop.
$ traceroute -f 12 youtube.com
In Ubuntu, network diagnostics tools such as traceroute, and ping are available. Network administrators are responsible for maintaining the network and traceroute is one of the most important tools for system or network administrators. This article provides a brief description of the traceroute command, which can be used to determine the delays in network path responses and look for routing loops (if any exist) in the network.