1. Introduction
In this tutorial, we’ll explore the difference between the Maximum Transmission Unit (MTU) and Maximum TCP Segment Size (MSS), two important TCP/IP protocol stack concepts.
2. TCP/IP Protocol Stack
Most data transmissions over Internet go over the TCP/IP protocol stack. In fact, TCP/IP is made of protocols that define how data should be transmitted over a network. The stack has been named according to its two most important protocols: TCP and IP, which stands for Internet Protocol.
The TCP protocol is responsible, on the one hand, for providing the insurance of data reliability when transmitted from one device to another. On the other hand, it manages the flow of the data. But in networking, TCP protocol is best known for its acknowledgment mechanisms used to confirm the receipt of transmitted packets over the networks when it reaches their destination or not transmitting in case of failure.
The IP protocol is in charge of transmitting data across the network. Similarly to TCP protocol, IP is best known for two functions: addressing and routing, mostly routing packets from a source to a destination. Depending on the version of the IP used, the IP protocol equally offers fragmentation and reassembly services when necessary.
The stack is organized in layers within which protocols interact or are used alone. Each layer renders service to the layer above, making it simple to update or debug if a problem occurs somewhere in the stack. Some protocols in the stack involve:
In this protocol stack, IP or Network and Access to Network layers are considered low-level layers, and they are defined in equipment. In contrast, Transport and Application layers are said to be high-level protocols, and they are defined in the Operating System.
3. Packet Encapsulation
Data is transmitted over the network using the TCP/IP protocol stack. Data comprises Protocol Data Units (PDU), which vary from layer to layer. A PDU is a unit of information transmitted as a single entity between network devices. For instance, the PDU is called a TCP segment or a UDP datagram at the transport layer**. At the network layer, the PDU is called a packet, and at the data link layer, the PDU is called a frame**.
Packet encapsulation in TCP/IP refers to the process of adding headers to a packet as it moves down the protocol stack until it reaches its destination and then removing the headers to extract the original payload, also called data:
As packets move down the TCP/IP stack, they are further encapsulated with additional headers added to the packet. This process of adding headers to a packet as it moves down the TCP/IP stack is known as encapsulation. When a packet is received by a device, it is encapsulated, with each layer of headers being removed until the original payload is revealed. Understanding packet encapsulation is critical for troubleshooting network issues and designing efficient network architectures.
3.1. Media Access Control and MTU
Media access control (MAC) is a protocol used in the data link layer of the TCP/IP protocol stack to manage access to a shared network medium. MAC protocols define rules for how devices on a network communicate with each other and avoid conflicts when transmitting data. This includes protocols such as Ethernet, WiFi, and Token Ring.
MTU defines the largest size of data that can be transmitted over a network in a single packet. It is determined by the underlying data link layer technology and can vary depending on the network. For instance, if the underlying data link layer technology is Ethernet, then the MTU is 1 500 bytes. In some cases, the MTU may need to be adjusted to ensure packets can be transmitted successfully over a network.
The performance of a network highly depends on the size of the MTU. Actually, most often, a larger MTU size can result in more efficient data transmission, as larger packets mean less overhead from headers and less overhead from fragmentation and reassembly when fragmentation is allowed (IPv4 only).
3.2. Three-way Handshake and MSS
The three-way handshake process occurs when a client requests a connection to a server. We point out that both exchange essential parameters to establish a reliable connection. The MSS is an optional parameter exchanged during the three-way handshake that sets the largest TCP segment for communications.
Essentially, the Maximum TCP segment size enables endpoints to negotiate the largest packet size that can be used for data transmission, which can help optimize network performance. Thus, during the three-way handshake process, the MSS is negotiated and parameters optimized, allowing endpoints to establish reliable connections and efficiently communicate.
4. Difference Between MTU and MSS
MTU and MSS are important parameters affecting data transmission in a TCP/IP network.
As we said earlier, MTU refers to the maximum size of a frame that can be transmitted in a single packet over a network and is defined by the underlying data link layer technology used in the network. Larger MTU sizes allow better transmissions since fewer datagram fragments will be sent over the network.
The MSS, which is an optional parameter during the three-way handshake process, determines the maximum amount of data that can be included in a single TCP segment. This size is negotiated between the sender and the receiver. It is most often set to a value less than or equal to the MTU size to guarantee that packets are not only reliable but can also be transmitted without fragmenting them.
We can talk about the difference between MTU and MSS in terms of what determines their sizes, their implementation in the TCP/IP protocol stack, and how they are related:
\begin{tikzpicture}
MTU
MSS
MTU is used at the data link layer
MSS is found when the transport protocol used is TCP, at the transport layer
From the above, we notice that the MTU is a mandatory parameter in all TCP/IP networks
MSS is an optional parameter, and its existence depends on the transport protocol used
Interlocutors do not intervene while fixing the size of an MTU frame, the underlying data link protocol does
Contrary to the MTU, the MSS size is negotiated between the sender and the receiver during the Three-way Handshake process
The choice of an MTU size does not depend on the size of MSS
The size of MSS must be chosen according to the size of the underlying MTU
5. Conclusion
In this article, we have drawn out the difference between MTU and MSS in the TCP/IP protocol stack. We have started by presenting each concept and describing how they are used in network transmissions. And after setting the foundations and explaining each of them, we can conclude that, although they can seem confusing, there is a real difference between them.