---
title: "Short note: ICMP"
subject: "Computer Networks and Security"
chapter: 4
key: "semester_7/computer_networks_and_security:icmp-note"
source: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/icmp-note
site: BCT Engineering
---

# Short note: ICMP

Computer Networks and Security · Chapter 4: Network Layer

- Asked in: 2071 Shrawan, 4 marks
- Video: [Internet Control Message Protocol ICMP || Lesson 91 || Computer Networks || Learning Monkey ||](https://www.youtube.com/watch?v=ReCCa9srTC0) — Wisdomers - Computer Science and Engineering 
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/icmp-note
- Whole chapter: https://www.bctengineer.com/md/semester_7/computer_networks_and_security/chapter-4

## Question

Write a short note on ICMP.

## Short answer

ICMP is IP's error-reporting and diagnostic companion, carried inside IP datagrams. It reports unreachable destinations, time exceeded, and redirects, and supports ping via echo request/reply and traceroute via time exceeded messages.

## Answer

**ICMP (Internet Control Message Protocol, RFC 792)** is a network-layer companion of IP. IP is unreliable and has no error reporting, so ICMP reports errors and gives diagnostic information. ICMP messages are carried inside IP datagrams (protocol number 1).

#### Message format
Type (8 bits) | Code (8 bits) | Checksum (16 bits) | message-specific data (for errors: IP header + first 8 bytes of the offending datagram).

#### Types of messages
| Category | Message | Type |
|---|---|---|
| Error reporting | Destination unreachable | 3 |
| | Time exceeded (TTL = 0) | 11 |
| | Parameter problem | 12 |
| | Redirect | 5 |
| | Source quench (obsolete) | 4 |
| Query | Echo request / reply | 8 / 0 |
| | Timestamp request / reply | 13 / 14 |
| | Router solicitation / advertisement | 10 / 9 |

#### Uses
- **ping** uses echo request/reply to test reachability and round-trip time.
- **traceroute** sends packets with increasing TTL; each router returns "time exceeded", revealing the path.
- Path MTU discovery uses "destination unreachable, fragmentation needed".

ICMP never reports errors about ICMP error messages, to avoid endless loops.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Why is ICMP needed alongside IP?
   A. IP is unreliable and has no error reporting, so ICMP reports errors and diagnostics
   B. ICMP provides reliable delivery for IP
   C. IP cannot carry data
   D. ICMP assigns IP addresses
   Answer: A. ICMP gives IP error reporting and diagnostics; it does not make IP reliable. (Key point: Why ICMP exists)

2. How does traceroute discover the path to a destination?
   A. It sends packets with increasing TTL and reads the time exceeded replies
   B. It sends echo replies to all routers
   C. It reads each router's routing table
   D. It uses ARP requests
   Answer: A. Each router where TTL reaches 0 returns ICMP time exceeded, revealing the hop. (Key point: Traceroute)

3. Which ICMP messages does ping use?
   A. Timestamp request and reply
   B. Echo request and echo reply
   C. Time exceeded and parameter problem
   D. Destination unreachable and redirect
   Answer: B. Ping sends echo request (type 8) and receives echo reply (type 0). (Key point: Ping)

4. What rule prevents endless loops of ICMP errors?
   A. ICMP is sent only once per hour
   B. ICMP never reports errors about ICMP error messages
   C. ICMP is only allowed over TCP
   D. ICMP errors have TTL 1
   Answer: B. No error message is generated for an ICMP error message, avoiding infinite loops. (Key point: Loop avoidance)
