- The entire path that a packet travels through
- Names and identity of routers and devices in your path
- Network Latency or more specifically the time taken to send and receive data to each devices on the path
Hops are nothing but the computers, routers, or any devices that comes in between the source and the destination.
Original sender is informed that the TTl value exceeded and it cannot forward the packet further.
Traceroute makes use of this TTL exceeded messages to find out routers that come across your path to destination(Because these exceeded messages send by the router will contain its address).
But you can exploit this behavior of sending TTL exceeded messages by routers/hops in between by purposely sending an IP packet with a TTL value of 1.
1
2
3
4
5
6
7
8
9
10
| root@workstation:~# trace route -n 8.8 . 8.8 trace route to 8.8 . 8.8 ( 8.8 . 8.8 ), 30 hops max, 60 byte packets 1 192.168 . 0.1 6.768 ms 6.462 ms 6.223 ms 2 183.83 . 192.1 5.842 ms 5.543 ms 5.288 ms 3 183.82 . 14.5 5.078 ms 6.755 ms 6.468 ms 4 183.82 . 14.57 20.789 ms 27.609 ms 27.931 ms 5 72.14 . 194.18 17.821 ms 17.652 ms 17.465 ms 6 66.249 . 94.170 19.378 ms 15.975 ms 23.017 ms 7 209.85 . 241.21 16.633 ms 16.607 ms 17.428 ms 8 8.8 . 8.8 17.144 ms 17.662 ms 17.228 ms |
- My Source Address (Which is my IP address)
- Destination address (Which is 8.8.8.8)
- And A destination UDP port number which is invalid. Means the traceroute utility will send packet to a UDP port in the range of 33434 to 33534, Which is normally unused.
Step 1: My Source address will make a packet with destination ip address of 8.8.8.8 and a destination port number between 33434 to 33534. And the important thing it does it to make the TTL Value 1
Step 2: Of course my packet will reach my gateway server. On seeing receiving the packet my gateway server will reduce the TTL by 1 (All routers/hops in between does this job of reducing the TTL value by 1). Once the TTL is reduced by the value of 1 (1-1= 0), the TTL value becomes zero. Hence my gateway server will send me back a TTL Time exceeded message. Please remember that when my gateway server sends a TTL exceeded message back to me, it will send the first 28 byte header of the initial packet i send.
Step 3: On receiving this TTL Time exceeded message, my traceroute program will come to know the source address and other details about the first hop (Which is my gateway server.).
Step 4: Now the traceroute program will again send the same UDP packet with the destination of 8.8.8.8, and a random UDP destination port between 33434 to 33534. But this time i will make the initial TTL 2. This is because my gateway router will reduce it by 1 and then forwards that same packet which send to the next hop/router (the packet send by my gateway to its next hop will have a TTL value of 1).
Step 5: On receiving UDP packet, the next hop to my gateway server will once again reduce it to 1 which means now the TTL has once again become 0. Hence it will send me back a ICMP Time exceeded message with its source address, and also the first 28 byte header of the packet which i send.
Step 6: On receiving that message of TTL Time Exceeded, my traceroute program will come to know about that hop/routers IP address and it will show that on my screen.
Step 7: Now again my traceroute program will make a similar UDP packet with again a random udp port with the destination address of 8.8.8.8. But this time the ttl value is made to 3, so that the ttl will automatically become 0, when it reaches the third hop/router(Please remember that my gateway and the next hop to it, will reduce it by 1 ). So that it will reply me with a TTL Time exceeded message, and my traceroute program will come to know about that hop/routers IP address.
Step 8: On receiving that reply, the traceroute program will once again make a UDP packet with TTL value of 4 this time. If i gets a TTL Time exceeded for that also, then my traceroute program will send a UDP packet with TTL of 5 and so on.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| root@workstation:~# tcpdump -n '(icmp or udp)' -vvv 12 : 13 : 06.585187 IP (tos 0x0 , ttl 1 , id 37285 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 43143 > 8.8 . 8.8 . 33434 : [bad udp cksum 0xd157 -> 0x0e59 !] UDP, length 32 12 : 13 : 06.585218 IP (tos 0x0 , ttl 1 , id 37286 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 38682 > 8.8 . 8.8 . 33435 : [bad udp cksum 0xd157 -> 0x1fc5 !] UDP, length 32 12 : 13 : 06.585228 IP (tos 0x0 , ttl 1 , id 37287 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 48381 > 8.8 . 8.8 . 33436 : [bad udp cksum 0xd157 -> 0xf9e0 !] UDP, length 32 12 : 13 : 06.585237 IP (tos 0x0 , ttl 2 , id 37288 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 57602 > 8.8 . 8.8 . 33437 : [bad udp cksum 0xd157 -> 0xd5da !] UDP, length 32 12 : 13 : 06.585247 IP (tos 0x0 , ttl 2 , id 37289 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 39195 > 8.8 . 8.8 . 33438 : [bad udp cksum 0xd157 -> 0x1dc1 !] UDP, length 32 12 : 13 : 06.585256 IP (tos 0x0 , ttl 2 , id 37290 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 47823 > 8.8 . 8.8 . 33439 : [bad udp cksum 0xd157 -> 0xfc0b !] UDP, length 32 12 : 13 : 06.585264 IP (tos 0x0 , ttl 3 , id 37291 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 52815 > 8.8 . 8.8 . 33440 : [bad udp cksum 0xd157 -> 0xe88a !] UDP, length 32 12 : 13 : 06.585273 IP (tos 0x0 , ttl 3 , id 37292 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 51780 > 8.8 . 8.8 . 33441 : [bad udp cksum 0xd157 -> 0xec94 !] UDP, length 32 12 : 13 : 06.585281 IP (tos 0x0 , ttl 3 , id 37293 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 34782 > 8.8 . 8.8 . 33442 : [bad udp cksum 0xd157 -> 0x2efa !] UDP, length 32 12 : 13 : 06.585290 IP (tos 0x0 , ttl 4 , id 37294 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 53015 > 8.8 . 8.8 . 33443 : [bad udp cksum 0xd157 -> 0xe7bf !] UDP, length 32 12 : 13 : 06.585299 IP (tos 0x0 , ttl 4 , id 37295 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 58417 > 8.8 . 8.8 . 33444 : [bad udp cksum 0xd157 -> 0xd2a4 !] UDP, length 32 12 : 13 : 06.585308 IP (tos 0x0 , ttl 4 , id 37296 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 55943 > 8.8 . 8.8 . 33445 : [bad udp cksum 0xd157 -> 0xdc4d !] UDP, length 32 12 : 13 : 06.585318 IP (tos 0x0 , ttl 5 , id 37297 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 33265 > 8.8 . 8.8 . 33446 : [bad udp cksum 0xd157 -> 0x34e3 !] UDP, length 32 12 : 13 : 06.585327 IP (tos 0x0 , ttl 5 , id 37298 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 53485 > 8.8 . 8.8 . 33447 : [bad udp cksum 0xd157 -> 0xe5e5 !] UDP, length 32 12 : 13 : 06.585335 IP (tos 0x0 , ttl 5 , id 37299 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 40992 > 8.8 . 8.8 . 33448 : [bad udp cksum 0xd157 -> 0x16b2 !] UDP, length 32 12 : 13 : 06.585344 IP (tos 0x0 , ttl 6 , id 37300 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.102 . 41538 > 8.8 . 8.8 . 33449 : [bad udp cksum 0xd157 -> 0x148f !] UDP, length 32 |
So the bottom line is my traceroute program sends three UDP packets to each hop to simply calculate the round trip average. because the traceroute output shows you those three values in its output. Please see the traceroute output more closely. It shows three millisecond values for each hop. To get a clear idea about the round trip time.
One more interesting thing to note is that each time my traceroute program is sending a different random UDP port number. This is to identify the reply belonged to which packet. As told before the reply messages send by the hops and destination contains the header of original packet we send, hence traceroute program can accurately calculate the round trip time (For each three UDP packets send to each hop), as it can easily identify the reply and correlate. The random port numbers are sort of identifiers to identify the reply.
1
2
3
4
5
6
7
8
| 192.168 . 0.1 > 192.168 . 0.102 : ICMP time exceeded in -transit, length 68 IP (tos 0x0 , ttl 1 , id 37285 , offset 0 , flags [none], proto UDP ( 17 ), le ngth 60 ) 192.168 . 0.1 > 192.168 . 0.102 : ICMP time exceeded in -transit, length 68 IP (tos 0x0 , ttl 1 , id 37286 , offset 0 , flags [none], proto UDP ( 17 ), le ngth 60 ) 183.83 . 192.1 > 192.168 . 0.102 : ICMP time exceeded in -transit, length 60 IP (tos 0x0 , id 37288 , offset 0 , flags [none], proto UDP ( 17 ), length 60 ) 192.168 . 0.1 > 192.168 . 0.102 : ICMP time exceeded in -transit, length 68 IP (tos 0x0 , ttl 1 , id 37287 , offset 0 , flags [none], proto UDP ( 17 ), le ngth 60 ) |
1
2
3
4
5
6
| 8.8 . 8.8 > 192.168 . 0.102 : ICMP 8.8 . 8.8 udp port 33458 unreachable, length 68 IP (tos 0x80 , ttl 2 , id 37309 , offset 0 , flags [none], proto UDP ( 17 ), l ength 60 ) 8.8 . 8.8 > 192.168 . 0.102 : ICMP 8.8 . 8.8 udp port 33457 unreachable, length 68 IP (tos 0x80 , ttl 1 , id 37308 , offset 0 , flags [none], proto UDP ( 17 ), l ength 60 ) 8.8 . 8.8 > 192.168 . 0.102 : ICMP 8.8 . 8.8 udp port 33459 unreachable, length 68 IP (tos 0x80 , ttl 2 , id 37310 , offset 0 , flags [none], proto UDP ( 17 ), l ength 60 ) |
- UDP Traceroute
- ICMP traceroute
- TCP Traceroute
1
| root@workstation:~# trace route -I -n 8.8 . 8.8 |
ICMP for traceroute works the same way as UDP traceroute. Traceroute program will send ICMP Echo Request messages and the hops in between will reply with a ICMP Time exceeded messages. But the final destination will reply with ICMP Echo reply.
Tracert command available in windows operating system by default uses ICMP traceroute method.