Home > Networking > MTU vs MSS

MTU vs MSS

MTU (Maximum Transmission Unit) and MSS (Maximum Segment Size) are two important concepts in networking, particularly in the context of TCP/IP communication. Here’s a clear breakdown of each and how they relate:

MTU (Maximum Transmission Unit)

  • Definition: MTU refers to the largest size of a data packet (in bytes) that can be transmitted over a network interface or protocol layer without needing to be fragmented.
  • Scope: It applies to the entire packet, including all headers (e.g., Ethernet, IP, TCP) and the payload.
  • Example: On a typical Ethernet network, the MTU is 1500 bytes. This means the entire packet—headers plus data—cannot exceed 1500 bytes.
  • Role: MTU is determined by the network hardware or protocol (e.g., Ethernet, Wi-Fi, VPN). If a packet exceeds the MTU, it must be fragmented (split into smaller packets) by the sender or an intermediate router, which can reduce efficiency.
  • Key Point: MTU is a limit imposed by the data link layer (Layer 2), but it affects higher layers like IP and TCP.

MSS (Maximum Segment Size)

  • Definition: MSS is the largest amount of data (payload) that can be carried in a single TCP segment, excluding the TCP and IP headers.
  • Scope: It applies specifically to the TCP payload, not the entire packet. MSS is derived from the MTU by subtracting the size of the TCP and IP headers.
  • Calculation: MSS = MTU – (IP header size + TCP header size)
    • Standard IP header = 20 bytes (without options)
    • Standard TCP header = 20 bytes (without options)
    • So, for an MTU of 1500 bytes: MSS = 1500 – (20 + 20) = 1460 bytes.
  • Role: MSS is negotiated between two devices during the TCP handshake to ensure that neither side sends TCP segments larger than what the network path can handle without fragmentation.
  • Key Point: MSS operates at the transport layer (Layer 4) and is designed to optimize TCP communication by avoiding fragmentation at the IP layer.

Key Differences

AspectMTUMSS
LayerData Link (e.g., Ethernet)Transport (TCP)
IncludesEntire packet (headers + data)Only TCP payload
Typical Value1500 bytes (Ethernet)1460 bytes (with standard headers)
PurposeLimits packet size on networkLimits TCP segment size
FragmentationHandled by IP layer if exceededPrevents fragmentation by TCP

How They Work Together

  • When a TCP connection is established, both sides advertise their MSS (based on their local MTU minus headers) to ensure data stays within the smallest MTU along the network path (path MTU).
  • If the MTU changes (e.g., due to a VPN or tunnel with a smaller MTU), the MSS adjusts accordingly to avoid fragmentation.
  • For example, if a VPN reduces the effective MTU to 1400 bytes, the MSS would drop to 1360 bytes (1400 – 40).

Practical Implications

  • MTU Issues: A mismatch or oversized MTU can lead to packet drops or fragmentation, slowing down communication.
  • MSS Issues: If MSS isn’t properly set, TCP might send segments that exceed the MTU, triggering fragmentation or retransmissions.

In summary, MTU is the ceiling for the entire packet size on a network, while MSS is a TCP-specific limit on the data portion, calculated from the MTU. They work together to ensure efficient, unfragmented data transfer. Let me know if you’d like examples or a deeper dive!

Leave a Comment