traceroute

Traceroute is a network diagnostic tool that provides insights into how data packets travel across a network. Whether you’re troubleshooting network issues or exploring the internet’s infrastructure, traceroute can help you map the journey of data packets from source to destination.

Traceroute is a command-line utility that traces the path data packets take across a network. It identifies each intermediate device (or “hop”) between your computer and the destination server, providing information about latency and routing.

On Ubuntu/Debian, you can install traceroute with the command:

apt install traceroute -y

Usage:

traceroute IP or HostName

example

root@vps-535faf74:~# traceroute serverok.in
traceroute to serverok.in (172.67.133.148), 30 hops max, 60 byte packets
 1  _gateway (15.204.204.1)  0.091 ms  0.080 ms  0.035 ms
 2  192.168.250.254 (192.168.250.254)  0.073 ms  0.045 ms  0.034 ms
 3  10.142.1.126 (10.142.1.126)  0.198 ms  0.212 ms  0.223 ms
 4  10.142.0.40 (10.142.0.40)  0.266 ms 10.142.0.42 (10.142.0.42)  0.248 ms 10.142.0.40 (10.142.0.40)  0.129 ms
 5  10.142.0.6 (10.142.0.6)  0.240 ms 10.142.0.8 (10.142.0.8)  0.297 ms 10.142.0.10 (10.142.0.10)  0.332 ms
 6  10.244.64.238 (10.244.64.238)  0.175 ms 10.244.64.240 (10.244.64.240)  0.195 ms 10.244.64.254 (10.244.64.254)  0.261 ms
 7  * 10.244.120.2 (10.244.120.2)  2.354 ms *
 8  was-cva1-sbb1-nc5.va.us (178.32.135.210)  1.721 ms was-nva1-sbb1-nc5.va.us (178.32.135.154)  1.705 ms was-cva1-sbb1-nc5.va.us (178.32.135.210)  1.532 ms
 9  10.200.2.195 (10.200.2.195)  1.479 ms  1.425 ms  1.421 ms
10  * * *
11  173.245.63.99 (173.245.63.99)  2.452 ms 173.245.63.119 (173.245.63.119)  2.617 ms 173.245.63.85 (173.245.63.85)  2.585 ms
12  172.67.133.148 (172.67.133.148)  1.738 ms  2.036 ms  1.867 ms
root@vps-535faf74:~# 

If you need to traceroute to specific port, you can use -p option

traceroute -T -p 587 smtp.google.com

-T specifies tcp option, some traceroute implementation do not support it.

tcptraceroute is another useful command

apt install tcptraceroute

To traceroute to a port, use

tcptraceroute smtp.google.com 25

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *