ICMP — MORE THAN YOU THINK

Sagar
8 min readJan 10, 2021

In the world of networking among ’n’ number of protocols , there is one which is always vital for this field and always being the supportive one, YES it’s what you think of the ICMP(Internet Control Message Protocol) .

In the bundle of OSI Model, the famous IP(Internet Protocol) also has restrictions which is that it provides unreliable as well as connectionless datagram delivery, the simple reason being it was designed in that way because it makes it easier as well as faster to use. The major role of IP is to deliver the datagram(Independent message ) from the original source to destination, but as discussed above it lacks here with the following deficiencies :

  • Lack of error control
  • Lack of Assistance Mechanism

There is no way that IP can report something back, if things have not gone the destined way, for instance if a router discards a datagram because it cannot ping the defined path or the TTL(Time to Live Value) is being reduced to zero.

For this only the savior ICMP was designed, simply putting the ICMP is a supportive protocol in the IP suite, the first definition regarding the protocol was introduced by Jon Postel.

Now let’s look at how it handles things :

  • Types of Messages: ICMP Messages are divided into two broad categories:
    1. Error-Reporting Message : It’s used when the router or host encounter to process the IP Packet.
    2.Query Message : Used on the occasion when some peculiar information is needed from one host to another.

Before diving into the detail of the ICMP Messages lets probe into the Message Format ICMP used:

The first field is ICMP type which defines the type of message, the code field majorly used to tell the reason for particular message type , the checksum is a long 16 bit field which is basically used to validate the integrity of the packets that are exchanged. The last big part data section carries the information regarding the original packet that has the error.

ERROR REPORTING :

Now let’s dive deep into these topics and have a better understanding of it, ICMP has this major responsibility to report errors, make sure to note that it doesn’t rectify the error it just simply reports them, resolving is taken at the higher levels. Another important thing is that

ICMP ALWAYS REPORT ERROR TO THE ORIGINAL SOURCE

There are five type of error that are handled:

  1. Destination Unreachable :In the situations where the router is not able to find the path for a datagram and hence not able to deliver it ,so the datagram is discarded and the router sends the Destination Unreachable Message back to the source host that has initiated the datagram.
Destination Host Unreachable.

2. Source Quench :As we know that IP is a connectionless protocol, that means it doesn’t care about the state of the datagram it has sent ,in a way there is a communication glitch between the source host, router which will forward it and the destination host. The major consequences of this are the lack of flow control in IP.

So the need for a source quench arises here, how?

The lack of flow control will lead into the congestion at the router or the destination host, they have a limited size queue buffer for analyzing the datagrams ,so if it receives the datagram at higher rate then its capability to process, it will be overwhelmed by it and henceforth it has to discard some of it in order to keep the buffer working, for this case the source quench messages were introduced ,they were designed in a way to add a flow control to IP When a router or a host discard a datagram due to congestion they send a source quench message to the source. This message has basically two purposes: one is to inform that a datagram has been discarded as well as inform that there is a conjunction somewhere between the route so the source should slow down the process of sending the datagrams.

Source Quench

3. Time Exceeded:
Time exceeded message used in two cases:

  • As we already know that router uses routing table to find the next hop, but sometime there is error in one or more routing table and because of which a packet can travel in a loop or a cycle going from one router to another and not able to reach its destination ,so to overcome this problem TTL (time to live) is introduced . When a datagram visits a router the value of this particular field is decremented by 1, by the time the value reaches 0 the router needs to inform the source, for this Time Exceeded Message is generated and sent to the source.
  • Another usage is that, when not all arguments that make up a message arrive at a destination host within a certain time limit this message is generated in response to that.
Time Exceeded Message

4. Parameter problem : Any ambiguity in the header part of the diagram creates some serious problems as the datagram can travel through the internet, if this issue is detected router discussed in the datagram and sends a a Parameter-Problem Message back to the source.

ICMP Parameter Problem

5. Redirection: For a successful transmission of a packet from one network to another network, router needs to

Know the appropriate IP address of each other, this is also applicable for hosts, so for instance both the router as well as hosts should have an adequate routing table, for this they took part in the routing update process, how’s it done …… Well that’s for some other day but for better understanding here let’s keep in the mind that the router is dynamic and always alert and updated.

However on the contrary, hosts are not allowed or moreover they don’t take part in this , for the simple reason that there are more no. of hosts on the internet than routers. Constantly updating these routers generate unacceptable traffic for this host uses static routing, and usually they know the IP of only one router that is the default one. This is the reason why host may send a datagram, destined for another network to wrong router.

If this the case then the router which receives the datagram will forward it to the respective one, as well as it will send a Redirection Message to the host.

Redirection

Query :

As we have already discussed, apart from error reporting ICMP can also be used to diagnose some network problem, this is done by the help of four different pairs of messages . In this a node send a message that is answered in specific format , query message is encapsulated in a IP packet, which is inside the Data Link Layer frame .

Encapsulation of ICMP query messages

QUERY:

As we have already discussed, apart from error reporting ICMP can also be used to diagnose some network problem, this is done by the help of four different pairs of messages . In this a node sends a message that is answered in specific format , the query message is encapsulated in an IP packet, which is inside the Data Link Layer frame .

1.Echo Request and Reply :The Echo Request and Echo Reply are designed for identification and diagnosis purposes. Networking admins and managers use this pair to identify the root of the problem.

To understand it better let’s look at it in a way that one has requested and another has replied to it, in a way we can find out whether two parties can communicate with each other or not. This communication is at the IP level, because ICMP messages are encapsulated in IP datagrams. The communication between the host also confirms that intermediate routers are receiving, processing and forwarding the IP datagrams. Most of you heard the ping tool which uses this but will cover these debugging tools in upcoming parts.

2. Timestamp Request and Reply: This is used to determine and find the round trip time (complete time taken for the journey) of an IP datagram, they can also be used to synchronize the clocks in two machines.

3. Address-Mask Request and Reply : Sometimes a scenario can arise where a host may know the IP address, but does not have the knowledge of the corresponding mask value of IP address. For an instance it knows, IP address is 190.31.23.45 but may not know the corresponding mask value that is 24, so in these conditions host send the Address-Mask Request directly to router on the LAN if it knows the address, if not then it will broadcast the message, router receiving the requested message will respond with an Address-Mask Reply providing the necessary information. This can also be applied to its full IP address to get its subnet address.

4. Router Solicitation and Advertisement: You remembered we discussed the redirection message , that is a host wants to send data to another on a different network so it needed the information about the routers connected to it. Not only this host must know that if the router is alive or functioning, for this sole purpose Router-Solicitation and Router-Advertisement messages are used.

A host can either broadcast or multicast router-solicitation message, the router or routers that receive this respond with the Router-Advertisement message and the routing information is been broadcast with it , one thing to be noted here that when router send the advertisement message out its not only announcing its own presence as well as its telling about all the router it knows.

--

--

Sagar

An Enthusiast learner who seeks to learn the tech in a whole new different perspective.