Internet Control Message Protocol (ICMP)

Internet Control Message Protocol (ICMP) works in the network layer of the OSI model and the internet layer of the TCP/IP model. It is used to send control messages to network devices and hosts. Routers and other network devices monitor the operation of the network. When an error occurs, these devices send a message using ICMP. Messages that can be sent include "destination unreachable", "time exceeded", and "echo requests".

  • ICMP is a network layer protocol.
  • ICMP messages are not passed directly to the data link layer. The message is first encapsulated inside the IP datagram before going to the lower layer.

Types of ICMP messages

  • Information Messages − In this message, the sender sends a query to the host or router and expects an answer. For example, A host wants to know if a router is alive or not.
  • Error-reporting message − This message report problems that a router or a host (destination) may encounter when it processes an IP packet.
  • Query Message − It helps a router or a network manager to get specific information from a router or another host.
Error-Reporting Messages3Destination unreachable
4Source quench
11Time Exceeded
12Parameter Problem
Query Message8 or 0Echo request or reply
13 or 14Timestamp request or reply
17 or 18Address mask request or reply
10 or 9Router Solicitation or advertisement
  • Source Quench − It requests to decrease the traffic rate of message sending from source to destination.
  • Time Exceeded − When fragments are lost in a network the fragments hold by the router will be dropped and then ICMP will take the source IP from the discarded packet and inform the source, that datagram is discarded due to the time to live field reaches zero, by sending time exceeded message.
  • Fragmentation Required − When a router is unable to forward a datagram because it exceeds the MTU of the next-hop network and the DF (Don't Fragment) bit is set, the router is required to return an ICMP Destination Unreachable message to the source of the datagram, with the Code indicating fragmentation is needed and DF (Don’t Fragment) set.
  • Destination Unreachable − This error message indicates that the destination host, network, or port number that is specified in the IP packet is unreachable. This may happen due to the destination host device is down, an intermediate router is unable to find a path to forward the packet, and a firewall is configured to block connections from the source of the packet.
  • Redirect Message − A redirect error message is used when a router needs to tell a sender that it should use a different path for a specific destination. It occurs when the router knows a shorter path to the destination.

ICMP Basic Error Message Format

A basic ICMP error message would have the following format −

  • Type − The type field identifies the type of the message.
  • Code − The code field in ICMP describes the purpose of the message.
  • Checksum − The checksum field is used to validate ICMP messages.

Updated on: 23-Nov-2021

8K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started