Today we will tell you about what is ICMP Protocol their types and their message format. You can easily understand this topic by reading this blog, so let’s start.
What is ICMP Protocol?
The full name of ICMP is Internet Control Message Protocol. It works on the network layer protocol of the 3rd layer of the OSI model. It is used to handle errors in the network layer and is mostly used in network devices such as routers.
The job of ICMP is to report and debug all errors. This is because many errors are seen in the network layer.
The use of this protocol determines whether the data is reaching the destination at the right time or not.
Example:- Let’s say that a sender sends a message to a receiver but due to some reason the network router is unable to transmit the message to the receiver, then in this situation, the network router tells the sender that he is not able to send the message to the receiver.
As you know that IP is a network layer protocol. When data is transmitted (Logical Addressing) in any network, the IP is responsible for transmitting the data, and to do this it uses network protocols like TCP and UDP (transport layer protocol).
When a message is delivered from a source to a destination, Internet Protocol makes every effort to ensure that the message reaches the destination. But there are some limitations in the internet protocol too, which reduces its performance.
limitations of IP
The 2 major drawbacks of Internet protocol are given below. To understand the requirement of ICMP, it is necessary for you to understand these limitations properly.
- No Error Reporting –
- No Communication –
1. No Error Reporting:–
If it happens that the transmission of any data is discarded by the router, then it may be due to an error and for this, there is no such mechanism in the internet protocol so that the sender can be reported about this error.
Examples of some common errors are given below.
- Suppose if it happens that no router is found to deliver any data to the destination, then in this case the network router will discard the data packet.
- Suppose that if it happens that the life time of a data packet is completed while traveling in the internet and the value of time to live field has become zero in the data packet, then in such a situation this data packet will be discarded.
- Suppose if it happens that no data can reach the destination before the stipulated time, then in such a situation all the data will be discarded.
2. No Communication:–
It often happens that one device needs to communicate with other devices, in which case Internet Protocol does not have any mechanism so that devices can communicate with each other.
Examples Some common situations are given below:
- Before sending the data it should be determined several times whether the destination is still alive or not for the host.
- Often you may also need to get information about any host.
The ICMP protocol has been developed to overcome these shortcomings of the Internet Protocol. Internet Protocol and ICMP both work in unison. There is a message mechanism in ICMP Protocol so that the hosts keep getting information about the error and status.
Types of ICMP Protocol Message
There are two types of ICMP Protocol messages which are as follows:-
- Error reporting message
- Query message
1. Error reporting message:-
These are the same messages due to which ICMP Protocol provides information about errors.
The list of some error reporting messages is given below:-
- Destination Unreachable (Code 3):- If the router does not find a route for any of the packages then such conditions are thrown into the package and the sources are made to send to unreachable destinations.
- Source Quench (Code 4):- As you know, there is no flow control in IP. The sending device does not know anything about whether the speed of the data sent by it is according to the forwarding network router.
The processing destination is a host or not and when the speed of the sending device is very high then the IP sends some data packets discards. In this situation, ICMP provides flow control and sends the source quench message to the source device.
- Redirect (Code 5):– This is because routing is a dynamic process and only devices like network routers participate in it, so only one host has information about a single router.
So when this host transmits any data, the data will go through that network router to the right router and in this situation, the router will send a redirection message so that the host’s routing information can be updated and the host sends data directly to the right router.
- Time Exceeded (Code 11):– Any network router uses the network routing table to forward any data packet. If the routing table is not correct or if there are any errors in it, then in such a situation the data packet keeps rotating in one place. To avoid this situation, every packet has a time to live field.
The value of this field decreases on every router. As soon as the value of this field is zero, then this packet is discarded by the router. In this situation, the router sends the Time Exceeded message to the source.
- Parameter Unintelligible (Code 12):– If it happens that a network router or destination host finds any part of the data packet to be empty, then that data packet is discarded by the router and parameter unintelligible message is sent to the source. goes.
2. Query Message:-
These are the messages from which ICMP Protocol queries for the status of a host.
The list of common query messages along with their code is given below:-
- Echo Request (Code 8) & Echo reply (code 0):– These two query messages are used to diagnose problems in the network. These two messages determine whether two hosts can communicate with each other?
- Time-Stamp Request (Code 13) & Time Stamp Reply (Code 14):– Through these messages, we get to know how long a data packet took to travel from one host to another.
- Address Mask Request (Code 17) & Address Mask Reply (Code 18):– Each host can know its IP address but it is not necessary that it is aware of its subnet mask. You can send an address mask request to the host router and the router sends the subnet mask to the subnet mask as a reply message mask address.
ICMP Protocol Message Format
Till now you have known about 2 types of messages to be sent by ICMP. Now let’s try to learn about ICMP message format, Showing by image under ICMP message format.

- Type: Its size is 8 bits. This field is used to define the type of message.
- For Code: Error messages, this field has to define the subtype of the error. Its size is also 8 bits. The value of this field is zero for query messages.
- Checksum: Checksum is used to detect errors. Its size is 16 bits. The checksum is to be calculated by header and data.
- Rest of the Header: As we know that ICMP protocol message has to be encapsulated in an IP datagram. The rest of the header field in the ICMP message shows the remaining IP header.
- Data: In this field, the data packet through which the error has been seen contains complete information about that data packet.