The Maximum Transmission Unit (MTU) specifies the largest packet size (in bytes) that a network interface can transmit over a physical or virtual link without needing to fragment the packet into smaller segments. On standard Ethernet networks, the default MTU is 1,500 bytes. However, when configuring VPN tunnels (such as WireGuard or OpenVPN), VLAN tags, or high-throughput data centre fabrics supporting Jumbo Frames (9,000 bytes), an incorrect MTU causes packet fragmentation, dropped packets, and degraded network throughput.
Modern Linux distributions manage network links via the iproute2 suite. Using the ip link utility, you can inspect active MTU values, test for packet fragmentation, and adjust MTU settings both temporarily and persistently.
Step 1: Inspect Current MTU Values on Active Interfaces
Before modifying any parameters, query your Linux kernel to determine the active interface names and their configured MTU thresholds:
- Open your terminal and run the following command:
ip link show
- The output enumerates all local network interfaces. Look for the
mtuparameter within each interface header:
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
3: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/none
- In this example, physical interface
eth0uses the standard1500MTU, while virtual VPN tunnelwg0utilizes1420bytes to accommodate WireGuard encapsulation overhead.
Step 2: Test for MTU Fragmentation Using ping
To identify the optimal MTU for an external route without causing packet fragmentation, send ICMP echo packets with the “Don’t Fragment” (DF) bit set:
- Execute the
pingcommand with the-M doflag (which enforces the DF bit) and specify a test packet size with-s:
ping -M do -s 1472 -c 4 1.1.1.1
- Calculating packet size: Standard IP headers require 20 bytes and ICMP headers require 8 bytes (totaling 28 bytes). Thus, an MTU of 1,500 corresponds to a ping payload of 1,472 bytes (1500 – 28 = 1472).
- If the ping succeeds with zero packet loss, your connection supports the 1,500 MTU without fragmentation.
- If the terminal returns
ping: local error: message too long, mtu=1420, your packets are exceeding downstream router capabilities, confirming that you must lower your interface MTU.
Step 3: Temporarily Change Interface MTU with ip link
To immediately adjust the MTU of an interface (for example, changing eth0 to 1400 bytes to troubleshoot a misbehaving DSL or cellular connection):
- Execute the
ip link setcommand with elevated privileges:
sudo ip link set dev eth0 mtu 1400
- Verify the change immediately by running:
ip link show dev eth0
- The output confirms that the kernel updated the parameter:
eth0: ... mtu 1400. Network traffic immediately adapts to the new maximum packet ceiling without requiring an interface restart.
Step 4: Making MTU Changes Persistent Across Reboots
Changes made directly with ip link revert to defaults upon reboot. To make adjustments permanent, configure your distribution’s network manager:
On Ubuntu and Debian Using Netplan
- Open your active Netplan configuration file in a text editor:
sudo nano /etc/netplan/01-netcfg.yaml
- Add the
mtudirective beneath your interface definition:
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
mtu: 1400
- Save the file and apply the new configuration:
sudo netplan apply
On Red Hat, Fedora, and Rocky Linux Using NetworkManager
- Use
nmclito configure the connection profile:
sudo nmcli connection modify "System eth0" 802-3-ethernet.mtu 1400
sudo nmcli connection up "System eth0"