Computer Networks Essentials / Network Protocols in Detail

ICMP (Internet Control Message Protocol)

๐Ÿค” What is ICMP? (Basic Idea)

When data is sent across a network:

  • It may get lost โŒ

  • Destination may be unreachable ๐Ÿšซ

  • Time limit may exceed โฑ๏ธ

๐Ÿ“Œ How does the network report these problems?

๐Ÿ‘‰ Answer: ICMP


๐Ÿง  Simple Definition

๐Ÿ“Œ ICMP (Internet Control Message Protocol) is a network-layer protocol used to report errors and provide diagnostic information about IP packet delivery.


๐Ÿง  Important Point

โ— ICMP:

  • Does NOT send application data

  • Does NOT fix errors

  • Only reports errors and status

๐Ÿ‘‰ Think of ICMP as a messenger, not a repairman.


๐Ÿง  Real-Life Analogy

๐Ÿ“ฎ Courier Failure Message

  • You send a parcel ๐Ÿ“ฆ

  • Courier canโ€™t deliver it

  • Courier sends you a message: โ€œAddress not foundโ€

๐Ÿ‘‰ ICMP works exactly like that.


๐Ÿงญ Where Does ICMP Work?

  • ICMP works at the Network Layer

  • Closely associated with IP

  • Encapsulated inside IP packets

๐Ÿ“Œ ICMP is considered a support protocol for IP.


๐ŸŽฏ Why ICMP is Needed?

ICMP helps in:

  • ๐Ÿšจ Error reporting

  • ๐Ÿ” Network diagnostics

  • ๐Ÿงช Testing connectivity

  • ๐Ÿ› ๏ธ Troubleshooting problems

๐Ÿ“Œ Without ICMP, debugging networks would be very difficult.


๐Ÿ”„ How ICMP Works (Basic Flow)

1๏ธโƒฃ Host sends IP packet

2๏ธโƒฃ Router detects a problem

3๏ธโƒฃ Router generates ICMP message

4๏ธโƒฃ ICMP message sent back to sender

๐Ÿ“Œ Sender learns what went wrong.


๐Ÿ“ฆ ICMP Message Format (Basic Idea)

An ICMP message contains:

  • Type โ†’ What kind of message

  • Code โ†’ More details

  • Checksum โ†’ Error checking

  • Data โ†’ Part of original packet


๐Ÿง  Types of ICMP Messages

ICMP messages are broadly classified into:

1๏ธโƒฃ Error Reporting Messages

2๏ธโƒฃ Query (Informational) Messages


๐Ÿšจ 1. ICMP Error Reporting Messages

These messages report problems in packet delivery.

๐Ÿ“Œ Sent when:

  • Destination network is down

  • Host unreachable

  • Port unreachable

๐Ÿง  Example:

โ€œNetwork unreachableโ€

๐Ÿ“Œ Sent when:

  • Packetโ€™s TTL (Time To Live) becomes zero

๐Ÿง  Used by:

  • Traceroute

๐Ÿ“Œ Sent when:

  • Invalid IP header detected

๐Ÿ“Œ Sent when:

  • Router is congested

โš ๏ธ Rarely used today.


๐Ÿ” 2. ICMP Query / Informational Messages

These messages are used for testing and diagnostics.

๐Ÿ“Œ Used by:

  • Ping command

๐Ÿง  Purpose:

  • Check if destination is reachable

  • Measure round-trip time

๐Ÿ“Œ Used for:

  • Discovering routers

  • Network configuration


๐Ÿง  ICMP and Ping Command

๐Ÿงช What is Ping?

  • Ping uses ICMP Echo Request

  • Destination replies with Echo Reply

๐Ÿ“Œ If reply received โ†’ host is reachable โœ”๏ธ

๐Ÿ“Œ If not โ†’ network issue โŒ


๐Ÿง  ICMP and Traceroute

Traceroute uses:

  • ICMP Time Exceeded messages

  • To find path taken by packets


โš ๏ธ ICMP Error Rules

โ— ICMP error messages are NOT sent for:

  • ICMP error packets

  • Broadcast packets

  • Multicast packets

๐Ÿ“Œ Prevents error-message storms.


๐Ÿ” Security Issues with ICMP

ICMP can be misused for:

  • Network scanning

  • ICMP flooding (DoS)

  • Ping of death

๐Ÿ“Œ Many firewalls restrict ICMP traffic.


๐Ÿ›ก๏ธ ICMP vs TCP/UDP

Feature

ICMP

TCP

UDP

Purpose

Error reporting

Reliable data

Fast data

Data transfer

โŒ No

โœ… Yes

โœ… Yes

Layer

Network

Transport

Transport


๐Ÿง  Advantages of ICMP

  • Easy troubleshooting

  • Network diagnostics

  • Essential for IP functioning

โŒ Limitations of ICMP

  • Cannot correct errors

  • Can be blocked by firewalls

  • Can be abused for attacks


๐Ÿง  Memory Tricks

  • ICMP = Internet Cry Message ๐Ÿšจ

  • Ping = Echo

  • TTL = Time Exceeded

  • ICMP = Helper of IP


โญ One-Line Summary

๐Ÿ”น ICMP is a network-layer protocol that reports errors and provides diagnostic information for IP communication.