Computer Networks · ICMP
ICMP Error Handling vs Request and Reply
Overview
ICMP (Internet Control Message Protocol) is used in two distinct ways: error handling, where an ICMP packet is generated only when something goes wrong, and request and reply, where the sender itself initiates an ICMP message and receives a reply.
The two cases differ in who starts the ICMP message, what triggers it, and which direction the ICMP traffic flows.
Key concepts
- ICMP (Internet Control Message Protocol) has exactly two usage categories: error handling and request–reply.
- Error handling (error / feedback messaging): an ICMP packet is generated only when something goes wrong — specifically when a packet is discarded at a router or at the receiver.
- Request and reply: the sender initiates an ICMP message itself and receives a reply, so ICMP messages flow in both directions.
How it works
Case 1 — Error handling (one-way ICMP flow)
- Consider the path: Source → Router → Router → Receiver.
- If the packet is discarded — either at a router along the path or at the receiver — an ICMP error message is sent back to the source.
- The ICMP message therefore travels in one direction only (back toward the source). ICMP is generated only in the failure case; if nothing is wrong, no ICMP error packet appears.
Case 2 — Request and reply (two-way ICMP flow)
- Same topology: Source → Router → Router → Receiver.
- The source sends a request packet (an ICMP request).
- A reply comes back to the source.
- Here ICMP flows in both directions — the request goes forward and the reply comes back.
Comparison
| Feature | Error Handling | Request and Reply |
|---|---|---|
| When ICMP is generated | Only when something is wrong (packet discarded at router or receiver) | Sender initiates the ICMP message itself |
| Who starts it | Router / receiver (on detecting a problem) | Source (sender) |
| Direction of ICMP flow | One way (back to source) | Both directions (request forward, reply back) |
| Trigger | Failure / discard of an IP packet | Normal operation, initiated by sender |
Revision summary
- ICMP has exactly two usage categories: error handling and request–reply.
- Error handling is feedback messaging: the ICMP packet is produced only when something is wrong.
- Error ICMP is generated when a packet is discarded at a router or at the receiver, and it goes one way back to the source.
- In request and reply, the sender initiates the ICMP request and gets a reply, so ICMP flows in both directions.
- Keep the topology Source → Router → Router → Receiver in mind, and trace which direction ICMP travels in each case.
Previous-year exam insights
- ICMP is a network-layer (Layer 3) protocol; its messages are encapsulated directly in IP datagrams (protocol number 1), not in TCP or UDP.
Asked inUGC NET 2012 - Ping uses ICMP Echo Request (type 8) and Echo Reply (type 0) messages; it is an application-level utility that tests reachability and round-trip time, and a host running a TCP/IP stack replies to an echo request.
Asked inISRO 2015 - ICMP error messages are never sent in response to another ICMP error message, and never for broadcast/multicast destinations or for non-first fragments.
- Common ICMP error types: Destination Unreachable (type 3), Time Exceeded / TTL expired (type 11), Source Quench (type 4, deprecated), Redirect (type 5), Parameter Problem (type 12); query types include Echo Request/Reply and Timestamp.
- Ping of death is caused by sending an oversized/illegal ICMP echo packet (fragmented so the reassembled size exceeds the maximum IP packet size), leading to buffer overflow in the victim's IP stack.
Asked inISRO 2023 - Traceroute exploits ICMP Time Exceeded messages by sending packets with increasing TTL values; each router that decrements TTL to zero returns an ICMP Time Exceeded error to the source.