What is ICMP Protocol?

The ICMP represents Internet Control Message Protocol. It is a network layer protocol. It can be used for error handling in the network layer, and it is generally used on network devices, including routers. IP Protocol is a best-effect delivery service that delivers a datagram from its original source to its final destination. It has two deficiencies−

  • Lack of Error Control
  • Lack of assistance mechanisms

IP protocol also lacks a structure for host and management queries. A host needs to resolve if a router or another host is alive, and sometimes a network manager needs information from another host or router.

ICMP has been created to compensate for these deficiencies. It is a partner to the IP protocol.

ICMP is a network layer protocol. But, its messages are not passed directly to the data link layer. Instead, the messages are first encapsulated inside the IP datagrams before going to the lower layer.

The cost of the protocol field in the IP datagram is I, to indicate that IP data is an ICMP message.

The error reporting messages report issues that a router or a host (destination) may encounter when it phases an IP packet.

The query messages, which appear in pairs, help a host or a network manager to get specific data from a router or another host.

ICMP Message Format

AN ICMP message includes an 8-byte header and a variable size data format.

  • Type: It is an 8-bit field. It represents the ICMP message type. The values area from 0 to 127 are described for ICMPv6, and the values from 128 to 255 are the data messages.
  • Code: It is an 8-bit field that represents the subtype of the ICMP message.
  • Checksum: It is a 16-bit field to recognize whether the error exists in the message or not.