This post describes how to install or run TCP traceroute in Centos Linux. TCP Traceroute is a tool used by end users in Linux to test TCP port connectivity. TCP Traceroute is done from Centos command line, TCP traceroute uses TCP SYN packets rather than ICMP/UDP packets that the usual implementations use, thus bypassing gateways that block traditional traceroute packets. To run TCP traceroute in Centos, first we need to install TCPtraceroute in Centos Linux.
TCP Traceroute can be installed in two ways-
- Online Installation– It required direct Internet connectivity to Centos Server. TCP Traceroute installation is done directly from the Centos Server command line.
- Offline Installation– This is the scenario when the Centos server does not have internet connectivity. In this case, the TCP Traceroute rpm package is installed manually in CentOS server.
1. Online Installation
If you have internet connectivity to your Centos Linux server, then follow below steps to run TCP Traceroute in Centos.
(i) Install TCP Traceroute in Centos with below command.
sudo yum install tcptraceroute -y
(ii) Command syntax:
tcptraceroute hostname/IP port
Example:
sudo tcptraceroute google.com 443
sudo tcptraceroute 142.250.183.206 443
NOTE: On some operating systems like OS X you may need to run tcptraceroute as root. We’ve included ‘sudo’ in the example commands below to do that.
[root@localhost ~]# sudo tcptraceroute google.com 443
Selected device en0, address 192.168.10.63, port 60749 for outgoing packets
Tracing the path to api.opendns.com (67.215.92.210) on TCP port 443 (https), 30 hops max
1 192.168.10.254 1.893 ms 1.787 ms 1.123 ms
2 * * *
3 te-0-7-0-11-sur02.lowell.ma.boston.comcast.net (68.85.161.117) 11.768 ms 36.209 ms 11.473 ms
4 be-21-ar01.needham.ma.boston.comcast.net (68.85.106.45) 14.006 ms 12.382 ms 21.340 ms
5 be-7015-cr01.newyork.ny.ibone.comcast.net (68.86.90.217) 40.690 ms 67.974 ms 41.689 ms
6 ae12.edge1.newyork2.level3.net (4.68.127.1) 42.198 ms 19.511 ms 22.600 ms
7 ae-32-80.car2.sanjose1.level3.net (4.69.152.132) 121.049 ms 130.360 ms 125.898 ms
8 ae-32-80.car2.sanjose1.level3.net (4.69.152.132) 124.555 ms 139.251 ms 136.524 ms
9 open-dns-in.car2.sanjose1.level3.net (4.28.12.198) 86.392 ms 99.180 ms 88.102 ms
10 vlan130.fw1.sjc.opendns.com (67.215.78.6) 89.775 ms 88.160 ms 90.077 ms
11 google.com (142.250.183.206) [open] 126.455 ms 87.454 ms 89.881 ms
2. Offline Installation
If your Centos server does not have an internet connection, which happens mostly in the enterprise networks for security reasons. We have to manually upload the TCP Traceroute package to the Centos server and then install the package to run TCP Traceroute in Centos Linux.
(i) Download TCP Traceroute for Centos Linux
Download TCP Traceroute from below link for Centos
Download from Linux Package Website
https://pkgs.org/download/tcptraceroute
(ii) After TCP Traceroute Download, upload the package to Centos Server.
Login to Centos Server and Create tcptraceroute directory
mkdir tcptraceroute
Use Filezilla/SCP to upload the package to Centos Server
(iii) Small Check if TCP Traceroute is working
[root@localhost ~]# sudo tracetcp google.com
sudo: tracetcp: command not found
[root@localhost ~]#
(iv) Go to tcptraceroute directory and check uploaded file.
[root@localhost ~]# cd tcptraceroute/
[root@localhost tcptraceroute]# ls
traceroute-2.0.22-2.el7.x86_64.rpm
(v) Install TCPtraceroute package traceroute-2.0.22-2.el7.x86_64.rpm with below command
[root@localhost tcptraceroute]# sudo yum localinstall traceroute-2.0.22-2.el7.x86_64.rpm -y
Output
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Examining traceroute-2.0.22-2.el7.x86_64.rpm: 3:traceroute-2.0.22-2.el7.x86_64
Marking traceroute-2.0.22-2.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package traceroute.x86_64 3:2.0.22-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================================================================================================
Installing:
traceroute x86_64 3:2.0.22-2.el7 /traceroute-2.0.22-2.el7.x86_64 92 k
Transaction Summary
==============================================================================================================================================================================================================================================
Install 1 Package
Total size: 92 k
Installed size: 92 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 3:traceroute-2.0.22-2.el7.x86_64 1/1
Verifying : 3:traceroute-2.0.22-2.el7.x86_64 1/1
Installed:
traceroute.x86_64 3:2.0.22-2.el7
Complete!
(vi) Run TCPtraceroute is CentOS.
NOTE: On some operating systems like OS X you may need to run tcptraceroute as root. We’ve included ‘sudo’ in the example commands below to do that.
[root@localhost ~]# sudo tcptraceroute google.com 443
Selected device en0, address 192.168.10.63, port 60749 for outgoing packets
Tracing the path to api.opendns.com (67.215.92.210) on TCP port 443 (https), 30 hops max
1 192.168.10.254 1.893 ms 1.787 ms 1.123 ms
2 * * *
3 te-0-7-0-11-sur02.lowell.ma.boston.comcast.net (68.85.161.117) 11.768 ms 36.209 ms 11.473 ms
4 be-21-ar01.needham.ma.boston.comcast.net (68.85.106.45) 14.006 ms 12.382 ms 21.340 ms
5 be-7015-cr01.newyork.ny.ibone.comcast.net (68.86.90.217) 40.690 ms 67.974 ms 41.689 ms
6 ae12.edge1.newyork2.level3.net (4.68.127.1) 42.198 ms 19.511 ms 22.600 ms
7 ae-32-80.car2.sanjose1.level3.net (4.69.152.132) 121.049 ms 130.360 ms 125.898 ms
8 ae-32-80.car2.sanjose1.level3.net (4.69.152.132) 124.555 ms 139.251 ms 136.524 ms
9 open-dns-in.car2.sanjose1.level3.net (4.28.12.198) 86.392 ms 99.180 ms 88.102 ms
10 vlan130.fw1.sjc.opendns.com (67.215.78.6) 89.775 ms 88.160 ms 90.077 ms
11 google.com (142.250.183.206) [open] 126.455 ms 87.454 ms 89.881 ms