ICMP is a network management protocol that does not require a transport layer protocol to send data between devices. Unlike other protocols that require handshakes, ICMP is connectionless.
ICMP is used in popular terminal utilities such as traceroute and ping to assess network performance. The traceroute utility displays the actual routing path that a packet of data took to reach its destination, which can help administrators identify sources of network delays.
What is ICMP?
ICMP (Internet Control Message Protocol) is a network layer protocol that supports the core Internet protocols. It’s often used for error reporting by network devices, such as routers, and testing to see if data gets to its destination properly and on time. This makes it an essential part of the network communications process, although ICMP also gets utilized in Distributed Denial-of-Service attacks.
In computer networking, understanding what are the uses of ICMP is crucial for network administrators and engineers, as it plays a pivotal role in facilitating communication, troubleshooting, and maintaining the overall health and efficiency of networks.
Unlike other protocols that use TCP or UDP, ICMP is a connectionless protocol. It doesn’t require the device on the other end of the transmission to carry a handshake before sending an ICMP message. This is simpler and more efficient, but it also means that ICMP can’t provide feedback mechanisms such as flow control.
An ICMP message contains two main things: an 8-bit type code and an optional payload. The type code determines the kind of ICMP message being sent, while the payload — up to 32 bytes — tells the recipient what caused the error.
For example, if a router receives a packet from a host that is too large for the routing infrastructure to handle, it will send back an ICMP error message to the source with information about the size of the packet. This can help the source reduce the amount of data it’s sending, avoiding potential congestion and other problems.
ICMP Types
ICMP messages can be one of several types. The first 8 bits of the ICMP header define the message type and briefly describe what the packet is used for. This enables network devices to understand the message and handle it appropriately. The remainder of the ICMP packet is a payload of up to 32 bytes.
A network device might also use an ICMP Redirect message (Type 5) to help make routing more efficient. This happens when the default gateway knows that a different local router is better for the traffic that the host is trying to send to its destination network.
Unlike higher-level Internet layer protocols, ICMP does not open a connection between devices to send data. Instead, it tries to detect and report errors so that data transfer can still happen.
For example, if an incoming IP packet is too large for a router to manage, it will discard the data and send an ICMP error message to the transmitting device with details of what went wrong. This allows the sender to fix the problem and resend the data, ensuring effective communication.
ICMP Errors
The Internet Protocol (IP) provides best-effort services, which doesn’t guarantee data packets will reach their intended destination. To compensate for this, ICMP was developed to allow network devices to report errors or exceptions during data transmission.
Unlike TCP, ICMP operates as a connectionless protocol, which requires establishing a connection before sending data. This makes it easy for ICMP to send error messages between devices without going through a TCP handshake.
IP errors can arise from many different reasons. For example, extremely large data packets can sometimes be too big for a router to manage. So, the router will discard the packet and send an ICMP message back to the original device about why the data was discarded.
Another common cause of ICMP errors is when a router finds an IP packet’s Time to Live (TTL) field has expired. The TTL field is a variable that is decreased by every router that processes the packet. When it reaches zero, the router will drop the packet and send an ICMP message explaining why it was discarded to the original device.
Besides reporting errors, the most important use of ICMP is network diagnostics. For example, the popular terminal utilities ping and traceroute send ICMP messages to show the routing path between two Internet devices.
ICMP Replies
ICMP replies, or ICMP messages sent back to the device that sent an ICMP error message, play an important role in network operations. These messages allow the network to find out where a problem is if an error is generated. They also help to determine the speed it takes for data to move from one location to another.
ICMP operates as a connectionless protocol. The ICMP message format includes a type and code field, which define the general category of the message and subtype, respectively. For example, a Type of “Destination Unreachable” is used to identify an error that caused the router to discard the original data packet.
In addition to error reporting, ICMP can also be triggered by the network gateway when it detects that it cannot manage the original data packet. For example, if the router receives a data packet with a Time to Live field that is too low, it will discard the packet and send an ICMP message back to its source.
ICMP is also commonly used in network diagnostics, such as ping and traceroute terminal utilities. However, ICMP is often misused to hurt performance on the network using attacks like an ICMP flood or Smurf attack.
Harsh Srivastava is a recent graduate from the field of Computer Science & Technology. He takes a keen interest in exploring technology to its very depth and also likes to write about it. Harsh currently works as a freelancer and also has his own YouTube Channel.