Course contentsShow
← Linux
Lesson 1516 of 1,81913. Containerization Primitives and NamespacesFree lesson

MTU Path Discovery and Fragmentation

Resolve performance issues caused by mismatched Maximum Transmission Units in tunnelled networks.

In this lesson, you will learn how to troubleshoot and resolve network performance bottlenecks caused by packet fragmentation in containerized overlay networks.

The MTU Mismatch Problem

When using overlay technologies like VXLAN, your network packets are encapsulated inside another set of headers. This adds overhead, meaning a standard 1500-byte Ethernet frame cannot hold a full 1500-byte payload. If a container sends a packet larger than the path's effective MTU, the system must either fragment the packet (splitting it into smaller pieces) or drop it entirely.

In high-performance container environments, fragmentation is a silent killer. It forces the CPU to perform expensive reassembly tasks, increases the likelihood of packet loss, and causes "black hole" connections where small packets (like handshakes) pass, but large payloads (like application data) hang indefinitely.

Identifying the Bottleneck

You can identify MTU-related drops by inspecting netstat -s or nstat for ICMP "Fragmentation Needed" messages. If you suspect an MTU issue, you can use ping with the "Don't Fragment" (DF) flag to probe the path:

# Probing with a 1450-byte packet and the DF flag enabled
ping -M do -s 1422 10.0.0.5

(Note: 1422 bytes + 28 bytes of headers = 1450 bytes)

If the ping fails, you know the path cannot handle a 1450-byte payload.

Resolving Performance Issues

The most efficient fix is to ensure the MTU is consistent across the entire stack. If your virtual bridge and veth pairs are set to 1500, but your VXLAN tunnel interface is set to 1450, you must lower the MTU of the container interfaces to match the tunnel:

# Adjusting MTU for a container interface
ip link set dev eth0 mtu 1450

By aligning the MTU, you stop the kernel from needing to fragment packets. This bypasses the reassembly overhead in the network stack, drastically improving throughput and reducing latency for your containerized services.

Key Takeaway: Always ensure your container interface MTU is smaller than the underlay physical interface MTU by the exact size of the encapsulation overhead to prevent fragmentation and packet loss.