Confused About MSS and MTU ?
Tags: computerscience, community, tutorial, productivity
Published: 2022-07-16 15:55:42

**Computer Network is a set or collection of linking devices.**

In simple words , in networking there is transferring of data in the form of packets from one node to another node using protocols .

Before coming to the point that what is meant by MTU ? , we need to know to know that what is meant by **_Fragmentation_** .

So, there might be the case , where the packet is so big enough , because of which it is not able to get transferred to other network . To deal with these problem , it get break into parts , which is known as fragmentation .

**_MTU (Maximum Transmission Unit)_** is concerned with the largest unit i.e. largest packet or frame size (in Octets) , which can be sent over the network such as Internet .

**Example :**

Assume A and B as the networks , whose MTU is 500 Bytes and 200 Bytes , and the router only knows that how much packet size A can send and B can receive .

To understand it easily , you should know the [IPv4 Header Format](https://www.geeksforgeeks.org/introduction-and-ipv4-datagram-header/) .

If DF (Do Not Fragment) = 1 , then router cannot fragment the packet , packet will go as it is or router will just discard it .

If DF (Do Not Fragment) = 0, then router can do anything i.e. it can break it into any parts .


![Transfer Of Packets](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mfooj3jvplbnjjt75cj1.png)

>                            Example of MTU

Suppose here ,DF = 0, so router will divide the packet into fragments (Eg : 3 fragments).

In every fragments , there will be Data and Header , here , size of header is 20 Bytes .

So , here data of 480 Bytes (i.e. 500–20) , we divided it into 3 parts. Now fragment will get transmitted to B (as B’s MTU = 200 Bytes).

Through the Identification Number , network B will come to know that the fragments are of the same packet only . In every fragment of same packet identification number will be the same .

First fragment have MF (More Fragment) = 1 in its header , ,means it is saying that “Behind me more fragments are coming”.

In third i.e. the last fragment , MF = 0 , means it is saying “ I am the last fragment”.

It will use offset field to know that which fragment is first , which one is second , and so on.

Fragmentation for MTU is done at Router and Reassembly is done at Destination.

MSS stands for Maximum Segment Size , and Segment is the PDU (Protocol Data Unit) of Transport Layer. From these we come to the conclusion that MSS is the part of Transport Layer only.

In TCP , connection get establish in 3 phases, that’s why it’s also called as Three-Way Hand Shaking . In request phase , sender and receiver communicates with each other i.e. “I have to send data , do you want to receive it or not , etc.”

MSS is the largest TCP (Transport Control Protocol) segment size that a network connected device can receive .

It defines the payload of TCP segment , and measured in Bytes , because TCP is Byte-Oriented Protocol.

Application Layer pass data of any size on to the TCP Layer Protocol . But ,Transport Layer can forward or transfer data of 1460 Bytes to the next layer . Router will drop the segment if size of segment is larger than 1460 Bytes .

And there are two headers one is IP Header of 20 Bytes , and other one is TCP Header o 20 Bytes.


![Packet Format](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gs7peh4gv1ficwiex54i.png)

>                         MSS (Maximum Segment Size)

MSS = MTU — (TCP Header + IP Header)

= 1500 — (20 + 20)

= 1460 Bytes

Similarly , MTU will be ,

MTU = MSS + (TCP Header + IP Header)

= 1460 + (20 + 20)

1500 Bytes

**_Congrats, Now you are a Champ in these MSS and MTU metrics._**