Implement PMTU Discovery on UDP Connection for VPN Tunnel

Abstract: Resolve VPN UDP packet drops and black holes by enabling Path MTU Discovery in Linux to prevent fragmentation.

Created: 2026-09-27 by
Implementing Path MTU Discovery (PMTUD) on a UDP-based VPN tunnel ensures optimal throughput by preventing packet fragmentation. This process allows the client to dynamically determine the maximum transmission unit size, avoiding black holes where oversized packets are silently dropped by intermediate routers. Proper configuration resolves connectivity issues and stabilizes high-bandwidth sessions.

Understanding PMTU Discovery in Linux

PMTU Discovery is a mechanism that allows a host to discover the smallest Maximum Transmission Unit (MTU) along the path to a destination. In the context of a VPN tunnel, which often adds encapsulation headers, the effective MTU is smaller than the underlying physical network interface. If packets exceed this limit and PMTUD is disabled, they may be fragmented or dropped entirely, leading to connection stalls.

Linux implements PMTUD through the net.ipv4.ip_no_pmtu_disc sysctl parameter. When set to 0 (the default), the kernel actively probes for the path MTU and adjusts its behavior accordingly. However, certain firewall rules or misconfigured networks can interfere with the necessary ICMP "Fragmentation Needed" messages required for this process to work correctly.

Verifying Current PMTU Settings

Before making changes, you should verify the current state of PMTUD on your system. You can check the global setting using the following command:

sysctl net.ipv4.ip_no_pmtu_disc

If the output is 0, PMTUD is enabled. If it returns 1, it is disabled, which can cause performance degradation. Additionally, you can inspect the routing cache to see if any MTU values have been cached for specific routes:

ip route show | grep mtu

This step is crucial because some VPN clients might override these settings locally. Ensure that your VPN software is not forcing a fixed MTU that bypasses the kernel's discovery mechanism.

Configuring PMTU Discovery Globally

To ensure consistent behavior across all connections, including your VPN tunnel, you can enable PMTUD globally via sysctl. Create or edit the file /etc/sysctl.d/99-pmtud.conf and add the following line:

net.ipv4.ip_no_pmtu_disc = 0

Apply the changes immediately without rebooting by running:

sysctl -p /etc/sysctl.d/99-pmtud.conf

This setting tells the Linux kernel to respect ICMP Fragmentation Needed messages. It is particularly important for UDP traffic, as UDP does not have built-in flow control like TCP. Without PMTUD, large UDP packets may be dropped by firewalls or routers that do not support fragmentation, resulting in silent data loss.

Adjusting MTU for the VPN Interface

While enabling PMTUD is essential, you must also ensure that the VPN interface itself is configured with an appropriate initial MTU. Most modern VPN protocols, such as WireGuard or OpenVPN, handle this automatically, but manual intervention may be required in complex setups.

For example, if you are using a custom script to bring up the interface, you might need to set the MTU explicitly. A common practice is to subtract 80 bytes from the physical interface's MTU to account for encapsulation overhead:

ip link set dev wg0 mtu 1420

This value assumes a standard Ethernet MTU of 1500 bytes. Adjust this number based on your specific network environment. For more details on managing network interfaces, refer to our guide on Ubuntu server network interfaces.

Troubleshooting Connectivity Issues

If you experience intermittent disconnections or slow transfers despite having PMTUD enabled, check your firewall rules. The kernel requires ICMP Type 3 Code 4 (Fragmentation Needed) packets to reach the source IP. Ensure that your firewall allows inbound ICMP messages of this type.

You can test PMTUD functionality by pinging a remote host with the -M do flag, which sets the Don't Fragment bit:

ping -M do -s 1472 remote_host

Start with a payload size of 1472 (which results in a 1500-byte packet including headers). If this fails, reduce the size by 10 until it succeeds. This helps identify the actual MTU of the path. For further assistance with VPN-specific connectivity problems, see our article on Troubleshooting WireGuard no access to remote.

Frequently Asked Questions

Why does my VPN drop packets when PMTUD is enabled?

This usually occurs because intermediate firewalls block ICMP "Fragmentation Needed" messages. Ensure that your firewall permits inbound ICMP Type 3 Code 4 traffic to allow the kernel to adjust the MTU dynamically.

Can I disable PMTUD to fix stability issues?

Disabling PMTUD by setting ip_no_pmtu_disc=1 forces the kernel to fragment packets, which can prevent drops but significantly reduces throughput. It is generally recommended to keep PMTUD enabled and instead fix the underlying network or firewall configuration.

How do I find the correct MTU for my VPN interface?

Use the ping command with the -M do flag and vary the payload size until you find the largest packet that reaches the destination. Subtract the header overhead from this size to determine the optimal MTU for your interface.

Does PMTUD work with IPv6 VPN tunnels?

Yes, IPv6 uses similar mechanisms called Path MTU Discovery. The relevant sysctl parameter is net.ipv6.ip_no_pmtu_disc. Ensure this is also set to 0 for consistent behavior across both protocol versions.

What happens if the path MTU changes after connection establishment?

The Linux kernel updates the cached MTU for the route whenever it receives an ICMP Fragmentation Needed message. Subsequent packets will then use the new, smaller MTU, ensuring continued connectivity without manual intervention.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More