Previous | Table of Contents | Next |
If internetworks were flawless, datagrams would always be routed to their intended destination with no errors, excessive delays, or retransmissions. Unfortunately, this is not the case. As discussed previously, IP provides a connectionless service to the attached hosts but requires an additional module, known as the Internet Control Message Protocol (ICMP), to report any errors that may occur in the processing of those datagrams. Examples of errors would be undeliverable datagrams or incorrect routes. The protocol is also used to test the path to a distant host (known as a PING) or to request an address mask for a particular subnet. ICMP is an integral part of IP and must be implemented in IP modules contained in hosts and routers. The standard for ICMP is RFC 792 [6-5].
IP datagrams contain ICMP messages. In other words, ICMP is a user (client) of IP, and the IP header precedes the ICMP message. The datagram would thus be IP header, ICMP header, and finally ICMP data. Protocol = 1 identifies ICMP within the IP header. A Type field within the ICMP header further identifies the purpose and format of the ICMP message. Any data required to complete the ICMP message follows the ICMP header.
Thirteen ICMP message formats have been defined, each with a specific ICMP header format. Two of these formats (Information Request/Reply) are considered obsolete, and several others share a common message structure. The result is six unique message formats, as shown in Figure 6-5.
Figure 6-5. ICMP message formats
Network managers need to understand each of these ICMP messages because they contain valuable information about network status. All the headers share the first three fields. The Type field (1 octet) identifies one of the thirteen unique ICMP messages. These include:
Type Code | ICMP Message |
---|---|
0 | Echo Reply |
3 | Destination Unreachable |
4 | Source Quench |
5 | Redirect |
8 | Echo |
11 | Time Exceeded |
12 | Parameter Problem |
13 | Timestamp |
14 | Timestamp Reply |
15 | Information Request (obsolete) |
16 | Information Reply (obsolete) |
17 | Address Mask Request |
18 | Address Mask Reply |
The second field is labeled Code (1 octet) and elaborates on specific message types. For example, the Code field for the Destination Unreachable message indicates whether the network, host, protocol, or port was the unreachable entity. The third field is a Checksum (2 octets) on the ICMP message. The ICMP message formats diverge after the third field.
The Echo message (ICMP Type = 8) tests the communication path from a sender to a receiver via the Internet. On many hosts, this function is known as PING. The sender transmits an Echo message, which may contain an Identifier (2 octets) and a Sequence Number (2 octets) as well as data. When the intended destination receives the message, it reverses the source and destination addresses, recomputes the checksum, and returns an Echo Reply (ICMP Type = 0). The contents of the Data field (if any) would also return to the sender.
The Destination Unreachable message (ICMP Type = 3) is used when the router or host is unable to deliver the datagram. This message is returned to the source host of the datagram in question, and its Code field includes the specific reason for the delivery problem:
Code | Meaning |
---|---|
0 | Net Unreachable |
1 | Host Unreachable |
2 | Protocol Unreachable |
3 | Port Unreachable |
4 | Fragmentation Needed and DF Set |
5 | Source Route Failed |
Routers use codes 0, 1, 4, or 6. Hosts use codes 2 or 3. For example, when a datagram arrives at a router, it does a table lookup to determine the outgoing path to use. If the router determines that the destination network is unreachable (that is, a distance of infinite hops away), it returns a Net Unreachable message. Similarly, if a host is unable to process a datagram because the requested protocol or port is inactive, it would return a Protocol Unreachable or Port Unreachable message, respectively. Included in the Destination Unreachable message is the IP header plus the first 64 bits (8 octets) of the datagram in question. This returned data helps the host diagnose the failure in the transmission process.
The advantage of the datagrams connectionless nature is its simplicity. The disadvantage is its inability to regulate the amount of traffic into the network. As an analogy, consider the problem that your local post office faces. To handle the maximum possible number of letters, it needs enough boxes to handle the holiday rush. Building many boxes might be wasteful, however, because many of the boxes may not be used fully during the summer. If a router or host becomes congested with datagrams, it may send a Source Quench message (ICMP Type = 4) asking the source of those datagrams to reduce its output. This mechanism is similar to traffic signals that regulate the flow of cars onto a freeway. The Source Quench message does not use the second 32-bit word of the ICMP header, but fills it with zeros. The rest of the message contains the IP header and the first 8 octets of the datagram that triggered the request.
Hosts do not always choose the correct destination address for a particular datagram, and occasionally send one to the wrong router. This scenario can occur when the host is initialized and its routing tables are incomplete. When such a routing mistake occurs, the router receiving the datagram returns a Redirect message to the host specifying a better route. The Code field in the datagram would contain the following information:
Code | Message |
---|---|
0 | Redirect datagrams for the network |
1 | Redirect datagrams for the host |
2 | Redirect datagrams for the type of service and network |
3 | Redirect datagrams for the type of service and host |
Previous | Table of Contents | Next |