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.
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
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:
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
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
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
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
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
This article covers a detailed 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. In fact, network diagnostics tools such as traceroute, and ping are available in most Linux distribution.
For most Linux distributions, you'll need to first install the traceroute package.