Skip to content
Related Articles

Related Articles

How to Determine the Optimal MTU and MSS Size?

View Discussion
Improve Article
Save Article
  • Last Updated : 10 Feb, 2022
View Discussion
Improve Article
Save Article

Transmission Control Protocol(TCP) is the most important protocol of the internet protocol suite. TCP is basically a connection-oriented protocol that is concerned with error control, flow control, and congestion control in the network to maintain the integrity of the data and make data transmission easier.  TCP makes use of MTU (Maximum Transmission Unit) for identifying the maximum size of any data packet while transmission of data. 

MTU:

The Maximum Transmission Unit (MTU) is the maximum possible packet/frame size that can be communicated over the network without breaking it into smaller fragments. They are declared in octets that can be transmitted in a frame/packet-based network. If any packet is bigger than the specified MTU setting, then it will break or fragment the original packet into smaller subpackets. Now, it is okay if the number of these packets is small the problem arises when the number of fragmented packets is large, in this case, it significantly drops down the transmission speed of data over the network.

MSS:

Maximum Segment Size (MSS) is used to limit the size of packets that are transmitted over the network, basically, it is the maximum possible data that a device can receive in a single packet without any fragmentation. All data that is transmitted over a network is broken down into small fragments or packets and various headers are attached to these packets that are used to carry the information about their source, destination, and contents. MSS evaluates a portion of a packet (non-header portion), which is known as the payload. So, if its size is too big it does not let it pass through. MSS describes the segment as the size of the payload, without any headers attached, and Its announcements are sent through SYN packets.  

MTU and MSS sizes:

MTU = MSS + TCP/IP header

MSS = MTU – (The size of TCP header + The size of IP header + The size of IP Security header (if it is enabled))

To find the optimal MTU size open cmd by going to the search bar and entering “cmd”.

Enter the following command with any URL and packet size.

ping www.abc.com -f -l 1465

After pinging the cmd will give some output, it may look like the one below.

C:\Users\mkcbt>ping www.abc.com -f -l 1465
Pinging www.abc.com [144.248.91.9] with 1465 bytes of data:
Reply from 144.248.91.9: bytes=68 (sent 1465) time=54ms TTL=60
Reply from 144.248.91.9: bytes=68 (sent 1465) time=48ms TTL=60
Reply from 144.248.91.9: bytes=68 (sent 1465) time=43ms TTL=60
Reply from 144.248.91.9: bytes=68 (sent 1465) time=47ms TTL=60
Ping statistics for 144.248.91.9:
 Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
 Minimum = 43ms, Maximum = 54ms, Average = 48ms

As can be seen above the packets were not fragmented, so we’ll do it again by increasing the packet size.

C:\Users\mkcbt>ping www.abc.com -f -l 1472
Pinging www.abc.com [144.248.91.9] with 1472 bytes of data:
Reply from 144.248.91.9: bytes=68 (sent 1472) time=56ms TTL=60
Reply from 144.248.91.9: bytes=68 (sent 1472) time=41ms TTL=60
Reply from 144.248.91.9: bytes=68 (sent 1472) time=41ms TTL=60
Reply from 144.248.91.9: bytes=68 (sent 1472) time=42ms TTL=60
Ping statistics for 144.248.91.9:
 Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
 Minimum = 41ms, Maximum = 56ms, Average = 45ms

Again, we see no fragmentation so we’ll increase the size of the packet again.

C:\Users\mkcbt>ping www.abc.com -f -l 1473
Pinging www.abc.com [144.248.91.9] with 1473 bytes of data:
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Ping statistics for 144.248.91.9:
 Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

Here, we found that packet is fragmenting when its size is at 1473 bytes which means the maximum possible size (without any fragmentation) is 1472 bytes. But this is not the MTU value, to find it we will have to add 28 bytes for the header. So, the value of MTU = 1472 + 28 i.e., 1500 byte which is the optimum MTU value. MTU consists of a payload and TCP and IP headers of  20 Bytes each that is 40 bytes in total and they are compulsory for every packet, which leaves us with 1500 – 40 = 1460 bytes of data. 

Though if other protocols are in use the size might change. for example, if GRE is being used in the network then it will further add 24 bytes for its header which means now the total size of this packet will become 1460 + 40 + 24 = 1524 bytes which exceed the 1500 byte limit of MTU; thus, here we will have to decrease the value of MSS to around 1436 or below so that it does not exceed the total MTU value and that would be the optimal value of MTS.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!