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.
Here at LinuxAPT, we shall look into how to use the traceroute command in Ubuntu with various examples.
How to Install Traceroute on Ubuntu ?
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
How to use Traceroute in Ubuntu ?
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 linuxreels.com.
$ traceroute www.linuxreels.com
$ traceroute linuxreels.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:
- 126.96.36.199 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 for Traceroute in Ubuntu ?
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 linuxreels.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 linuxreels.com
How to Limit the Probes for Traceroute in Ubuntu ?
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 linuxreels.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 linuxreels.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 linuxreels.com
[Need help in fixing Ubuntu Linux system issues ? We can help you. ]