TCP - Determining the MSS

During the three way handshake used by the TCP protocol, one of the parameters that is agreed upon between the sender and receiver is the Maximum Segment Size (MSS). This MSS value is determined like so:

The MSS is determined through the exchange of TCP options in the initial SYN (synchronize) packets. Here's how the process unfolds:

  1. Client Sends SYN Packet with MSS Option:

    • The client initiates the connection by sending a SYN packet to the server.
    • In the TCP header of this SYN packet, the client includes the MSS option, specifying the maximum segment size it can receive. This value is based on the client's own network interface's Maximum Transmission Unit (MTU), minus the sizes of the IP and TCP headers.
  2. Server Responds with SYN-ACK Packet with MSS Option:

    • The server responds with a SYN-ACK packet to acknowledge the client's request.
    • In the TCP header of the SYN-ACK packet, the server includes its own MSS option, indicating the maximum segment size it can receive.
  3. Client Acknowledges with ACK Packet:

    • The client sends an ACK packet to acknowledge the server's response, completing the three-way handshake.
    • At this point, both the client and the server know each other's MSS values.

Determination of MSS:

  • Each Side Advertises Its Own MSS:

    • The MSS is determined individually by each host based on its own MTU. The common formula is: MSS = MTU - (IP Header Size + TCP Header Size
    • For example, with a standard Ethernet MTU of 1500 bytes and typical header sizes (20 bytes for IP and 20 bytes for TCP), the MSS would be: 1500 - (20 + 20) = 1460
  • Use of the Smaller MSS Value:

    • After exchanging MSS values, each host uses the smaller of the two values for sending data to ensure that segments are not too large for the receiver.

The determination of the MSS only depends upon the supported MTUs of the NICs on the client and server, and does not depend upon the MTU restrictions that may exist on the network infrastructure between the client and server.

However, it is possible to influence the size of the MSS that will be negotiated using the adjust-mss feature on the intervening Cisco IOS routers.

Links:

https://networklessons.com/cisco/ccie-routing-switching/pppoe-mtu-troubleshooting-cisco-ios