End hosts and gateways (routers) use the Internet Control Message Protocol (ICMP), defined by RFC 792, as a control, messaging, and diagnostic protocol. ICMP exists at the Network layer of the OSI and Internet layer of the DoD models. (See Figure 3.1 to view where ICMP falls within the DoD and OSI models.) Although ICMP resides at the same layer as IP, ICMP is considered an integral part of the IP protocol. As such, it utilizes the services of IP for its delivery of messages. Figure 3.8 shows an ICMP echo message encapsulated within an IP datagram.
There are many types of ICMP messages; the ICMP echo request probably is the most common. You can use the echo request as a diagnostic tool to check connectivity between end hosts. We discuss all ICMP types in more detail later in the chapter. Note the ICMP protocol type in the IP equals one (ICMP).
Echo Request and Reply
The term echo request and reply describes messages you can use to test network connectivity. You can do this by using the Ping utility. The Ping program uses these ICMP echo request and reply messages. An echo request is like you shouting to a network, "Hello, are you there?" What bounces back, be it negative or positive (connectivity or no connectivity), is the echo reply. Just as with an echo, you always receive a reply.
Figure 3.8 The ICMP echo message is used to verify network layer communications between hosts.
Destination hosts and gateways on occasion need to inform a source host of delivery problems, test connectivity to that host, ask for transmission to slow down, and so on. ICMP has a total of 15 different messages identified by the value contained within its type field used to inform a source host. These messages allow a source host to learn and recover from some (not all) of the problems that can occur on an internetwork. Although these messages inform a host of problems, ICMP does not guarantee a solution to these problems. Like IP, ICMP is a connectionless protocol. Hosts or gateways can send unsolicited ICMP control or diagnostic messages. ICMP uses many types of messages for different purposes.
You might have used the familiar Ping utility (ICMP message types 0 and 8). Ping allows a user to send a sonar-like ping from one host to another to verify connectivity. The Ping utility utilizes the services of ICMP messages to perform this task. When a user executes the Ping command specifying a remote host's name or address, the host receives a series of ICMP messages, known as echo requests. The receiving host in turn responds to each of these messages using the ICMP Echo Reply message type 0. We discuss Ping and the other various message types and their purposes later in this chapter.