Internet Control Message Protocol (ICMP)
Since IP does not have an inbuilt mechanism for sending error and control messages. It depends on Internet Control Message Protocol(ICMP) to provide an error control. It is used for reporting errors and management queries. It is a supporting protocol and is used by networks devices like routers for sending error messages and operations information., e.g. the requested service is not available or that a host or router could not be reached.
ICMPv4 Packet Format :
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
Source quench message :
Source quench message is a request to decrease the traffic rate for messages sending to the host(destination). Or we can say when receiving host detects that the rate of sending packets (traffic rate) to it is too fast it sends the source quench message to the source to slow the pace down so that no packet can be lost.
ICMP will take the source IP from the discarded packet and informs the source by sending a source quench message.
Then source will reduce the speed of transmission so that router will be free from congestion.
When the congestion router is far away from the source the ICMP will send hop by hop source quench message so that every router will reduce the speed of transmission.
Parameter problem :
Whenever packets come to the router then the calculated header checksum should be equal to the received header checksum then the only the packet is accepted by the router.
If there is a mismatch packet will be dropped by the router.
ICMP will take the source IP from the discarded packet and informs to the source by sending a parameter problem message.
Time exceeded message :
When some fragments are lost in a network then the holding fragment by the router will be dropped then ICMP will take the source IP from the discarded packet and informs the source, of discarded datagram due to time to live field reaches zero, by sending time exceeded message.
Destination un-reachable :
Destination unreachable is generated by the host or its inbound gateway to inform the client that the destination is unreachable for some reason.
There is no necessary condition that the only the router gives the ICMP error message some time the destination host sends an ICMP error message when any type of failure (link failure, hardware failure, port failure, etc) happens in the network.
Redirection message :
Redirect requests data packets are sent on an alternate route. The message informs a host to update its routing information (to send packets on an alternate route).
Ex. If the host tries to send data through a router R1 and R1 sends data on a router R2 and there is a direct way from the host to R2. Then R1 will send a redirect message to inform the host that there is the best way to the destination directly through R2 available. The host then sends data packets for the destination directly to R2.
The router R2 will send the original datagram to the intended destination.
But if the datagram contains routing information then this message will not be sent even if a better route is available as redirects should only be sent by gateways and should not be sent by Internet hosts.
Whenever a packet is forwarded in a wrong direction later it is re-directed in a current direction then ICMP will send a re-directed message.
This article is contributed by Aman Chauhan.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.