Course contentsShow
← Linux
Lesson 1099 of 1,81910. Network Administration and Kernel StacksFree lesson

MTU and Path MTU Discovery

Resolve packet fragmentation and throughput degradation by tuning MTU settings.

In this lesson, you will learn how to optimize network throughput and prevent packet loss by managing the Maximum Transmission Unit (MTU) and leveraging Path MTU Discovery (PMTUD).

Understanding the MTU

The MTU defines the largest physical packet size (in bytes) that a network interface can transmit without needing to fragment the data. For standard Ethernet, this is typically 1500 bytes. If a packet exceeds the MTU of any link in its path, it must be fragmented—chopped into smaller pieces—or dropped. Fragmentation adds significant CPU overhead and increases the risk of packet loss, which degrades throughput.

Path MTU Discovery (PMTUD)

In a modern network, packets travel across multiple hops, each potentially having a different MTU. PMTUD is a mechanism where the kernel determines the smallest MTU along the entire path between the source and destination. It does this by setting the "Don't Fragment" (DF) flag in the IP header of outbound packets. If a router along the way encounters a packet larger than its own MTU, it drops the packet and sends an ICMP "Fragmentation Needed" message back to the host. The Linux kernel then adjusts its transmission size accordingly.

Tuning the MTU

You can check and modify your interface settings using the ip command. To view your current MTU:

ip link show eth0

If you identify performance issues due to fragmentation—often seen in VPN tunnels or encapsulated traffic (like VXLAN) where headers eat into your payload—you might need to reduce the MTU to accommodate the extra overhead:

sudo ip link set dev eth0 mtu 1400

Dealing with "Black Holes"

Sometimes, network firewalls are configured to block ICMP traffic, preventing the "Fragmentation Needed" message from reaching the host. This causes the sender to wait indefinitely for an acknowledgment, leading to "PMTU Black Holes." If you encounter connectivity issues where small packets work but large ones hang, you may need to force a lower MTU or ensure your firewall permits necessary ICMP type 3, code 4 packets.

Key Takeaway: Properly aligning your MTU to the path limit eliminates unnecessary fragmentation and prevents performance-killing black hole scenarios.