views:

2763

answers:

3

It seems almost magical. What is the traceroute command doing in order to map out the entire path to some other node on the Internet?

+18  A: 

traceroute sets the TTL (Time To LIve) field 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. With this reply the client knowns who's in between. do this iteratively until your destination and you got the (at least one of them) route

Joachim Kerschbaumer
+11  A: 

Traceroute transmits packets with small TTL (Time To Live) values. The TTL is an IP header field that is used to prevent packets from running into endless loops. When a router that handles the packet subtracts one from the packet's TTL. The packet expires and it's discarded when the TTL reaches zero.

Traceroute sends ICMP Time Exceeded messages, (RFC 792), back to the sender when this occurs. By using small TTL values, the packets will quickly expire, so traceroute causes all routers along a packet's path to generate the ICMP messages that identify the router.

For example, TTL = 1 should produce the message from the first router, TTL = 2 generates a message from the second router in the path, and so on...

CMS
does this mean that you can start a traceroute from hop 5 by specifying ttl=5
webly
+2  A: 

How does traceroute work?

thijs
Why are 3 UDP packets sent according to the link above??
dhruvbird
@dhruvbird:Tracing route to www.l.google.com [209.85.229.99]over a maximum of 30 hops: 1 <1 ms <1 ms <1 ms router-apd00s1-core.XXXXXX [10.33.xx.x]Traceroute does 3 tries for every hop.
thijs
@thijs: So you mean to say that it takes the average(mean) of the 3 runs?
dhruvbird
@dhruvbird: Did you run traceroute from within a command prompt? If you do that you'll see three attempts with three times for each hop. That's how Microsoft implemented their traceroute tool...
thijs
@thijs: Ah! I see what you mean. Thanks :)
dhruvbird