Application of ICMP-Traceroute


This is a debugging tool which uses ICMP to:

  • Trace the route of the packet from source to destination.
  • Names and identity of the routers along the path.
  • Network Latency by determining the duration of time taken when the data is send and response is received by each hop.

How does it work:

untitled image

It used two of the ICMP message that is time exceeded and destination unreachable.

Suppose the traceroute command from Host A is used for Host B

Below is the steps for tracing the route to Host B

  • Host A, will send a UDP packet with destination of B, encapsulated in an IP packet with TTL value of 1.
  • So once the packet reaches the router “R1”, it drops the packet as TTL is 0 and sends a response back to A that is time-exceeded ICMP message.
  • The traceroute program receives the ICMP message and get to know the IP address of R1 and calculates the time difference when the packet was send and response was received. This is used for measuring the round-trip time.
  • Now again Host A will send the UDP packet but with TTL set to 2 and get to know the IP address of R2 and its RTT.
  • Same packet is formed, with TTL set to 3, 4 and so on.
  • After several attempt with change TTL, there is no response, which can either be because of packet being lost or destination is reached.
  • To get the exact reason, the port number in UDP is set such that it is not supported by UDP(>1023).
  • So once the packet reaches the host and cannot find any application with that port, it discards the packet with ICMP message( Destination unreachable, code:3(port Unreachable)).
  • Now the traceroute program records the destination address of the arrived datagram and makes note of RTT.
  • Receiving the destination unreachable message with a code value 3 is an indication that the whole route has been found and there is no need to send more packets
untitled image

Categories: Networking

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: