Maximum segment size
   HOME

TheInfoList



OR:

The maximum segment size (MSS) is a parameter of the ''options'' field of the TCP header that specifies the largest amount of data, specified in
bytes The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
, that a computer or communications device can receive in a single
TCP segment The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is commonl ...
. It does not count the
TCP header The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is commonl ...
or the
IP header An IP header is header information at the beginning of an Internet Protocol (IP) packet. An IP packet is the smallest message entity exchanged via the Internet Protocol across an IP network. IP packets consist of a header for addressing and routi ...
(unlike, for example, the MTU for IP datagrams). The
IP datagram A datagram is a basic transfer unit associated with a packet-switched network. Datagrams are typically structured in header and payload sections. Datagrams provide a connectionless communication service across a packet-switched network. The deli ...
containing a TCP segment may be self-contained within a single packet, or it may be reconstructed from several fragmented pieces; either way, the MSS limit applies to the total amount of data contained in the final, reconstructed TCP segment. To avoid fragmentation in the IP layer, a host must specify the maximum segment size as equal to the largest IP datagram that the host can handle minus the IP and TCP header sizes. Therefore,
IPv4 Internet Protocol version 4 (IPv4) is the fourth version of the Internet Protocol (IP). It is one of the core protocols of standards-based internetworking methods in the Internet and other packet-switched networks. IPv4 was the first version de ...
hosts are required to be able to handle an MSS of 536 octets (= 576 - 20 - 20) and
IPv6 Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol (IP), the communication protocol, communications protocol that provides an identification and location system for computers on networks and routes traffic ...
hosts are required to be able to handle an MSS of 1220 octets (= 1280 - 40 - 20). Small MSS values will reduce or eliminate IP fragmentation but will result in higher overhead. Each direction of data flow can use a different MSS. For most computer users, the MSS option is established by the
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs. Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
.


Default value

The default TCP Maximum Segment Size is 536. Where a host wishes to set the maximum segment size to a value other than the default, the maximum segment size is specified as a TCP option, initially in the TCP SYN packet during the
TCP handshake The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is commonly ...
. The value cannot be changed after the connection is established.


Inter-Layer Communication

In order to notify MSS to the other end, an inter-layer communication is done as follows: * The Network Driver (ND) or interface should know the Maximum Transmission Unit (MTU) of the directly attached network. * The IP should ask the Network Driver for the Maximum Transmission Unit. * The TCP should ask the IP for the Maximum Datagram Data Size (MDDS). This is the MTU minus the IP header length (MDDS = MTU - IPHdrLen). * When opening a connection, TCP can send an MSS option with the value equal to: MDDS - TCPHdrLen. In other words, the MSS value to send is: MSS = MTU - TCPHdrLen - IPHdrLen While sending TCP segments to the other end, an inter-layer communication is done as follows: * TCP should determine the Maximum Segment Data Size (MSDS) from either the default or the received value of the MSS option. * TCP should determine if source fragmentation is possible (by asking the IP) and desirable. ** If so, TCP may hand to IP, segments (including the TCP header) up to MSDS + TCPHdrLen. ** If not, TCP may hand to IP, segments (including the TCP header) up to the lesser of (MSDS + TCPHdrLen) and MDDS. * IP checks the length of data passed to it by TCP. If the length is less than or equal MDDS, IP attaches the IP header and hands it to the ND. Otherwise, the IP must do source fragmentation.


MSS and MTU

MSS is sometimes conflated with MTU/PMTU, which is a characteristic of the underlying link layer, while MSS applies specifically to TCP and hence the
transport layer In computer networking, the transport layer is a conceptual division of methods in the layered architecture of protocols in the network stack in the Internet protocol suite and the OSI model. The protocols of this layer provide end-to-end ...
. The two are similar in that they limit the maximum size of the payload carried by their respective
protocol data unit In telecommunications, a protocol data unit (PDU) is a single unit of information transmitted among peer entities of a computer network. It is composed of protocol-specific control information and user data. In the layered architectures of c ...
(frame for MTU, TCP segment for MSS), and related since MSS cannot exceed the MTU for its underlying link (taking into account the overhead of any headers added by the layers below TCP). However, the difference, in addition to applying to different layers, is that MSS can have a different value in either direction and also that frames exceeding the MTU may cause packets (which encapsulate segments) to be fragmented by the
network layer In the seven-layer OSI model of computer networking, the network layer is layer 3. The network layer is responsible for packet forwarding including routing through intermediate routers. Functions The network layer provides the means of transfe ...
, while segments exceeding the MSS are simply discarded.


Further reading

* *


See also

*
Path MTU Discovery Path MTU Discovery (PMTUD) is a standardized technique in computer networking for determining the maximum transmission unit (MTU) size on the network path between two Internet Protocol (IP) hosts, usually with the goal of avoiding IP fragmentat ...


References

{{DEFAULTSORT:Maximum Segment Size Packets (information technology)