Finding Path of Packets
Tags: tracert, traceroute, packets, networking
Published: 2017-08-14 12:31:19

---
title: Finding Path of Packets
published: true
description: This article mainly focuses on the use of tracert or traceroot command
tags: tracert, traceroute, packets, networking
---
We know data travels across the internet in small packets. But it does not fly from one computer to another computer instead it passes through various network devices. But, can we determine an approximate path through which the packets travel ?
The answer is yes!

For example the path of accessing `www.facebook.com` form Kolkata (India) looks like this.
(Note : Here I have joined server locations with straight lines for simplicity)
![Reaching facebook.com from Kolkata](https://thepracticaldev.s3.amazonaws.com/i/ww1isle1mfwqspu8qc3u.jpg)

It can be done by using `tracert` command on Windows which is equivalent to `traceroute` command on Mac and Linux.
__Note :__ These commands take some time to execute so be patient or to cancel mid-way press `ctrl+c`.

`tracert` or `traceroute` displays the route taken by packets from a local system to reach a remote server/host over an IP network (network that uses IP to send and receive messages between one or more computers).

`tracert` sends __ICMP__ (Internet Control Message Protocol) echo packets to the destination and listens for the reply. 
Trace route sets the TTL to 1 and increments it for every hop. The routers receiving the message decrement this value and when it reaches 0 they reply a message that the TTL has reached zero. This reply then tells client (which executed the command) from where it has returned. This process continues until the Destination is reached.

Following is a `tracert` on `www.facebook.com`. That I have used to plot the map shown above.
```PowerShellWindows
C:\Users\ROUNAK POLLEY>tracert www.facebook.com

Tracing route to star-mini.c10r.facebook.com [157.240.13.35]
over a maximum of 30 hops:

  1     2 ms     1 ms     1 ms  192.168.0.1
  2     4 ms     3 ms     3 ms  172.17.149.1
  3     7 ms    21 ms    13 ms  node-203-171-243-1.alliancebroadband.in [203.171.243.1]
  4     7 ms     7 ms     8 ms  192.168.199.109
  5     4 ms     4 ms     4 ms  node-203-171-240-1.alliancebroadband.in [203.171.240.1]
  6    42 ms    45 ms    46 ms  172.31.180.57
  7    42 ms    43 ms    42 ms  ix-ae-4-2.tcore1.CXR-Chennai.as6453.net [180.87.36.9]
  8    84 ms    77 ms    78 ms  if-ae-3-3.tcore2.CXR-Chennai.as6453.net [180.87.36.6]
  9    74 ms    75 ms    75 ms  if-ae-6-2.tcore2.SVW-Singapore.as6453.net [180.87.37.14]
 10    94 ms    81 ms    77 ms  180.87.15.246
 11    77 ms    78 ms    77 ms  po121.asw02.sin1.tfbnw.net [173.252.64.50]
 12    78 ms    77 ms    78 ms  po224.psw04.sin6.tfbnw.net [157.240.34.51]
 13    77 ms    76 ms    79 ms  157.240.36.117
 14    78 ms    76 ms    76 ms  edge-star-mini-shv-02-sin6.facebook.com [157.240.13.35]

Trace complete.
```
Output of the command :
* The output is divided into columns which are

__hop Number__, __RTT 1__, __RTT 2__, __RTT 3__ __Domain Name and IP Address__
RTT stands for Round Trip Time.
* Here `192.168.0.1` is the IP address of my router. And _alliancebroadband.in_ is my __ISP__ (Internet Service Provider) etc.
* If a router does not respond within a timeout (TTL) then asterisk is printed. For example : 

```PowerShellWindows
 3     *        *        *     Request timed out. 
 4     5 ms     *        *     node-203-171-243-1.alliancebroadband.in[203.171.243.1]
```
* Generally when we use a IP location finder on the IP addresses returned by `tracert` we see that some of the IP(s) are private. This is due to the fact that these are the internal IP(s) of servers/gateways of some organizations.
 
'Hops' are nothing but the computers, routers, or any devices between the source and the destination.
For using different options with `tracert` type 'tracert' and press 'enter' (In the command prompt). It will show all the available syntax.

To visualize the physical locations we just use any IP Geolocation service like https://www.iplocation.net . And then simply plot them on the map.