Cyberithub

How to Install traceroute command on Ubuntu 20.04 LTS

Advertisements

In this article, we will see how to install traceroute command on Ubuntu 20.04 LTS (Focal Fossa). Traceroute is a free and open source command line utility to trace the route packets originated from an IP network, traversing to the destination host. It traces the route by launching the probe packets with small TTL(time to live) and then listening for an ICMP "time exceeded" reply from a gateway. It is frequently used by system administrators and network administrators to troubleshoot the connection between source and destination host. It is also very easy to install in almost all the famous linux distributions. Here we will see the steps to install traceroute command on Ubuntu 20.04 LTS based systems.

 

How to Install traceroute command on Ubuntu 20.04 LTS

How to Install traceroute command on Ubuntu 20.04 LTS 

Also Read: How to Install libxcb-dri3-0 package on Ubuntu 20.04 LTS (Focal Fossa)

Step 1: Prerequisites

a) You should have a Ubuntu 20.04 LTS Server.

b) You should have sudo or root access to run privileged commands.

c) You should have apt or apt-get utility available in your Server.

 

Step 2: Update Your Server

Before going through the steps to install traceroute command, it is always recommended to sync your installed packages version to the latest available one in the Ubuntu repo by using sudo apt update && sudo apt upgrade command as shown below.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
[sudo] password for cyberithub:
Hit:1 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages [543 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,336 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [1,969 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security/main Translation-en [320 kB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [59.9 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/main amd64 c-n-f Metadata [11.7 kB]
..................................................

 

Step 3: Install traceroute command

In the next step, you can install traceroute command from default Ubuntu repo by using sudo apt install traceroute command as shown below. This will download and install traceroute package along with all its dependencies.

cyberithub@ubuntu:~$ sudo apt install traceroute
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
traceroute
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 45.4 kB of archives.
After this operation, 152 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 traceroute amd64 1:2.1.0-2 [45.4 kB]
Fetched 45.4 kB in 1s (78.1 kB/s)
Selecting previously unselected package traceroute.
(Reading database ... 196282 files and directories currently installed.)
Preparing to unpack .../traceroute_1%3a2.1.0-2_amd64.deb ...
Unpacking traceroute (1:2.1.0-2) ...
Setting up traceroute (1:2.1.0-2) ...
update-alternatives: using /usr/bin/traceroute.db to provide /usr/bin/traceroute (traceroute) in auto mode
update-alternatives: using /usr/bin/lft.db to provide /usr/bin/lft (lft) in auto mode
update-alternatives: using /usr/bin/traceproto.db to provide /usr/bin/traceproto (traceproto) in auto mode
update-alternatives: using /usr/sbin/tcptraceroute.db to provide /usr/sbin/tcptraceroute (tcptraceroute) in auto mode
Processing triggers for man-db (2.9.1-1) ...

 

Step 4: Verify Installation

After successfully installing the package, you can verify the installed files path by using dpkg -L traceroute command as shown below.

cyberithub@ubuntu:~$ dpkg -L traceroute
/.
/usr
/usr/bin
/usr/bin/lft.db
/usr/bin/traceproto.db
/usr/bin/traceroute-nanog
/usr/bin/traceroute.db
/usr/include
/usr/include/clif.h
/usr/lib
/usr/lib/libsupp.a
/usr/sbin
/usr/sbin/tcptraceroute.db
/usr/share
/usr/share/doc
/usr/share/doc/traceroute
.....................................................

 

Step 5: Check Version

You can check current installed version by using traceroute --version command as shown below.

cyberithub@ubuntu:~$ traceroute --version
Modern traceroute for Linux, version 2.1.0
Copyright (c) 2016 Dmitry Butskoy, License: GPL v2 or any later

 

Step 6: Using traceroute 

Now that traceroute command is successfully installed, you can use it to trace the packet route to a destination host. Here we are checking the route to google.com server using traceroute google.com command as shown below.

NOTE:

Please note that below star(*) mark on the output shows that the device on that hop was not configured to reply to ICMP/UDP traffic and hence hiding all the information for security purposes.
cyberithub@ubuntu:~$ traceroute google.com
traceroute to google.com (142.250.182.14), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 10.248.5.2 (10.248.5.2) 5.353 ms !X 5.734 ms !X 5.722 ms !X

 

Step 7: Check all the Available Options

You can check all the options available with traceroute command using traceroute --help command as shown below. More on Man Page.

cyberithub@ubuntu:~$ traceroute --help
Usage:
traceroute [ -46dFITnreAUDV ] [ -f first_ttl ] [ -g gate,... ] [ -i device ] [ -m max_ttl ] [ -N squeries ] [ -p port ] [ -t tos ] [ -l flow_label ] [ -w MAX,HERE,NEAR ] [ -q nqueries ] [ -s src_addr ] [ -z sendwait ] [ --fwmark=num ] host [ packetlen ]
Options:
-4 Use IPv4
-6 Use IPv6
-d --debug Enable socket level debugging
-F --dont-fragment Do not fragment packets
-f first_ttl --first=first_ttl
Start from the first_ttl hop (instead from 1)
-g gate,... --gateway=gate,...
Route packets through the specified gateway
(maximum 8 for IPv4 and 127 for IPv6)
-I --icmp Use ICMP ECHO for tracerouting
-T --tcp Use TCP SYN for tracerouting (default port is 80)
-i device --interface=device
Specify a network interface to operate with
-m max_ttl --max-hops=max_ttl
Set the max number of hops (max TTL to be
reached). Default is 30

Leave a Comment