All Products
Search
Document Center

Elastic Compute Service:What is PMTUD

Last Updated:May 06, 2026

Path MTU Discovery (PMTUD) dynamically discovers the smallest MTU along a network path, enabling hosts to size packets to avoid IP fragmentation and reduce packet loss.

Benefits

PMTUD limits packet sizes to the PMTU, which improves network efficiency and reliability by avoiding fragmentation.

  • Avoidance of IP fragmentation: PMTUD keeps each packet within the MTU of every hop, preventing fragmentation that increases latency and packet loss. See Avoid IP fragmentation on TCP connections.

  • Improved network efficiency: PMTUD determines the optimal packet size, reducing header overhead and increasing throughput without exceeding any device's MTU.

  • Reduced packet loss and latency: Fragmentation requires retransmitting all fragments if any single one is lost. PMTUD avoids this overhead.

  • Automatic packet sizing: PMTUD lets the sending host dynamically resize packets based on the discovered PMTU, with no prior knowledge of network configuration required.

  • Improved network robustness: PMTUD adapts to various link types and configurations, improving network flexibility.

Supported components and systems

  • Operating systems: Most modern operating systems, including Linux and Windows, support PMTUD.

    Important

    Alibaba Cloud Elastic Compute Service (ECS) instances of the 6th-generation instance families or earlier, which do not support the Jumbo Frames feature, do not support PMTUD. Make sure that the size of the packets that pass through the ECS instances does not exceed 1,500 bytes.

  • Network devices: Some routers and switches have built-in PMTUD support. A device that does not support PMTUD may return an ICMP message without MTU information when it receives an oversized packet with the Don't Fragment (DF) flag set to 1.

  • Middleware or libraries: Some programming environments provide specialized libraries or middleware for PMTUD.

  • Applications: Some network applications implement their own PMTUD logic to dynamically resize outgoing packets.

  • Network protocols: PMTUD works with IPv4 and IPv6 transport layer protocols, including TCP, UDP, and ICMP.

  • Cloud service providers: Alibaba Cloud forwarding components perform PMTUD per RFC standards. See How PMTUD works.

How PMTUD works

The DF flag in IP packets plays a key role in PMTUD. Setting the DF flag to 1 prevents fragmentation. PMTUD uses ICMP messages to discover the PMTU between two hosts and limits packets to the PMTU, avoiding fragmentation during transmission.

  1. Set the DF flag on the sending host. The sending host sets the DF flag in the IP header to 1, preventing fragmentation on the network path.

  2. The MTU limit is hit. When the packet with DF=1 arrives at a network device whose MTU is smaller than the packet, the device drops the packet.

    • In IPv4, network devices check the DF flag. If DF=0 and the device supports fragmentation, it may fragment oversized packets instead of dropping them.

      Note

      Some Alibaba Cloud forwarding components, such as edge gateways in cross-domain or cross-region scenarios, do not support fragmentation. They drop oversized packets and send ICMP error messages even if DF=0.

    • In IPv6, PMTUD is mandatory. All hosts and routers must support it. The DF flag is implicitly set to 1 for all IPv6 packets.

  3. An ICMP error message is sent. If the device supports PMTUD, it sends an ICMP error message with its MTU to the sending host.

    • In IPv4, the device sends: Destination Unreachable: Fragmentation Needed and Don't Fragment was Set (Type 3, Code 4).

    • In IPv6, the device sends: ICMPv6 Packet Too Big (PTB) (Type 2, Code 0).

  4. Process the ICMP error message. The sending host parses and caches the PMTU from the message, then handles packets as follows:

    • By default, the OS kernel fragments the packet based on the PMTU and resends the fragments.

    • Application-level resizing. A PMTUD-aware application resizes packets based on the MTU in the ICMP error message and resends them. This avoids fragmentation but typically requires application modifications.

      Note

      For TCP connections, the TCP layer adjusts the MSS based on the discovered PMTU to avoid segment fragmentation. See Dynamically adapt MSS to PMTU during data transmission.

  5. Cache the PMTU. The sending host caches the PMTU in its route table for the destination IP address and limits subsequent packets to that size.

  6. Update the PMTU periodically. The PMTU may change when network paths change or route caches expire. The host re-runs PMTUD to update the PMTU.

Configure PMTUD

Enable PMTUD

Verify that all devices on the network support and have PMTUD enabled. On Linux, enable PMTUD by writing a zero to /proc/sys/net/ipv4/ip_no_pmtu_disc.

Note
  • Old kernel versions or specific operating systems may not support PMTUD. Devices that do not support PMTUD cannot process ICMP messages during PMTUD, causing it to fail.

  • Alibaba Cloud Elastic Compute Service (ECS) instances of the 6th-generation instance families or earlier, which do not support the Jumbo Frames feature, do not support PMTUD. Make sure that the size of the packets that pass through the ECS instances does not exceed 1,500 bytes.

  • If a device on the path does not support PMTUD, manually discover the PMTU. For example, run the ping command to discover the PMTU. Then adjust packet sizes or change the MTU of a network interface (NIC).

Ensure ICMP error messages reach the host

  • Check and configure firewalls and security devices to allow ICMP messages, especially Destination Unreachable: Fragmentation Needed (Type 3, Code 4). Blocked ICMP messages prevent PMTUD from working.

  • Configure security groups to allow ICMP traffic. ECS instances receive ICMP negotiation packets during PMTUD only if their security groups allow ICMP traffic. See Security group rules for controlling access to ECS instances by using specific protocols.

  • Check for network throttling. ICMP messages may be dropped when traffic hits the throttling threshold.

Modify applications to respond to ICMP messages

Modify applications to respond to ICMP error messages during PMTUD and reduce packet sizes based on the discovered PMTU.

Note
  • If an application does not adapt its packet size to the discovered PMTU after receiving an ICMP error message, the OS kernel may fragment the packets, which can cause transmission failures.

  • To resolve this, specify a smaller MSS in the application to match the PMTU.

Avoid IP fragmentation on TCP connections

TCP is a connection-oriented, reliable transport layer protocol that ensures data integrity and ordering. IP fragmentation can cause fragment loss or reassembly errors that affect TCP reliability. MSS negotiation and PMTUD help TCP connections avoid IP fragmentation.

Avoid IP fragmentation with MSS negotiation during connection establishment

MSS is a TCP parameter that specifies the largest data payload in a TCP segment, excluding the TCP header.

MSS negotiation occurs in the TCP/IP stack without user intervention. It ensures data segment sizes fit both endpoints' network environments, avoiding fragmentation from oversized packets or inefficiency from undersized ones.

MSS is negotiated during the TCP three-way handshake. The sending host includes the MSS option in the SYN packet. The MSS value equals the sending host's MTU minus the TCP header length. The receiving host determines an appropriate MSS based on its own MTU and returns it in the SYN-ACK packet. Both hosts then use the agreed MSS for the connection.

Dynamically adapt MSS to PMTU during data transmission

MSS negotiation does not guarantee that all intermediate devices have MTUs greater than or equal to the negotiated MSS. If a device on the path has a smaller MTU, IP fragmentation may still occur. Connectionless protocols such as UDP and ICMP lack MSS negotiation entirely. PMTUD addresses this by dynamically discovering the PMTU, allowing applications to adjust the MSS accordingly.