====== ICMP (Internet Control Message Protocol) ======
The **Internet Control Message Protocol (ICMP)** is a network protocol used to report errors and exchange diagnostic information between network devices.
Unlike TCP and UDP, ICMP is **not used to transport application data**. Instead, it helps devices determine whether communication is working correctly.
-----
===== What Is ICMP Used For? =====
ICMP is commonly used for:
* Network diagnostics
* Error reporting
* Reachability testing
* Path discovery
Many familiar networking tools depend on ICMP.
-----
===== Common ICMP Messages =====
Some of the most frequently used ICMP message types include:
^ ICMP Message ^ Purpose ^
| Echo Request | Sent by Ping |
| Echo Reply | Returned by Ping |
| Destination Unreachable | Destination cannot be reached |
| Time Exceeded | TTL expired (used by Traceroute) |
| Redirect | Suggests a better route |
| Parameter Problem | Invalid IP header |
-----
===== Ping =====
The **ping** command uses ICMP.
When you execute:
ping 8.8.8.8
the computer sends an **ICMP Echo Request**.
If the destination is reachable, it returns an **ICMP Echo Reply**.
Example:
Computer
│
Echo Request
▼
Server
▲
Echo Reply
│
Computer
Ping measures:
* Reachability
* Round-trip time (RTT)
* Packet loss
-----
===== Traceroute =====
Traceroute also relies on ICMP.
It discovers the path to a destination by sending packets with increasing **Time To Live (TTL)** values.
Example:
TTL = 1
↓
Router 1
↓
ICMP Time Exceeded
TTL = 2
↓
Router 2
↓
ICMP Time Exceeded
TTL = 3
↓
Router 3
↓
ICMP Time Exceeded
Eventually the packet reaches the destination.
This allows Traceroute to identify every router along the path.
-----
===== Destination Unreachable =====
When a router or host cannot deliver a packet, it may return:
ICMP Destination Unreachable
Possible reasons include:
* Network unavailable
* Host unavailable
* Port unreachable
* Administrative filtering
-----
===== ICMP Is Not TCP or UDP =====
ICMP is carried directly inside IP packets.
Unlike TCP and UDP, ICMP:
* Has no port numbers.
* Does not establish connections.
* Does not carry application data.
-----
===== Is ICMP Secure? =====
Many firewalls restrict or block ICMP traffic.
Reasons include:
* Preventing network discovery
* Reducing abuse
* Limiting denial-of-service attacks
As a result:
Ping fails
does **not always** mean:
The host is offline.
The host may simply ignore ICMP Echo Requests.
-----
===== ICMP and Telenegar =====
Several Telenegar services use or interpret ICMP.
**Ping Check**
Uses ICMP Echo Request and Echo Reply to determine:
* Reachability
* Latency
* Packet loss
-----
**Traceroute**
Uses ICMP Time Exceeded messages returned by routers to discover the network path.
Example:
1 Home Router
2 ISP Gateway
3 Regional Router
4 ...
Destination
-----
===== Common Misconceptions =====
* **ICMP is used to transfer files.**
* False. ICMP is used only for control and diagnostic messages.
* **If Ping fails, the server is down.**
* False. Many servers intentionally block ICMP.
* **Traceroute uses only ICMP.**
* Not always. Depending on the operating system, Traceroute may use ICMP, UDP, or TCP probes.
-----
===== Related Topics =====
* [[networking:protocols:tcp-udp|TCP vs UDP]]
* [[networking:internet:ipv4|IPv4]]
* [[networking:internet:default-gateway|Default Gateway]]
* [[tools:pingcheck|Ping Check]]
* [[tools:traceroute|Traceroute]]
-----
{{tag>icmp ping traceroute networking protocols}}