PERSONAL INTERFACE / TORONTO, ON
← MAIN MENUARCHIVE / BLOG
JOURNAL / EXPLORER
← ALL JOURNAL ENTRIES

42 published notes

Section 6 ICMP The Internet Control Message ProtocolREADING VIEW

JOURNAL / Coursework/COMP 437 Computer Networks/Unit 5 / NOTE

Section 6 ICMP The Internet Control Message Protocol

Computer Networks study notes · Unit 5

Author
Michel Deosaran
Published
Tags
#computer-networks

Text to Speech Q&A Document: ICMP (Internet Control Message Protocol) for Exam Prep

Section 6 – ICMP: The Internet Control Message Protocol

This document is designed for audio review. Each question is followed by a comprehensive answer suitable for listening and retention. Study these Q&A pairs to master the core concepts, network applications, and historical mechanisms associated with ICMP.


Learning Objective 1: Explain what ICMP is and what it does.

Question 1: What is the Internet Control Message Protocol (ICMP), and at what layer of the TCP/IP suite does it operate?

Answer: The Internet Control Message Protocol (ICMP) is a required, core protocol of the TCP/IP suite. It operates at the network layer (Layer 3), the same layer as IP itself. ICMP is not used to carry application data like web pages or emails; instead, it is a specialized protocol for carrying control and error messages between hosts and routers. ICMP messages are themselves encapsulated within IP datagrams, meaning they are carried as the payload of IP packets. The Protocol field in the IP header is set to the value 1 to indicate that the payload is an ICMP message. Every IP station—whether a host or a router—must support ICMP, though implementations may vary. Its fundamental purpose is to enhance network reliability and performance by providing a feedback mechanism for the Internet Protocol.

Question 2: What are the two basic classes of ICMP messages, and what is the primary function of each?

Answer: ICMP messages are generally divided into two broad functional classes: Error Messages and Informational or Query Messages.

Error Messages are generated automatically by a router or a destination host when a problem is encountered during the delivery of an IP datagram. These messages report conditions such as an unreachable destination (network, host, protocol, or port), a Time-to-Live (TTL) value expiring, or a router redirecting traffic to a better path. A critical rule governing ICMP error messages is that they must not be generated in response to another ICMP error message. This rule prevents an “ICMP avalanche” where a storm of error messages could flood the network. Additionally, ICMP error messages always include the IP header and the first 64 bits (8 bytes) of the original datagram’s data so the source host can match the error to the specific communication session.

Informational or Query Messages are typically initiated by a host to obtain diagnostic or configuration information from another host or router. These include the Echo Request and Echo Reply pair, the Timestamp Request and Reply, and the Address Mask Request and Reply. These messages are fundamental to network troubleshooting tools like ping.

Question 3: According to RFC 792, what is the general format of an ICMP message?

Answer: While the specific fields vary depending on the message type, every ICMP message begins with a common 4-byte header followed by a variable-length data section.

The common header consists of:

  1. Type (1 byte): Identifies the general category of the ICMP message (e.g., 8 for Echo Request, 0 for Echo Reply, 3 for Destination Unreachable).
  2. Code (1 byte): Provides further granularity within the message type (e.g., if Type is 3 for Destination Unreachable, the Code might be 0 for Network Unreachable or 1 for Host Unreachable).
  3. Checksum (2 bytes): A checksum covering the entire ICMP message, used to detect errors in the message itself.

Following this header, the content depends on the Type and Code. For error messages, this section typically includes the IP header and the first 8 bytes of the original datagram that triggered the error. For Echo Request and Echo Reply messages, this section contains an Identifier and a Sequence Number (used to match requests to replies) followed by optional data.

Question 4: What are some common ICMP Type values and what does each indicate?

Answer: The Type field is the most important part of the ICMP header for identifying the message’s purpose. You should be familiar with several key values:

  • Type 0 – Echo Reply: Sent in response to an Echo Request; used by ping to confirm reachability.
  • Type 3 – Destination Unreachable: Indicates that a datagram could not be delivered. The Code field provides the specific reason (e.g., Code 0: Network Unreachable; Code 1: Host Unreachable; Code 3: Port Unreachable).
  • Type 4 – Source Quench: Historically used to tell a sender to reduce its transmission rate due to congestion. This message is now obsolete.
  • Type 5 – Redirect: Sent by a router to inform a host of a better first-hop router for a specific destination.
  • Type 8 – Echo Request: Sent by ping to test connectivity to a destination.
  • Type 11 – Time Exceeded: Indicates that the TTL of a datagram reached zero (Code 0) or that the fragment reassembly timer expired (Code 1). This is used by traceroute.
  • Type 12 – Parameter Problem: Indicates that a problem was found with an IP header field (e.g., a bad option).
  • Type 13/14 – Timestamp Request/Reply: Used to measure round-trip time and synchronize clocks.

Learning Objective 2: Explain where and how ICMP is used in some network applications.

Question 5: How is ICMP used by the ping program?

Answer: The ping program is one of the most fundamental network diagnostic utilities, and it is built entirely on ICMP. Its operation relies on the ICMP Echo Request (Type 8, Code 0) and ICMP Echo Reply (Type 0, Code 0) message pair.

When you run ping against a target IP address or hostname, your machine sends a series of ICMP Echo Request messages to that destination. If the destination host is operational and the network path is functional, it will receive each Echo Request and immediately send back an ICMP Echo Reply. The payload of the Echo Request typically contains a timestamp. When the Echo Reply returns, the ping program notes the current time and subtracts the embedded timestamp to calculate the Round-Trip Time (RTT). By sending multiple requests, ping can also calculate the percentage of packet loss and provide a summary of the minimum, average, and maximum RTT. This information tells you whether a host is reachable and gives an indication of network latency and reliability.

Question 6: How does the traceroute program leverage ICMP?

Answer: traceroute (or tracert on Windows) uses ICMP in a clever way to discover the path that packets take to a destination. It works by sending a series of packets (often UDP datagrams, but ICMP Echo Requests can also be used) with incrementally increasing Time-to-Live (TTL) values.

The first packet is sent with a TTL of 1. The first router on the path decrements the TTL to 0, discards the packet, and sends back an ICMP Time Exceeded (Type 11, Code 0) error message to the sender. This reveals the IP address of the first hop. The next packet is sent with a TTL of 2, which causes the second router to return a Time Exceeded message, revealing the second hop. This process continues until the packet finally reaches the destination host, which will either return an ICMP Echo Reply (if ICMP Echo Requests are used) or an ICMP Port Unreachable message (if UDP packets are used, assuming a high port number that is not in use). In this way, traceroute maps out every intermediate router along the network path.

Question 7: How does the path MTU discovery mechanism use ICMP?

Answer: Path MTU Discovery is a technique used to determine the maximum transmission unit (MTU)—the largest packet size—that can be sent across a network path without fragmentation. It relies on the ICMP Destination Unreachable (Type 3, Code 4) message, which specifically means “Fragmentation Needed and Don’t Fragment (DF) Bit Set.”

A host begins by sending packets with the DF (Don’t Fragment) bit set in the IP header. If a router along the path encounters a packet that is larger than the MTU of the next link, and the DF bit is set, the router cannot fragment the packet. Instead, it discards the packet and sends back an ICMP Type 3, Code 4 message to the source host. Crucially, this ICMP message includes the MTU of the link that caused the problem. The source host then reduces its packet size to match this smaller MTU and retransmits. This process allows the sender to dynamically discover the smallest MTU along the entire path and avoid the overhead of fragmentation.

Question 8: What is the ICMP Source Quench message, and how was it intended to be used by a router for congestion control?

Answer: The Source Quench (Type 4) message was an early ICMP mechanism designed for congestion control. The intention was that if a router’s buffer became full and it had to discard IP datagrams due to congestion, it would send a Source Quench message back to the original sender of the dropped datagrams. When a TCP sender received a Source Quench message, it was supposed to reduce its transmission rate—specifically, by decreasing its send window for that destination—in order to alleviate the congestion at the router.

However, Source Quench proved to be ineffective and problematic in practice. There were several fundamental issues:

  1. Robustness: Source Quench messages could themselves be lost due to the same congestion on the return path, meaning the sender might never receive the signal to slow down.
  2. Information Content: A Source Quench message carries very little information—it only indicates that some congestion was sensed, not how severe it is or how much to reduce the rate by.
  3. Router Overhead: Generating ICMP messages is computationally expensive for a router, and during congestion, a router may not have the spare CPU resources to generate Source Quench messages for every dropped packet, potentially exacerbating the problem.
  4. Security: The messages could be spoofed by malicious actors to artificially slow down connections, leading to denial-of-service conditions.

Due to these flaws, the use of Source Quench was deprecated. RFC 1812, “Requirements for IP Version 4 Routers,” explicitly states that routers should not originate this message. Modern TCP congestion control algorithms (like those in TCP Reno, Cubic, etc.) rely on packet loss and delay signals rather than ICMP Source Quench. On today’s Internet, Source Quench messages are almost never generated and are generally ignored if received.

Question 9: How does the Internet Group Management Protocol (IGMP) relate to ICMP?

Answer: The Internet Group Management Protocol (IGMP) is a separate protocol used for managing IP multicast group memberships on a local network segment. Its relationship to ICMP is primarily architectural and historical.

IGMP messages, like ICMP messages, are encapsulated within IP datagrams. However, IGMP has its own distinct message format and protocol number (Protocol 2). It defines its own message types, such as Membership Query, Membership Report, and Leave Group messages. These are used by hosts to inform local routers of their desire to join or leave multicast groups, and by routers to query which groups have active members on a subnet.

The key distinction is that IGMP is not ICMP. They serve different purposes (multicast group management vs. error and control messaging) and have separate specifications. However, in IPv6, the equivalent functionality is provided by Multicast Listener Discovery (MLD), which is implemented using ICMPv6 messages. This is a notable difference between the IPv4 and IPv6 protocol suites. In IPv4, IGMP is a standalone protocol, whereas in IPv6, multicast management is integrated into the ICMPv6 framework.


Key Terms and Topics

Question 10: What is the ICMP Type 8 Code 0 message, and what is its significance?

Answer: The ICMP Type 8 Code 0 message is the Echo Request. The Type value 8 identifies it as an Echo Request, and the Code value 0 is the only defined code for this message type. This message is significant because it is the fundamental building block of the ping utility. When a host sends an Echo Request to a target, it is asking that target to send back an Echo Reply (Type 0, Code 0). The data received in the Echo Request must be returned in the Echo Reply. The message includes an Identifier and a Sequence Number, which allow the sender to match replies with requests. The Identifier can be thought of as similar to a port number, identifying a specific ping session, while the Sequence Number is incremented for each successive request. This simple request-response mechanism provides a direct, low-overhead way to test reachability and measure round-trip time at the network layer.

Question 11: What are the main IGMP message types?

Answer: IGMP defines several message types, with the specific set depending on the version (IGMPv1, v2, and v3). The core message types are:

  • Membership Query: Sent by a multicast router to discover which multicast groups have active members on a directly attached subnet. There are subtypes: a General Query asks about all groups, a Group-Specific Query asks about a particular group, and a Group-and-Source-Specific Query (in IGMPv3) asks about interest in specific sources for a group.
  • Membership Report: Sent by a host to a router to indicate that it wants to join a multicast group (or is already a member and responding to a query).
  • Leave Group: Introduced in IGMPv2, this message allows a host to explicitly notify a router that it is leaving a multicast group. The router then sends a Group-Specific Query to see if any other hosts on the subnet are still interested in the group before stopping the multicast stream.

Question 12: What are the key problems with Source Quench that led to its deprecation?

Answer: The Source Quench message was deprecated due to four primary problems. First, Source Quench messages could be lost on the return path if that path was also congested, meaning the sender would never receive the signal to reduce its rate. A congestion control mechanism must be robust against such losses. Second, the message carried very little information—it only indicated that congestion occurred, not the severity of the congestion or by how much the sender should reduce its transmission rate. Third, generating Source Quench messages was computationally expensive for routers. During periods of congestion, a router’s CPU resources are often already strained; generating an ICMP message for every dropped packet could make the congestion worse. Fourth, the messages could be abused for denial-of-service attacks, as a third party could forge Source Quench messages to slow down legitimate connections. For these reasons, RFC 1812 specifies that routers should not originate Source Quench messages, and modern TCP implementations ignore them.

INTERFACE CONFIGURATION

Settings

Make yourself comfortable.

Sound is off by default. Motion follows your device preference until you change it.

TORONTO NIGHT PHOTOGRAPHYMike Swigunski ↗alex° ↗Unsplash license ↗