This document synthesizes the core networking concepts of Maximum Transmission Unit (MTU) and Maximum Segment Size (MSS), their intrinsic relationship, and the critical mechanism of Path MTU Discovery (PMTUD). The central thesis is that MSS, a Layer 4 (Transport) parameter, is directly derived from MTU, a Layer 2 (Data Link) parameter, to optimize data transmission and prevent IP fragmentation.
The standard MTU for Ethernet is 1500 bytes, which dictates the maximum size of an IP packet that can be sent over a link. Consequently, the typical MSS for IPv4 is 1460 bytes, calculated by subtracting the standard 20-byte IP and 20-byte TCP headers from the MTU. During the TCP three-way handshake, communicating hosts exchange their MSS values to inform each other of the largest segment size they can receive.
A common and disruptive network issue is an MTU mismatch, where a device in the communication path has a lower MTU than the source host. If a large packet arrives at this bottleneck and has its "Don't Fragment" (DF) bit set, the device must drop the packet. The solution is Path MTU Discovery, where the device sends an ICMP "Fragmentation Needed" message back to the source. This message informs the source of the lower MTU, allowing it to dynamically reduce its segment size for that specific connection and ensure successful communication.
--------------------------------------------------------------------------------
1.0 Understanding Maximum Transmission Unit (MTU)
1.1 Definition and Layer Placement
Maximum Transmission Unit (MTU) is a fundamental parameter operating at Layer 2 (Data Link Layer) of the TCP/IP stack. It defines the maximum size of the payload that the Data Link Layer can accept from the layer above it, the Network Layer. In practice, this means MTU dictates the maximum size of an IP packet that can be transmitted over a specific network interface without being fragmented.
1.2 The 1500-Byte Standard and Historical Context
The conventional default MTU value for Ethernet networks is 1500 bytes. This standard was established in the 1980s, a time when network hardware, particularly the memory on Network Interface Cards (NICs), was limited. NICs needed to buffer entire incoming frames to perform error checks (e.g., checksum calculations), and the 1500-byte value was a practical limit based on the available memory of that era.
While 1500 bytes remains the most common default, modern networks, especially in high-performance environments like data centers, frequently use much larger MTU values, such as 9000 bytes (known as "jumbo frames"), enabled by advances in hardware memory capacity.
1.3 MTU vs. Frame Size on the Wire
A critical distinction exists between the MTU and the total size of the frame transmitted over the physical medium (the wire). The MTU value of 1500 bytes applies only to the IP packet (the payload for Layer 2). The Data Link Layer adds its own headers and a trailer to encapsulate this payload.
For a standard Ethernet frame, this encapsulation includes:
• Destination MAC Address: 6 bytes
• Source MAC Address: 6 bytes
• Type/Length Field: 2 bytes
• Frame Check Sequence (Trailer): 4 bytes
Therefore, a 1500-byte IP packet results in a total frame size of 1518 bytes on the wire (1500 + 14-byte header + 4-byte trailer). The physical interface and medium must be capable of handling this larger size. The term MTU strictly refers to the payload received from the Network Layer.
2.0 Understanding Maximum Segment Size (MSS)
2.1 Definition and Layer Placement
Maximum Segment Size (MSS) is a parameter at Layer 4 (Transport Layer), specifically associated with the Transmission Control Protocol (TCP). It defines the maximum amount of application-layer data that can be contained within a single TCP segment.
2.2 The Role of MSS in Data Segmentation
Application layer protocols often send data as a continuous stream. The Transport Layer's responsibility is to break this stream into smaller, manageable chunks for transmission. These chunks are called segments. MSS specifies the maximum size of the data portion of these segments, ensuring that when TCP and IP headers are added, the resulting packet does not exceed the underlying network's MTU.
3.0 The Core Relationship: Connecting MTU and MSS
MSS is not an independent value; it is derived directly from the MTU of the outgoing network interface. This demonstrates a crucial example of inter-layer communication within the TCP/IP stack, where the operating system makes the Layer 2 MTU value known to the Layer 4 TCP protocol.
3.1 The Calculation Formula
The MSS is calculated to ensure the final IP packet fits within the MTU limit. The formula is:
MSS = MTU - (IP Header Size) - (TCP Header Size)
3.2 Example Scenarios
The calculated MSS value varies depending on the MTU and the IP version being used.
Scenario | MTU | IP Header Size | TCP Header Size | Resulting MSS |
Standard IPv4 | 1500 bytes | 20 bytes | 20 bytes | 1460 bytes |
Standard IPv6 | 1500 bytes | 40 bytes | 20 bytes | 1440 bytes |
Custom MTU (IPv4) | 1400 bytes | 20 bytes | 20 bytes | 1360 bytes |
This calculation ensures that a full-sized TCP segment, when encapsulated with TCP and IP headers, creates an IP packet that is exactly the size of the MTU, preventing the need for IP fragmentation.
4.0 MSS Negotiation in the TCP Three-Way Handshake
Hosts do not assume a default MSS; they explicitly communicate their MSS capabilities during the establishment of a TCP connection.
4.1 Announcing MSS Capability
During the TCP three-way handshake, the MSS value is exchanged as an option in the TCP header:
1. SYN: The client initiates the connection and sends its MSS value to the server, effectively stating, "Do not send me segments with more than X bytes of data."
2. SYN-ACK: The server responds, acknowledging the client's SYN and sending its own MSS value.
3. ACK: The client acknowledges the server's SYN-ACK, completing the connection.
4.2 Handling Asymmetrical MSS Values
The MSS values do not need to match. If Host A announces an MSS of 1460 and Host B announces an MSS of 1360, there is no negotiation for a common lower value. Instead, the communication proceeds as follows:
• Host A will send segments to Host B with a maximum data size of 1360 bytes.
• Host B will send segments to Host A with a maximum data size of 1460 bytes.
Each host respects the MSS limit announced by its peer for the data it transmits.
5.0 The MTU Mismatch Problem and Path MTU Discovery (PMTUD)
An MTU mismatch occurs when a router or other device along the communication path has an interface with a lower MTU than the source and destination hosts. This creates a bottleneck that can lead to packet loss.
5.1 The Scenario: A Bottleneck in the Path
Consider a scenario where Host A and a Google Server both have an MTU of 1500. Host A sends a 1500-byte IP packet. However, an intermediate router, R5, has an outbound interface configured with an MTU of 1400. Router R5 can receive the 1500-byte packet, but it cannot transmit it out of the 1400-byte MTU interface.
5.2 Router Behavior: Fragmentation vs. Dropping Packets
The router has two options when faced with this oversized packet:
1. IP Fragmentation: If permitted, the router can split the 1500-byte packet into smaller fragments (e.g., one 1400-byte packet and one 100-byte packet) that fit the lower MTU.
2. Drop the Packet: Most modern operating systems set the Don't Fragment (DF) bit in the IP header to 1. This bit forbids routers from fragmenting the packet. If the DF bit is set, the router has no choice but to drop the packet.
5.3 The Solution: Path MTU Discovery (PMTUD)
When the DF bit is set, a mechanism called Path MTU Discovery (PMTUD) is used to resolve the mismatch dynamically.
1. Packet Drop and ICMP Message: Upon dropping the oversized packet, Router R5 generates and sends an ICMP (Internet Control Message Protocol) message back to the original source, Host A.
2. "Fragmentation Needed" Message: This specific ICMP message is of the type "Fragmentation Needed and DF bit was Set." Crucially, this message includes the MTU value of the interface that caused the drop (in this case, 1400).
3. Host Response and Dynamic Adjustment:
â—¦ Host A's operating system receives the ICMP message and learns that the maximum MTU for the path to the Google Server is actually 1400 bytes, not 1500.
â—¦ The OS then informs its Transport Layer to adjust the parameters for this specific connection.
â—¦ The TCP protocol recalculates the MSS based on the new path MTU: 1400 (Path MTU) - 20 (IP) - 20 (TCP) = 1360 bytes.
â—¦ Host A resends the data, but now in segments no larger than 1360 bytes. The resulting 1400-byte IP packets can now successfully traverse Router R5.
This adjustment is made unilaterally by the source host based on the ICMP feedback; it does not require a new TCP handshake to renegotiate the MSS with the destination. The host becomes intelligent enough to adapt its segment size to the constraints of the discovered network path.