ICMP is the Internet Control Message Protocol.

ICMP is a complementary protocol to IP (Internet Protocol). Like IP, ICMP resides on the Network Layer of the OSI Model.

ICMP is designed for sending control and test messages across IP networks.

Unlike the Transport Layer protocols TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) which operate on top of IP, ICMP exists alongside IP.

The ability to understand ICMP is a requirement for any IP-compatible network device. However, many security devices such as firewalls block or disable all or part of ICMP functionality for security purposes.

ICMP Message Types

ICMP operates by sending and receiving a limited number of messages types. The ICMP message types are defined in IANA ICMP Type Numbers.

The most common ICMP message types are:

Type Name
0 Echo Reply
3 Destination Unreachable
4 Source Quench
5 Redirect
6 Alternate Host Address
8 Echo
9 Router Advertisement
10 Router Solicitation
11 Time Exceeded
12 Parameter Problem
13 Timestamp
14 Timestamp Reply
15 Information Request
16 Information Reply
17 Address Mask Request
18 Address Mask Reply
30 Traceroute

ICMP Echo Request and Echo Reply

The two most important ICMP messages are Echo Request (8) and Echo Reply (0).

Echo Request and Echo Reply are utilized by the `ping` command to test network connectivity.

Here we use the `ping` command to send three 64-byte ICMP Echo Request messages to www.freebsd.org and receive three Echo Reply messages in response:

bash-2.05a$ ping -c 3 www.freebsd.org
PING www.freebsd.org (216.136.204.117): 56 data bytes
64 bytes from 216.136.204.117: icmp_seq=0 ttl=55 time=63.708 ms
64 bytes from 216.136.204.117: icmp_seq=1 ttl=55 time=62.725 ms
64 bytes from 216.136.204.117: icmp_seq=2 ttl=55 time=62.618 ms

— www.freebsd.org ping statistics —
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max/stddev = 62.618/63.017/63.708/0.491 ms

This output tells us that network connectivity to www.freebsd.org is working. It also tells us the time each packet took to return.

`ping` is an extremely useful tool for network troubleshooting.

Additional Reading on ICMP

ICMP is defined in RFC 792: Internet Control Message Protocol.