Sunday, January 31, 2016

MTU, fragmentation and reassembly

Recently, I got the opportunity to work in a freshly built LTE/4G core and backhaul network. We observe a strange problem of the network where video traffic (RTSP/UDP) from UE devices in an APN were not reaching the video management servers. Although http or ftp traffic was passing through.
After hours of search, finally the problem was discovered in a one of the EPC component where it had a smaller MTU. Http traffic might have passed due to PMTUD.
Realizing the importance of MTU, let’s review this old school topic of networking.
MTU
The Maximum Transmission Unit (MTU) is the largest number of bytes in a single datagram can have on a particular data communications link.
Usually, in most Ethernet access networks it is 1500 bytes for IP packet.
At Layer 2, standard fame size is 1518 bytes, which includes additional header of 14 bytes and FCS of 4 bytes.
Other communication media types have different MTU size. Example: SONET/SDH has MTU of 4470 bytes.
https://habrastorage.org/getpro/habr/post_images/6c1/6da/135/6c16da13526de3dfd0368d31a5f1b6d9.jpg
Different type of encapsulation adds overhead.
  • GRE (IP Protocol 47) adds 24 bytes (20 byte IPv4 header, 4 byte GRE header)
  • MPLS adds 4 bytes for each label in the stack
  • IEEE 802.1Q tag adds 4 bytes (Q-in-Q would add 8 bytes)
  • VXLAN adds 50 bytes
  • OTV adds 42 bytes
  • IPsec encryption can add 52-76 bytes of overhead depending on transport or tunnel mode and the encryption/authentication algorithm
http://www.cisco.com/c/dam/en/us/td/i/000001-100000/80001-85000/81001-82000/81608.ps/_jcr_content/renditions/81608.jpg

Fragmentation
IP fragmentation involves breaking a datagram into a number of pieces that can be reassembled later.
Routers can fragment IPv4 packets unless the Do-Not-Fragment (DF) bit is set to 1 in the IPv4 header.
Identification, total length, fragment offset, “more fragments" and "don't fragment" flags in the IP header, are used for IP fragmentation and reassembly.
Fragmentation and reassembly of packets increase CPU and memory overhead.
pmtud_ipfrag_02.gif

MSS
Maximum segment size (MSS) is 40 bytes smaller than the MTU.
MSS = MTU – (IP Header + TCP header)
To assist in avoiding fragmentation between endpoints of TCP connection, MSS value is exchanged and lowest is set.
PMTUD
Path MTU Discovery (PMTUD) is used to avoid fragmentation in the path between the endpoints.
It is used to dynamically determine the lowest MTU of routers along the path from a packet's source to its destination.
PMTUD is only supported by TCP.

References