ICMP – Internet Control Message Protocol
ICMP – Internet Control Message Protocol , specified in [RFC 792], is used by hosts and routers to communicate network-layer information to each other.
The most typical use of ICMP is for error reporting. For example, when running a Telnet, FTP, or HTTP session, you may have encountered an error message such as “Destination network unreachable”. This message had its origins in ICMP . At some point, an IP router was unable to find a path to the host specified in your Telnet, FTP, or HTTP application. That router created and sent a type-3 ICMP message to your host indicating the error.
ICMP is often considered part of IP but architecturally it lies just above IP, as ICMP messages are carried inside IP datagram. That is, ICMP messages are carried as IP payload, just as TCP and UDP segments are carried as IP payload. Similarly, when a host receives an IP datagram with ICMP specified as the upper-layer protocol , it demultiplexes thae datagram’s contents to ICMP, just as it would demultiplex a datagram’s content to TCP or UDP.
ICMP messages have a type and a code field, and contain the header and the first 8 bytes of the IP datagram that caused the ICMP message to be generated in the first place (so that the sender can determine the datagram that caused the error). Selected ICMP message types are shown in the figure below.
Note that ICMP messages are used not only for signalling error conditions.
The well-known ping program sends an ICMP type 8 code 0 message to the specified host. The destination host, seeing the echo request, sends back a type 0 code ICMP echo reply. Most TCP/IP implementations support ping server directly in the operating system; that is, the server is not a process. Note that the client program needs to be able to instruct the operating system to generate an ICMP message of type 8 code 0.
Another interesting ICMP message is the source quench message. This message is seldom used in practice. Its original purpose was to perform congestion control – to allow a congested router to send an ICMP source quench message to a host to force that host to reduce its transmission rate.