How to Trace the Path of a Network Packet in Linux



Linux


In this article, we show how to trace the path of a network packet in Linux.

In Linux, there is a traceroute program (some systems use the similar tracepath program instead) that displays a listing of all the "hops" that a network packet takes in its path from its original source to its destination.

It shows all the various routers that a network packet goes through before reaching its final destination.

So, for example, to trace the path of a network packet to dropbox.com, the code to do so is shown below.



So, with this simple one-line code, we are able to trace the path of a network packet in to the domain name, dropbox.com

Once we run this code, we get the following output below.

Tracing the route of a network packet in Linux

So you can see that it took 14 hops to get to the dropbox.com website.

The IP address of this dropbox website is 162.125.248.1

You can see this at the beginning of the code, traceroute to dropbox.com ... and you see this at hop #14.

The traceroute command also tells you how much time (in milliseconds) it took to go through the various hops.

This is very useful when you want to see how easy it is to navigate to a given website.

So this is how to trace the path of a network packet in Linux.


Related Resources

How to Randomly Select From or Shuffle a List in Python



HTML Comment Box is loading comments...