Lets try to answer this question - How does a traceroute works ?
On the konsole we type ( for example ) :
traceroute google.com
The output will be something like :
=====================================
traceroute to google.com (209.85.171.99), 30 hops max, 40 byte packets
1 192.168.0.4 (192.168.0.4) 13.654 ms 13.722 ms 13.737 ms
2 dsl-KK-static-001.192.95.61.airtelbroadband.in (61.95.192.1) 82.682 ms 82.896 ms 83.190 ms
3 ABTS-KK-Static-173.32.166.122.airtelbroadband.in (122.166.32.173) 83.483 ms 83.689 ms 84.059 ms
4 ABTS-KK-Static-009.32.166.122.airtelbroadband.in (122.166.32.9) 84.278 ms 84.572 ms 84.785 ms
5 122.175.255.29 (122.175.255.29) 85.119 ms 85.656 ms 85.882 ms
6 125.21.167.70 (125.21.167.70) 86.347 ms * *
7 * so-4-3-2.edge2.LosAngeles1.Level3.net (4.78.205.153) 322.074 ms 323.890 ms
8 vlan99.csw4.LosAngeles1.Level3.net (4.68.20.254) 324.165 ms 326.952 ms vlan69.csw1.LosAngeles1.Level3.net (4.68.20.62) 328.199 ms
9 ae-93-93.ebr3.LosAngeles1.Level3.net (4.69.137.45) 327.240 ms ae-63-63.ebr3.LosAngeles1.Level3.net (4.69.137.33) 327.550 ms ae-73-73.ebr3.LosAngeles1.Level3.net (4.69.137.37) 327.859 ms
10 ae-2.ebr3.SanJose1.Level3.net (4.69.132.9) 328.582 ms 328.933 ms 336.521 ms
11 ae-93-93.csw4.SanJose1.Level3.net (4.69.134.238) 336.794 ms ae-63-63.csw1.SanJose1.Level3.net (4.69.134.226) 339.650 ms ae-73-73.csw2.SanJose1.Level3.net (4.69.134.230) 321.976 ms
12 ae-81-81.ebr1.SanJose1.Level3.net (4.69.134.201) 317.552 ms ae-91-91.ebr1.SanJose1.Level3.net (4.69.134.205) 315.267 ms ae-61-61.ebr1.SanJose1.Level3.net (4.69.134.193) 312.909 ms
13 ae-3.ebr1.Seattle1.Level3.net (4.69.132.50) 353.243 ms 355.277 ms 355.642 ms
14 ae-11-53.car1.Seattle1.Level3.net (4.68.105.66) 358.504 ms ae-11-51.car1.Seattle1.Level3.net (4.68.105.2) 358.818 ms ae-11-55.car1.Seattle1.Level3.net (4.68.105.130) 361.111 ms
15 GOOGLE-INC.car1.Seattle1.Level3.net (4.79.104.74) 356.893 ms 358.424 ms 355.850 ms
16 209.85.249.34 (209.85.249.34) 325.808 ms 326.099 ms 209.85.249.32 (209.85.249.32) 327.433 ms
17 66.249.95.208 (66.249.95.208) 315.869 ms 209.85.249.16 (209.85.249.16) 316.681 ms 317.411 ms
18 * * *
19 (72.14.233.37) 331.734 ms 331.891 ms 64.233.174.97 (64.233.174.97) 334.826 ms
20 209.85.251.141 (209.85.251.141) 327.847 ms 209.85.251.153 (209.85.251.153) 368.172 ms 368.482 ms
21 74.125.30.130 (74.125.30.130) 365.568 ms 363.712 ms 74.125.30.134 (74.125.30.134) 364.437 ms
22 * * *
23 * * *
24 * * *
25 * * *
26 * * *
27 * * *
28 * * *
29 * * *
30 * * *
=====================================
Lets now understand this :
1. The first line of the output gives the IP address of the google.com, which is 209.85.171.99 and the maximum number of hops traceroute will keep track of the packets before it reaches the destination and the size of the packets which is 40 bytes.
2. The second hop is always to ones ISP’s gateway as shown by the address. On the same line, followed by the IP address, there are three time values in milli seconds. There are three values because traceroute by default sends simultaneously, 3 packets of 40 bytes each. And the three time values are the time taken to send the packets and receive a ICMP TIME_EXCEEDED response from the gateway. Put another way, these three values are the round trip times of the packets. So for the three packets to reach my ISP’s gateway, and get an echo back, it takes 13.654 ms 13.722 ms 13.737 ms.
3. Lets look at the 6th and 7th hops in the output above. If you compare the times, you will find a drastic increase in the times ( from 6th to 7th hop ). This is because up till the sixth hop, the gateway servers were within the Indian sub-continent itself. The 7th hops went to Los Angeles and so it takes that much more time to get a reply. Generally, smaller numbers mean better connections.
4. And from 22nd hop I get a series of time outs as shown by the asterisks. So my trace of the www.google.com domain resulted in a series of time outs and did not complete. The problems could be one of the following:
a.) The network connection between the server on the 21th hop and that on 22th hop is broken.
b.) The server on the 22th hop is down.
c.) Or there is some problem with the way in which the server on the 22th hop has been setup.
This is how we analize the traceroute result.
Now proceeding with the discussion further , lets talk about TCP/IP. The TCP/IP packets can be divided into two types :
1. IP ( Internet Protocol ) packets
2. ICMP ( Internet Control Message Protocol ) packets
Each of these packets has a Header and Data part. The header contains information about sender, the target , TTL and other information necessary to take the packet to the destination.
There are nearly 13 types of ICMP packets ( ICMP is used for errors ) . One of them ( which is our concern here ) is ICMP_ECHO_REQUEST. This packet is used for pinging.
For a IP packet, it contains TCP and UDP as data parts. Also IP packets have TTL as one of the headers. This TTL value serves a great role in killing the mis-routed packets. If the network has some problem and these packets get mis-routed , they need to be timed out or else they will increase the bandwidth. Therefore we specify a TTL value.
This TTL value is decreased every time it crosess a router. If the packets goes through too many hops the packet gets killed and an ICMP error is sent back to the sender.
Now here is how traceroute works :
1. First it sends packets with TTL= 1, the packet goes through the first hop and dies.
2. That router sends back an ICMP error and that way we can determine its IP/ Hostname.
3. Then traceroute send packets with TTL=2 , it passes the first router and loses the TTL value by 1 , and then goes to the second router and dies. Thus we get the IP/ Hostname of the second router.
4. This continues until the packet reaches its destination.
This is How a Traceroute works .


