This tutorial explains the purposes, functions, and specifications of the ICMP protocol. Learn what the ICMP is and why it is required in a computer network.
What is ICMP and why is it required?
TCP/IP model defines how data flows between hosts in a network. It divides the entire communication and data transmission process into four layers. These layers are the Network interface, Internet, Transport, and Application. It also assigns specific responsibilities to each layer. To provide the assigned responsibilities, each layer uses several protocols. A protocol is a set of rules that allows communication and data transmission between different hosts of the same layer.
IP is a protocol. It works in the Internet layer of the TCP/IP model. The IP protocol is responsible for creating, sending, transferring, and accepting datagrams or IP packets. An IP packet is a small piece of the data stream that is transferred between two hosts of a network. Even an IP packet contains only a chunk of the data stream, still, it contains all the necessary information that is required to transmit it to the destination.
IP protocol sends each IP packet as an individual packet capable of taking whatever route is available to reach the destination. Depending on the network size, a packet can traverse multiple hosts, routers, and other networking devices until it reaches its final destination.
Since a packet passes through several devices in its journey, it may fail to reach its final destination for several reasons such as a link is down, a middle router is unable to forward it, the buffer of the next-hop is full, or the destination address does not exist. In such a case, the device that detects an error simply destroy the packet and move on to the next packet waiting to be processed.
Unfortunately, the IP protocol itself provides no mechanism that can help the sender device learn about failures. The IP protocol uses a connectionless, best effort, and unreliable method of packet delivery. Once an IP packet has been processed, the IP protocol just looks for the next packet.
To help the sender device test connectivity, learn about failures, and debug unexpected circumstances, the developers added a special mechanism to the IP protocol. This mechanism is known as the Internet Control Message Protocol (ICMP). Since the IP protocol depends on ICMP for error detection, the ICMP is considered a required part of IP and must be included in every IP implementation.
Due to any reason if a packet is destroyed in the middle of its journey, the device that destroys the packet may or may not choose to inform the original sender about it. If it chooses to inform the sender, it can use ICMP. ICMP allows a device to inform a source when a packet sent by the source experiences problems.
ICMP specifications
The core functionality of ICMP is defined in RFC 792 of STD 5. STDs are the standard protocols of the Internet. Every IP implementation is required to follow them. RFCs are the sections of STDs. An STD may include several RFCs. Some portions of ICMP have been redefined, updated, and clarified in RFC 1122 and RFC 1812. RFC 1122 defines host network requirements and RFC 1822 defines router requirements.
To communicate with other systems of the network, a system runs several protocols. Each protocol has a unique ID that is used to identify the data packets that are sent or received by the protocol. Protocol ID of ICMP is 1. When a system receives a data packet that contains protocol ID 1, the system passes the packet to the ICMP for further processing.
ICMP works at a layer above the IP protocol. IP protocol uses ICMP to report and inform events, changes, and errors. Since ICMP is not used to deliver application data, it is not considered as a transport layer protocol even it works above IP. You can consider ICMP as a control and management protocol of IP. ICMP and IP are inseparable and tightly interwoven. To work reliably and consistently, every IP implementation is required to include ICMP.
Functions of ICMP
ICMP was primarily designed for devices that work in the path that connects the sender device to the receiver device. The most common device that works in the middle of the path is the router. ICMP is not restricted to routers. Any device in the network can use ICMP and send messages to another device. ICMP provides a single mechanism for all control and information messages.
The main functions of ICMP are the following.
- Allow routers to inform a source when an IP packet sent by the source is undeliverable.
- Allow a source to discover all available paths to the destination device.
- Allow a source to check whether the destination device is online and up.
- Allow administrators to test connectivity and debug connectivity-related issues.
Error reporting or error correction
ICMP does not correct any errors. It only provides a way for devices that encounter an error to report the error to the source. In the protocol specification, ICMP outlines possible actions to take in response to error reports. Sender devices have the flexibility to take the suggested action.
This tutorial is the first part of the article "ICMP (Internet Control Message Protocol) Explained through examples". Other parts of this tutorial are the following.
That's all for this part. If you like this tutorial, please don't forget to share it with friends through your favorite social channel.