Search code examples
networkingroutesnetwork-programmingroutertraceroute

How traceroute can receive an action from destination?


In traceroute, we know when destination (host) receives a packet with TTL=1, the host throws an error and does not delay.

So how can traceroute calculate distance (delay) between source and destination?


Solution

  • Traceroute sends probe packets towards the destination with increasing TTL. The node that the packets times out on is expected to return an ICMP Time exceeded message, which is then reported as hop.

    The delay is simply the time between sending the probe and receiving the error message.

    The last hop is either the destination's rejection (for UDP probes) or its echo reply (for ICMP echo probes).

    For completeness: a packet with TTL=1 isn't forwarded (by a gateway) and more. It can still be replied to by the destination.