Fact-checked by Grok 2 weeks ago

Maximum segment size

Maximum Segment Size (MSS) is a key parameter in the that specifies the largest amount of data, measured in bytes, that a can receive in a single unfragmented , excluding the lengths of the and headers. Introduced in RFC 879 (1983), an early extension to the specification, the MSS is negotiated during the three-way handshake for establishing a , where each advertises its maximum receive size via a TCP option (kind 2, length 4) included in the SYN segments. This negotiation ensures that segments do not exceed the path's capabilities, thereby preventing and improving transmission efficiency across diverse network paths. The effective MSS used by a sender is the minimum of the value advertised by the (or the if none is received) and the sender's own maximum transmission size, adjusted for header overheads such as the Maximum Transmission Unit (MTU) minus 40 bytes for standard IPv4 headers (20 bytes each for and without options). If no MSS option is exchanged, implementations to 536 bytes for IPv4 networks (derived from the minimum datagram size of 576 bytes minus 40 bytes of headers) or 1220 bytes for (based on a minimum MTU of 1280 bytes minus 60 bytes of headers). This value, established early in 's development, balances compatibility with legacy networks while allowing modern implementations to use larger values—often up to 1460 bytes on standard Ethernet (1500-byte MTU minus 40 bytes)—when is supported. MSS plays a critical role in TCP's reliability and performance, particularly in environments with varying link MTUs, such as the , where improper sizing can lead to packet blackholing or retransmissions due to fragmentation. Over time, refinements in RFCs have addressed edge cases, such as handling MSS in the presence of options or during (PMTUD), emphasizing that senders must clamp their segment sizes to avoid exceeding the discovered path MTU. By dynamically adapting to network constraints, MSS enables robust data transfer while minimizing overhead, making it a foundational element of TCP's end-to-end design.

Fundamentals

Definition and Purpose

The Maximum Segment Size (MSS) is a in the Transmission Control Protocol () that specifies the largest amount of data, measured in bytes, that a endpoint can receive in a single segment, excluding the sizes of the and headers. This value is advertised via the MSS option in the header during connection establishment, allowing communicating hosts to agree on an appropriate segment size for their session. The MSS effectively defines the capacity of a segment, ensuring that the total packet size remains manageable within network constraints. The primary purpose of the MSS is to prevent IP-layer fragmentation by limiting the data payload so that the resulting TCP segment, when encapsulated in an datagram, does not exceed the path's (MTU). By setting the MSS to fit within the available MTU after accounting for header overhead, TCP avoids the need for intermediate routers to fragment packets, which can introduce delays and inefficiency. This mechanism supports efficient data transfer in TCP's connection-oriented model, where reliable delivery relies on ordered, error-checked segments without the complications of reassembly. Key benefits of using MSS include reduced retransmissions due to lower likelihood of fragmented , as incomplete fragments are often dropped entirely in networks. It also improves overall throughput by enabling larger, more efficient payloads tailored to the network path, particularly in heterogeneous environments with varying link MTUs. The MSS is typically calculated using the formula: \text{MSS} = \text{MTU} - (\text{TCP header size} + \text{IP header size}) with standard header sizes of 20 bytes for TCP (without options) and 20 bytes for IPv4, yielding an MSS of, for example, 1460 bytes on an Ethernet MTU of 1500 bytes. This approach minimizes overhead and enhances the reliability of TCP's end-to-end delivery guarantees.

Historical Development

The concept of Maximum Segment Size (MSS) emerged in the early development of the Transmission Control Protocol (TCP) as a mechanism to optimize data transmission and mitigate fragmentation in packet-switched networks. In the original TCP specification outlined in RFC 793, published in September 1981, MSS was introduced as an optional field in the TCP header to indicate the largest amount of data, excluding headers, that a receiver could accept in a single segment. This option was intended to be exchanged during connection establishment, specifically in SYN segments, allowing endpoints to align segment sizes with underlying network capabilities and avoid inefficient IP datagram fragmentation, which was a growing concern as the ARPANET transitioned toward a more interconnected Internet. Without such negotiation, TCP implementations relied on fixed assumptions about segment sizes, often leading to failures in mixed-MTU environments where network paths included links with varying maximum transmission unit (MTU) limits, such as during the early expansions beyond the ARPANET's standardized frame sizes. Subsequent clarifications refined the MSS mechanism to address implementation ambiguities and evolving network realities. RFC 879, published in 1983, provided detailed guidance on the MSS option, defining its format, default value of 536 octets (derived from the minimum datagram size of 576 octets minus 40 octets for headers), and its role in preventing fragmentation by ensuring segments fit within datagrams. This document emphasized that MSS negotiation operates independently in each direction of a , responding to the proliferation of diverse network types in the early , where fixed segment assumptions frequently caused packet drops or retransmissions. As the scaled from research networks like to broader commercial and dial-up s, these early challenges highlighted the need for dynamic size adjustment to maintain reliability. Later milestones incorporated MSS into modern protocol updates, particularly with the advent of and revised standards. In 2012, RFC 6691 updated the MSS guidelines to account for 's larger headers and clarified calculations, recommending that MSS values subtract only fixed header lengths (40 octets for plus 20 for ) without adjusting for variable options, thereby promoting consistency across protocol versions. This addressed fragmentation issues in hybrid IPv4/ environments. Finally, RFC 9293, published in August 2022, consolidated and obsoleted prior specifications including RFC 793 and RFC 879, mandating MSS option support in all implementations and updating defaults to 1220 octets for to better suit contemporary broadband and high-speed networks, where diverse link types like tunnels and mobile connections continue to drive the need for adaptive MSS to circumvent "" routers that silently discard oversized packets.

TCP Implementation

Segment Structure

A TCP segment is composed of a fixed header followed by a variable-length data payload, with optional fields that may extend the header. The header, as defined in the original TCP specification, has a minimum length of 20 bytes and includes essential fields such as 16-bit source and destination ports, a 32-bit sequence number to track byte order, a 32-bit acknowledgment number for confirming receipt, a 4-bit data offset indicating header length in 32-bit words, 6 reserved bits (set to zero), 6 control flags (URG for urgent data, ACK for acknowledgment, PSH to push data, RST to reset connection, SYN for synchronization, and FIN to finish), a 16-bit window size for flow control, a 16-bit checksum for integrity, and a 16-bit urgent pointer if applicable. Following the fixed portion are variable-length options (multiples of 8 bits) and padding to align to a 32-bit boundary, after which the payload carries the actual application data up to the negotiated maximum segment size (MSS). The MSS specifically constrains the size of this —the octets—to ensure the total segment (header plus ) fits within the underlying limits without fragmentation. It represents the maximum amount of a can accept in a single segment, calculated as the (MTU) minus the combined and header lengths (typically 20 bytes each, totaling 40 bytes), and explicitly excludes the and headers themselves from the countable portion. Application-layer headers, such as those from HTTP or TLS, are treated as part of the and thus consume space within the MSS limit, potentially reducing the effective space for pure application . This design promotes efficient transmission by avoiding , which can degrade performance. For illustration, consider a common scenario on an Ethernet link with a 1500-byte MTU: an MSS of 1460 bytes allows a payload of that size, combined with a 20-byte and 20-byte TCP header, to exactly fill the 1500-byte packet without exceeding the limit.
ComponentSize (bytes)Description
20Fixed IPv4 header without options.
Header20Minimum TCP header without options.
Payload1460Data up to MSS limit.
Total1500Fits standard Ethernet MTU.
This breakdown assumes no optional fields; in practice, implementations often negotiate the MSS during the connection handshake to account for observed path constraints. Variations in segment structure arise from optional TCP headers, which can increase the effective header size beyond 20 bytes and thereby reduce the usable MSS for a given MTU. For instance, the TCP Timestamps option, used for round-trip time measurement and protection against wrapped sequences, adds 10 bytes to the header. Similarly, the Window Scale option, which extends the window field to support larger buffers, contributes 3 bytes. The Selective Acknowledgment (SACK) option, enabling acknowledgment of non-contiguous data blocks, varies from 10 bytes (one block) up to 40 bytes (four blocks), further encroaching on the available space for payload if not adjusted in the MSS calculation. These extensions, while enhancing performance in high-bandwidth or lossy networks, necessitate careful MSS adjustment to maintain segment integrity within IP constraints.

MSS Negotiation in Handshake

During the three-way handshake for establishing a , endpoints communicate their Maximum Segment Size (MSS) capabilities using the TCP MSS option to ensure segments do not exceed the receiver's capacity. This option, defined with Kind 2 and Length 4 bytes, carries a 16-bit value representing the maximum number of data octets the sender can receive in a segment, excluding headers. The option is included exclusively in segments with the SYN control bit set, specifically the initial SYN from the client and the SYN-ACK from the server, allowing each endpoint to announce its receive MSS unilaterally. The negotiation process determines the effective MSS for each direction as the minimum of the locally computed maximum (derived from the interface MTU minus fixed and header sizes of 20 bytes each) and the value announced by the remote peer via the MSS option. If no MSS option is received, implementations must fall back to a default send MSS of 536 bytes for (corresponding to the minimum datagram size of 576 bytes minus 40 bytes of headers) or 1220 bytes for (based on the minimum MTU of 1280 bytes minus 60 bytes of headers). This minimum ensures compatibility with the network layer's transmission limits, preventing fragmentation at the initial setup stage. In practice, the handshake proceeds as follows: The client initiates with a segment proposing its MSS, commonly 1460 bytes for an Ethernet MTU of bytes after subtracting headers. The server responds with a SYN- segment including its own MSS proposal, and the client sends the final ACK without an MSS option, confirming the connection with the negotiated values now in effect. Once established, the MSS values are fixed for the duration of the connection, with no provision for renegotiation during data transfer. For connections, the process mirrors IPv4 but accounts for the larger minimum MTU and potential jumbograms; an announced MSS of 65,535 bytes is interpreted as effectively unlimited, relying on for actual limits. If the MSS option is malformed or exceeds bounds (e.g., greater than 65,535), implementations silently ignore it and revert to the default to maintain robustness.

Relation to Network Limits

Connection to MTU

The Maximum Transmission Unit (MTU) represents the largest packet size, including headers, that a network link can transmit without fragmentation. For instance, the standard Ethernet MTU is bytes. The Maximum Segment Size (MSS) is derived from the MTU by subtracting the sizes of the fixed and headers to determine the maximum TCP payload. In IPv4, with 20-byte IP and 20-byte TCP headers, the formula is MSS = MTU - 40 bytes. For , which uses a 40-byte , the adjustment is MSS = MTU - 60 bytes. This derivation excludes variable options in the headers, requiring senders to further reduce the data length accordingly. The interplay between MSS and MTU ensures that TCP segments fit within the link's capacity, preventing IP-layer fragmentation. If the MSS exceeds the effective MTU minus headers, packets may be fragmented, dropped, or require inefficient reassembly, leading to performance degradation. Representative calculations illustrate this relationship. For an Ethernet link with a -byte MTU under , the MSS is 1460 bytes (1500 - 40). In a PPPoE scenario over DSL with a 1492-byte MTU, the MSS is 1432 bytes after accounting for protocol overhead and headers (1492 - 60).

Path MTU Discovery Integration

Path MTU Discovery (PMTUD) allows a sender to dynamically determine the effective (MTU) along a network path by transmitting packets with the Don't Fragment (DF) flag set at an initially assumed large size (such as the sender's local interface MTU), and upon receiving an ICMP "Datagram Too Big" message from an intermediate router indicating the next-hop MTU limit, the sender reduces the packet size to that MTU and may later probe with larger sizes to refine the path MTU estimate. In networks, the process is analogous, utilizing "Packet Too Big" messages to signal the need for fragmentation, with the sender updating its path MTU cache based on the reported MTU value. This mechanism ensures that subsequent packets avoid fragmentation, which can degrade performance, by adapting to the smallest MTU on the end-to-end path. Integration of PMTUD with maximum segment size (MSS) occurs after initial TCP handshake negotiation, where discovered path MTU values inform MSS clamping: the sender limits segment sizes to the path MTU minus the lengths of IP and TCP headers, preventing oversized packets that would otherwise be dropped or fragmented. This addresses "black hole" connections, in which PMTUD fails due to silent packet drops when ICMP responses are lost, causing TCP retransmissions and potential connection stalls; RFC 4821 formalizes this by standardizing robust probing at the packetization layer to detect and adjust for such path constraints without full reliance on ICMP feedback. A primary challenge in PMTUD is the blocking of ICMP messages by firewalls or security devices, which prevents the sender from receiving necessary feedback and leads to persistent failures, particularly in environments with strict filtering policies. To counter this, Packetization Layer Path MTU Discovery (PLPMTUD) employs application-layer probing—such as sending incrementally larger segments or datagrams—to infer path limits through timeout detection rather than ICMP, as specified in RFC 4821. An extension in RFC 8899 adapts PLPMTUD for datagram-based transports like , enhancing reliability in scenarios where traditional ICMP-dependent methods falter. In modern IPv6 deployments, PMTUD is strongly recommended for nodes to exploit path MTUs exceeding the minimum link MTU of 1280 bytes, as fragmentation is not supported end-to-end. For instance, the IPv6 minimum path MTU of 1280 bytes constrains the effective MSS to 1220 bytes to accommodate fixed header overheads, ensuring compatibility across diverse network links while avoiding discovery failures.

Standards and Variations

Default Values Across Protocols

In , the default Maximum Segment Size (MSS) for IPv4 is 536 bytes, derived from the minimum IP datagram size of 576 bytes minus the 20-byte IP header and 20-byte header. For , the default MSS is 1220 bytes, based on the minimum MTU of 1280 bytes minus the 40-byte header and 20-byte header. Other protocols incorporate analogous mechanisms for segment sizing. In the (SCTP), there is no explicit MSS option; instead, user messages are fragmented into DATA chunks sized to fit the Path MTU (PMTU), with receivers required to support at least 1500 bytes per packet to ensure interoperability. The protocol ( 9000) uses variable framing over without a traditional MSS, but sets a minimum size of 1200 bytes for initial packets and path validation, effectively aligning with the minimum MTU minus headers (approximately path MTU minus 40 bytes for plus overhead). These defaults promote interoperability across diverse network paths by preventing fragmentation on links with limited MTU, such as the 576-byte minimum for in early designs. The 536-byte value specifically accommodates infrastructure without requiring prior path knowledge. Current specifications reaffirm these values while emphasizing dynamic adjustments. 9293 (2022), updating standards, retains the 536-byte IPv4 and 1220-byte defaults but recommends (PMTUD) over static limits for optimal performance, without altering defaults. Similar guidance applies to SCTP and , prioritizing PMTUD for modern deployments.

Adjustments in Modern Networks

In virtual private networks (VPNs) employing , tunneling introduces header overhead ranging from 20 to 50 bytes, depending on the mode (transport or tunnel) and options like integrity checks or padding. This reduces the effective (MTU), often requiring MSS clamping to avoid fragmentation; for example, with a standard 1500-byte Ethernet MTU, the MSS may be adjusted from 1460 bytes to approximately 1360 bytes in tunnel mode to accommodate the overhead. Modern implementations, including features via TCPMSS targets and Cisco IOS with the ip tcp adjust-mss command, provide auto-clamping during the TCP three-way handshake, dynamically setting the MSS based on interface MTU minus 40 bytes for IP and TCP headers. Mobile and wireless networks, governed by specifications for , adjust MSS to account for radio bearer overhead, with a common MTU of 1428 bytes that reserves space for potential backhaul encryption like while fitting within the air interface limits. This value ensures efficient transmission over variable radio conditions without excessive fragmentation. In () environments, fragmentation thresholds—typically set to 2346 bytes but configurable lower to combat interference—indirectly constrain the effective MTU, influencing MSS values; thresholds below the MTU prompt devices to fragment larger frames, increasing overhead and necessitating MSS reductions to optimize performance. High-speed Ethernet links supporting jumbo frames enable an MTU of 9000 bytes, allowing MSS values up to 8960 bytes after subtracting 40 bytes for and headers, which reduces per-packet overhead and boosts throughput in data centers or LANs by minimizing segmentation. However, end-to-end symmetric support is essential; mismatched devices in the path can cause fragmentation or packet drops, as jumbo frames exceed standard Ethernet limits. Emerging trends in transport protocols decouple MSS from traditional mechanisms. over , built on , dynamically adjusts sizes up to a default maximum of 65527 bytes using (PMTUD), with initial packets padded to at least bytes for path validation and no explicit MSS negotiation. Similarly, transition tunnels like clamp the MTU to 1280 bytes—the minimum—to prevent encapsulation-induced fragmentation across IPv4 infrastructures.

References

  1. [1]
    RFC 9293: Transmission Control Protocol (TCP)
    Length of the option in bytes.¶. Maximum Segment Size (MSS):. 2 bytes.¶. The maximum receive segment size at the TCP endpoint that sends this segment.¶. 3.2.1 ...
  2. [2]
    RFC 879: The TCP Maximum Segment Size and Related Topics
    ### Summary of TCP Maximum Segment Size (MSS) from RFC 879
  3. [3]
    RFC 6691: TCP Options and Maximum Segment Size (MSS)
    In the Introduction, it states: THE TCP MAXIMUM SEGMENT SIZE IS THE IP MAXIMUM DATAGRAM SIZE MINUS FORTY. Borman Informational [Page 2]. RFC 6691 TCP Options ...
  4. [4]
  5. [5]
  6. [6]
  7. [7]
  8. [8]
  9. [9]
  10. [10]
    RFC 879 - The TCP Maximum Segment Size and Related Topics
    RFC 879 discusses the TCP Maximum Segment Size (MSS) and its relation to IP datagram size, clarifying TCP and IP interaction. The default MSS is 536.
  11. [11]
  12. [12]
    RFC 6691 - TCP Options and Maximum Segment Size (MSS)
    This memo discusses what value to use with the TCP Maximum Segment Size (MSS) option, and updates RFC 879 and RFC 2385.Missing: history | Show results with:history
  13. [13]
  14. [14]
  15. [15]
  16. [16]
  17. [17]
  18. [18]
  19. [19]
  20. [20]
  21. [21]
  22. [22]
  23. [23]
  24. [24]
    Resolve IPv4 Fragmentation, MTU, MSS, and PMTUD Issues ... - Cisco
    This document describes how IPv4 Fragmentation and Path Maximum Transmission Unit Discovery (PMTUD) work.
  25. [25]
    RFC 8200 - Internet Protocol, Version 6 (IPv6) Specification
    ... size of the IPv6 header relative to the IPv4 header. For example, in IPv4, TCP's Maximum Segment Size (MSS) option is computed as the maximum packet size (a ...
  26. [26]
    Cisco IOS IP Application Services Command Reference - Cisco
    Jul 19, 2011 · Examples. The following example shows the configuration of a PPPoE client with the MSS value set to 1432: vpdn enable no vpdn logging ! vpdn- ...
  27. [27]
    RFC 1191 - Path MTU discovery - IETF Datatracker
    This memo describes a technique for dynamically discovering the maximum transmission unit (MTU) of an arbitrary internet path.Missing: benefits | Show results with:benefits
  28. [28]
    RFC 1981 - Path MTU Discovery for IP version 6 - IETF Datatracker
    IPv6 nodes SHOULD implement Path MTU Discovery in order to discover and take advantage of paths with PMTU greater than the IPv6 minimum link MTU.
  29. [29]
    RFC 4821 - Packetization Layer Path MTU Discovery
    This document describes a robust method for Path MTU Discovery (PMTUD) that relies on TCP or some other Packetization Layer to probe an Internet path with ...
  30. [30]
    RFC 2923 - TCP Problems with Path MTU Discovery
    RFC 2923 catalogs TCP problems with Path MTU Discovery, including the black hole problem, stretch ACKs, and MSS advertisement based on PMTU.
  31. [31]
    Packetization Layer Path MTU Discovery for Datagram Transports
    This document specifies Datagram Packetization Layer Path MTU Discovery (DPLPMTUD). This is a robust method for Path MTU Discovery (PMTUD) for datagram ...Table of Contents · Datagram Packetization Layer... · Specification of Protocol...
  32. [32]
    RFC 4960 - Stream Control Transmission Protocol - IETF Datatracker
    SCTP is a reliable transport protocol operating on top of a connectionless packet network such as IP. It offers the following services to its users.
  33. [33]
    RFC 9000 - QUIC: A UDP-Based Multiplexed and Secure Transport
    Any reduction in QUIC's maximum datagram size in response to ICMP messages ... The default for this parameter is the maximum permitted UDP payload of 65527.
  34. [34]
    [PDF] Guide to IPsec VPNs - NIST Technical Series Publications
    Jun 1, 2020 · larger than 1500 bytes, both IPsec devices are set to use TCP MSS clamping at 1440 ... Configure the VPN server's IPsec connection and EAP-TLS ...
  35. [35]
    MTU and MSS for IPsec Overhead - volatile space
    Aug 16, 2021 · A deep dive and byte-for-byte breakdown of IPsec overhead to aid in calculating MSS Clamping, understanding why it's needed, and its effects.
  36. [36]
    MTU/MSS Design Considerations" - Cradlepoint Connect
    The MTU for LTE is 1,428 and WiMax is 1,400. Changing the MTU or MSS can achieve greater reliability when using cellular data services by avoiding fragmentation ...Missing: radio | Show results with:radio
  37. [37]
    What is Fragmentation threshold and when should we tweak ...
    Mar 26, 2020 · The fragmentation threshold limits the size of packets transmitted over the Wireless network. If a packet exceeds the fragmentation ...<|control11|><|separator|>
  38. [38]
    MTU, Jumbo Frames and MSS Explained - Packet Coders
    Oct 10, 2018 · Jumbo frames are used on local area networks that support at least 1 Gbps and can be as large as 9,000 bytes. Because jumbo frames are not ...Missing: symmetric | Show results with:symmetric
  39. [39]
    RFC 6343 - Advisory Guidelines for 6to4 Deployment
    This document provides advice to network operators about deployment of the 6to4 technique for automatic tunneling of IPv6 over IPv4.Missing: clamp | Show results with:clamp