How to Install and Use Traceroute on Debian 12?


The traceroute is an essential network diagnostic tool available in Linux distributions including Debian 12. It helps track the routes of packets sent across IP networks, making it useful for diagnosing network connectivity issues.

When you encounter internet connectivity problems or difficulty connecting to specific IP addresses, traceroute assists in identifying where the issue lies along the route. It reveals the path taken by packets from your system to the destination IP address, showing each intermediate hop.

This article will demonstrate the installation as well as the use of traceroute on Debian 12. The supported content is given below:

Let’s start with the installation.

How to Install Traceroute on Debian 12?

The traceroute sends packets with different TTL (time to live) values that increase gradually by maintaining the IP addresses (track) of the routers that reply along the path. By default, it is installed in Linux-based operating systems.

For the installation of the traceroute on Debian 12, use the “traceroute” package or “net-tools” utility. The steps for the installation of the traceroute are given below:

Step 1: Update Package List

First, update the package repository/database with the “update” command:

sudo apt update

Step 2: Install traceroute

To install traceroute on Debian 12, use the “traceroute” package/utility with the “apt” command:

sudo apt install traceroute

Alternative Way: Install net-tools Utility

For installing traceroute on Debian 12, users can install the net-tools utility. It installs all dependencies including the traceroute package:

sudo apt install net-tools

Step 3: Verification

To confirm the successful installation of the traceroute command, check its version via the below command:

traceroute --version

Optional: Uninstall traceroute

To remove only the traceroute package, use the “remove” utility with the apt command:

sudo apt remove traceroute

Complete Remove traceroute

To uninstall/remove traceroute along with dependent packages on Debian 12, type the “autoremove” utility as below:

sudo apt autoremove traceroute

This section has been done with the installation as well as the uninstallation of the traceroute using Debian 12.

How to Use Traceroute on Debian 12?

The traceroute is a valuable network debugging tool, especially when diagnosing network connectivity issues. Once the package is installed, you can use the traceroute command with the following syntax:

traceroute [options] destination

Here, the destination can be a hostname or an IP address for which to trace the route. The options can modify the behavior and output of the traceroute, such as changing the number of probes, the maximum number of hops, or the type of packets.

To use the traceroute on Debian 12, follow the below examples:

Example 1: Display Traceroute (Using Domain name)

To find out the route of packets sent to a specific IP address, use the traceroute command with the host address (e.g., linuxgenie.net), as below:

traceroute linuxgenie.net

This command displays information about the IP address and round-trip times.

Example 2: Display Traceroute (Using the IP Address)

Users can also use the IP address of the host address to trace the path. Lets execute the same command with the IP address as below:

traceroute 172.67.171.74

Example 3: Specifying the Number of Hops

To set the maximum number of hops (time to live) for packets. For instance, limit it to 20 hops of host address “linuxgenie.net” via the below command:

traceroute -m 20 linuxgenie.net

In this way, limits to the specified hops for tracing packets.

Example 4: Specifying Reply Wait Time

To specify the wait time for replies from the IP address of linuxgenie.net, use the 3 seconds with the “w” options as below:

traceroute -w 3 linuxgenie.net

Example 5: Displaying IP Addresses

Users can also display the IP address of a specific hostname by using the -n option of traceroute command:

traceroute -n linuxgenie.net

Help Page of Traceroute Command

To explore all options of traceroute command use the “traceroute” command with the “help” utility. It displays the help page as below:

traceroute --help

Alternative Commands of traceroute

If you’re looking for alternatives to the traceroute command, here are a few options:

  • tracepath: This utility traces the path to a network host and also discovers the Maximum Transmission Unit (MTU) along the path. This command is similar to traceroute and does not need root access.
  • mtr: This command combines the functionality of traceroute and ping, and displays real-time statistics of the network performance.
  • tcptraceroute: This command uses TCP packets instead of UDP or ICMP, which can bypass some firewalls and routers that block or filter the latter protocols.
  • Nslookup: Users can also display the IP address and domain name information via the Nslookup command. To explore more about it, visit our guide.
  • dig: This command is utilized as a replacement for traceroute. To get its details with multiple examples, navigate to the guide.
  • nping: This command is part of the Nmap suite, and it can perform network probing and testing with different protocols, flags, payloads, and options.
  • hping: This command is another network testing tool that can generate packets with custom TCP/IP headers, and perform traceroute-like functions.

Conclusion

The traceroute is a networking tool used to track the routes of packets across IP networks. To install the traceroute on Debian 12, use the “traceroute” packages or “net-tools” utility. To use the traceroute command on a Debian-based distribution, use the “traceroute” command with the destination address (host address or IP address). It displays information about the IP address as well as round-trip times. This guide has explained the installation, uninstallation, and usage of the traceroute command on Debian 12.

 

Print Friendly, PDF & Email
Categories