MTU vs MSS

MTU stands for Maximum transfer unit, it is the largest data size in bytes that can be transferred by the physical port, it is different for each physical medium that we use, it is per port basis and cannot be negotiated.

Ethernet by default has the value of 1500 bytes, This means that a single frame passing the Ethernet medium can be of 1500 bytes of data, on top of this data payload (i.e data 1460 bytes + TCP header 20 bytes + IP header 20 bytes) further details like Ethernet headers of 14 bytes, Frame check sequence (FCS) 4 bytes gets added making it 1518 byes if this frame is carried over tagged connection then further 4 bytes for dot1Q gets added making the Frame 1522 bytes in size.
 

If for any reason the size of payload increases which results in increase of the Ethernet frame size then the device starts fragmenting the packets  i.e the source device will break the payload to fit the data into multiple Ethernet frames and the destination device will have to reassemble the fragmented frames.

MSS stands for Maximum segment size, this is the maximum amount of payload that TCP can use, this MSS values is the largest amount of data accepted by a host in a single TCP segment, this is used to set a limit on the data being transferred to prevent fragmentation and is sent in the SYN packet during the 3-way TCP handshake. The MSS value is not synchronized between host, it can be different for each direction
 

Below is the diagram showing different MTU fields


During  normal transmission , if there is no additional encapsulation (like GRE,IPsec, VxLAN and so forth) being carried out on a transiting network device, the source device may use the maximum payload length of 1460 bytes without any potential risk of packet fragmentation/drop. This is negotiated during the TCP three-way handshake stage between the source and destination host.

Below diagram shows the header when a router in transit is carrying out additional encapsulation, that is MPLS label swapping, this will add an additional label header which will eventually increase the size of the frame exiting a transiting router to 1508 bytes without Ethernet headers added.



How to resolve  MTU issues 

MTU issues can be resolved by taking two step approach as mentioned below

1. Set the ip mtu parameter of the interface to a lower size due to which thereis  sufficient free bytes available for additional headers used by mpls, the command "ip mtu 1488 " when set on a Cisco router interface will result in data size greater that 1488 to be fragmented which gives space for mpls headers to be added and transported ahead.

2. After setting ip mtu next step is to tell the router to intercept all tcp syn packets from the hosts and chnage the MSS value e.g "ip tcp adjust-mss 1408" this command needs to be configured on the router interface where the hosts are connected. this will make sure that the MSS value of 1408 are set for the SYN messages during the 3 way handshake for the hosts that are behind this router.

Hope this write-up is useful for you to solve some of the MTU related issues!

Comments

Popular posts from this blog

DNS Glue records

Reverse DNS Lookup