In Linux, the traceroute command traces packet route from the source to the destination. It is quite useful for network administrators to examine the network’s performance. In Ubuntu, the working pattern of this command is similar to the “tracert” command that works in Windows OS.
This guide will demonstrate how to install and run the Traceroute command in Ubuntu 22.04.
The content that illustrates this tutorial is mentioned below:
- How to Install Traceroute on Ubuntu 22.04?
- How to Run Traceroute on Ubuntu 22.04?
- How to Uninstall Traceroute on Ubuntu 22.04?
- Bonus-Tip: How to Install Traceroute on Other Linux Distributions?
Let’s start with the guide.
How to Install Traceroute on Ubuntu 22.04?
In Ubuntu 22.04, the traceroute command diagnoses or traces out any issue during transferring the packet from source to destination. To install the traceroute in Ubuntu, the step-by-step instructions are provided below:
Step 1: Update System Packages
To acquire the latest state of system packages, the below script is as follows to update the system packages:
$ sudo apt update
Step 2: Install traceroute
Now, install the traceroute utility by issuing the following command:
$ sudo apt install traceroute
The installation of the traceroute has been completed.
Let’s explore the practical usage of the traceroute command on Ubuntu 22.04.
How to Run Traceroute on Ubuntu 22.04?
The traceroute command has multiple usage and options that assist in identifying any malicious activity in the network. To run the traceroute command, follow the below-mentioned command:
How Does Traceroute Command Work?
The “traceroute” command can send packets of different sizes, hops, probes, and many more.
The basic syntax of traceroute is as follows:
$ traceroute [options] host [pkt_len]
In the above syntax, the “host” specifies the host address, and “pkt_len” represents the packet length.
Various options of the traceroute command are explained below:
|-d||This option enables debugging.|
|-i||It specifies the interface of probes.|
|-p||It represents the port for any query.|
|-w||It shows the maximum waiting time for a reply.|
|-m||This option denotes the maximum hop number.|
|-g||It defines the route of the gateway.|
How to Use Traceroute Command?
In the Ubuntu-based operating system, the practical usage of the “traceroute” command is demonstrated below with various examples:
Example 1: Tracerouting of Website
To find the traceroute of any website, write the name of the website after the traceroute command such as below:
$ traceroute itslinuxfoss.com
It provides some basic information that is enlisted as below:
- IP Address: It refers to the IP address of destination such as 188.8.131.52.
- Hops: It identifies the number of steps where packets travel from source to destination (Maximum 30).
- Packet Size: The packet size that transfers from the source address (By default value of packet size is 60).
Example 2: Customize Packet Size
To change the packet size, write the numeric value (such as 50) the user wants to send from the source:
$ traceroute itslinuxfoss.com 50
By default value, the packet size is 60 bytes.
Example 3: Customize Number of Probes
To change the number of probes in every hop, utilize the “-q” flag with “5” probes after the traceroute command:
$ traceroute -q 5 itslinuxfoss.com
By default, three probes send through at each hop.
Example 4: Customize Number of Hops
To change the number of hops, users can utilize the “-f” flag to specify the starting point. In our case, specify the starting point 20 that can be verified in the below screenshot:
$ traceroute -f 20 itslinuxfoss.com
That is all about the usage of the traceroute command.
Note: For more details on the traceroute command usage, just read our article on traceroute.
Let’s explore the uninstallation of traceroute.
How to Uninstall Traceroute on Ubuntu 22.04?
To uninstall the traceroute command from Ubuntu 22.04 system, execute the below script in the terminal:
$ sudo apt remove traceroute
After pressing the “y” key, the traceroute with all its executable files is removed from Ubuntu 22.04.
Bonus Tip: How to Install Traceroute on Other Linux Distributions?
It is additional information to install the traceroute commands on different linux based distribution systems. For this, the syntax is provided below:
The traceroute command can be installed in all CentOS or RHEL systems using “yum” as seen below:
$ sudo yum install traceroute
To install the traceroute command in Fedora OS, “dnf” is used here:
$ sudo dnf install traceroute
That’s all from this guide!
In Ubuntu 22.04, the “sudo apt install traceroute” and “traceroute” commands are utilized to install and run traceroute, respectively. It has multiple options that users can utilize to examine the number of hops, number of probes, packet size, and other activities. Network administrators utilize the “traceroute” command to diagnose any threat in the network. This guide has explained the traceroute installation, usage, and uninstallation methods in Ubuntu 22.04.