Internet Control Message Protocol (ICMP) is a network layer protocol from OSI model which provides troubleshooting, control and error message services. It is commonly used by network administrators to troubleshoot Internet connections in diagnostic utilities including ping and traceroute.
ICMP for Internet Protocol version 4 is called ICMPv4 and for Internet Protocol version 6 is called ICMPv6.
SOME OF ICMP’S FUNCTIONS ARE TO:
- Announce network errors – For eg when a host or network unreachable, due to link failure or some other reason. A transport layer packet directed at a port number with no receiver attached is also reported via ICMP.
- Announce network congestion – When a router receives packets at a much faster rate than it can forward and begins buffering too many packets, it will generate ICMP Source Quench messages. Directed at the sender, these messages ask for the rate of packet transmission to be slowed.
- Troubleshooting – ICMP supports Echo function which sends a packet on a round–trip between two hosts. A common network management utility is PING, Ping will transmit a series of packets, measuring average round–trip times and computing loss percentages.
- Announce Timeouts – If an IP packet’s TTL field drops to zero, the router discarding the packet will often generate an ICMP packet announcing this fact. Traceroute is a utility which maps network routes by sending packets with small TTL values and watching the ICMP timeout announcements.
Related- ICMP vs IGMP
The header starts after the IPv4 header and is identified by IP protocol number ‘1’. All ICMP packets have an 8-byte header and variable-sized data section. The first 4 bytes of the header have fixed format, while the last 4 bytes depend on the type/code of that packet.
TYPE – Type is 8 bits in size and specifies the format of the ICMP message.
Code – It is 8 bits in size and further qualifies the ICMP message.
Code error types have also been separately described in the below table –
ICMP Header Checksum – It is 16 bits in size. This is the 16-bit one’s complement of the one’s complement sum of the ICMP message starting with the Type field. The checksum field should be cleared to zero before generating the checksum.
Data – This parameter is of Variable length and contains the data specific to the message type indicated by the Type and Code fields.
Related- ICMP Redirects