ICMP Protocol Tutorial.
The full form of ICMP is Internet Control Message Protocol. It is part of the Internet Protocol suite, similar to TCP/IP.
However, it works in a very different manner from the other protocols. While other protocols are used for transferring user data, ICMP is only used to check network entity status.
The protocol is for exchanging information among computers about the network routing status. For example, a packet reaches the router over a link, but the router can not route further. In that case, the router originates an ICMP error to the sender node of the link.
Without ICMP, the sender will never come to know that there is a network failure.
Where does ICMP fit in OSI Reference Model?
As per the OSI model, ICMP is an example of a layer three protocol. But it differs in many ways. The ICMP does not assign any IP address similar to any other layer three (e.g., Internet Protocol) protocol. As per the OSI model, there is an application layer over the ICMP protocol layer.
As a part of the internet protocol suite, ICMP is part of the internet layer. When the IP layer needs to send a network status event, it uses ICMP for the control message.
The ping application, which is available with all operating systems, is an example of an ICMP application. When a network user needs to know if a destination (IP address) is reachable or not, he uses the ping (ping ip_addr
)command with the IP address. The destination is reachable if the output is successful. Otherwise, it is not reachable.
There are many options available with the ping command. Below are a few options. For a full list of all possible options, please refer to the ping man page.
- Ping an IP address from any of the interfaces.
- Check if an IP is reachable from a network interface.
- Use to ping an IP from a source IP.
- Specify the ping packet size. This is useful for checking the MTU of the underlying network.
Why do we need ICMP?
There is a very simple answer to this question. To know the error if there is a network problem. In the absence of ICMP, we will never be able to determine why and where routing fails.
ICMP Protocol Specification.
The complete protocol specification is in RFC 792. In this section, we will cover the specification in short. Mostly covering message formats, message types, and basic procedures.
The ICMP messages are only for error reporting, and there is no further message for an ICMP response to avoid looping. The following is the protocol stack for ICMP.
ICMP Message |
Internet Protocol (IP) |
DataLink Layer |
ICMP Message
The ICMP messages carry a payload for the IP layer. While transferring protocol messages, as a datagram, the value of protocol in the IP header is set to 1. Other fields are as per standard. Each ICMP message has a header and the actual payload. The first byte of the header has message type, code, and checksum. The remaining parameters depend on the message type.
Message Type (8 bits) | Code (8 Bits) | <——————Checksum (16 bits) —————–> |
It depends on the Message Type |
It depends on the Message Type |
ICMP Message Types
- Echo(8)
- Echo Reply (0)
- Destination Unreachable(3)
- Source Quench (4)
- Redirect (5)
- Time Exceeded (11)
- Parameter Problem (12)
- TimeStamp (13)
- TimeStamp Reply (14)
- Information Request (15)
- Information Reply (16)