ICMP provides a set of messages that are used for various network management and error reporting purposes. These messages can indicate the status of a connection or report errors encountered during data transmission.

Echo request and reply (ping)

ICMP includes a simple message type knowns as “Echo Request” message. When a device (the source) wants to check if another device (the destination) is reachable and responsive on the network, it sends an ICMP Echo Request message to the destination. The destination device, if operational, receives the Echo Request and immediately sends back an “Echo Reply” message. This Echo Reply message contains the same data as the original Echo Request.

Ping command

The ping command commonly used in network troubleshooting, sends Echo Request message to a target host and measures the round-trip time for the Echo Reply. It’s a way to determine if a host is responding and to gauge network latency. You can use ping command in the terminal.

ping www.google.com

Time-to-Live (TTL) and Time-Exceeded message

TTL

ICMP message and include a TTL value, which represents the number of network hops (network devices) a packet can traverse before it expires. As a packet traverse routers and network devices (hops), each device decreases the TTL value by one. When the TTL reaches zero, the device processing the packet discards it.

Time-Exceeded

If a packet’s TTL reaches zero while still in transit, the intermediate network device (e.g. router) generates an ICMP “Time-Exceeded” message and sends it back to the source. The Time-Exceeded message indicates that the packet has been dropped due to the TTL reaches zero.

Traceroute

The TTL and Time-Exceeded is commonly used in “traceroute” tools, which help trace the route packets take through a network and measure the number of hops to reach a destination.

ICMP datagram structure

The ICMP packet is encapsulated in an IPv4 packet, after the IP header and inside the IP payload section. The ICMP packets have an 8-byte header and variable-sized data section. A ICMP header contains ICMP type, ICMP code, its own checksum mechanism, and rest of header.


Back to parent node: Internet Layer

Computer_networksINFO1112IPInternet_layerInternet_Control_Message_Protocol_ICMPpingTime-to-Live_TTLTime-ExceededTracerouteChecksumInternet_Protocol_IP