Tune the Maximum transmission unit (MTU) to help reduce fragmentation, lower latency, and improve throughput across your network path.
MTU classifications
MTU types vary by network layer and use case.
Link-layer MTU
The maximum data payload size at the data link layer. In Ethernet, the MTU is typically 1500 bytes (excluding the Ethernet header). A standard Ethernet frame is 1518 bytes: destination MAC (6 bytes) + source MAC (6 bytes) + Type/Length (2 bytes) + Data payload (1500 bytes) + frame check sequence (4 bytes).
IP MTU
The largest packet the network layer can process, including the IP header and data payload but excluding the Ethernet frame header and trailer. In Alibaba Cloud, MTU usually refers to IP MTU.
With minimum IP and TCP header sizes (which can grow with options), the 1500-byte IP MTU breaks down to: IP header (20 bytes) + TCP header (20 bytes) + Data payload (1460 bytes).
Jumbo frame MTU
Jumbo frames expand the standard Ethernet frame to 9 KB. A jumbo frame includes a Layer 2 Ethernet header and a CRC field, which are not part of the IP MTU. Jumbo frames reduce packet count and improve efficiency. Alibaba Cloud supports jumbo frames up to 8500 bytes. See Jumbo frames.
Path Maximum Transmission Unit (PMTU)
The PMTU is the largest packet size that can traverse the entire path between two nodes without fragmentation. The path includes all devices and links (routers, vSwitches, communication links) from source to destination.
PMTUD dynamically discovers the PMTU on a path to avoid fragmentation. See Path MTU Discovery (PMTUD).
Factors that affect the MTU size
Several factors determine the MTU size.
Network devices: Routers and vSwitches have maximum MTU values determined by their hardware. The smallest MTU on a path limits all communication on that path.
Network type: Different network types have different MTU requirements. Wireless networks often use a smaller MTU because signal instability increases the risk of packet loss with large packets.
Transmission medium: Twisted-pair cables, optical fibers, and wireless media may impose different MTU limits.
Network protocol: Protocols define their own MTU. The standard Ethernet MTU is 1500 bytes.
Application requirements: Specific applications may require a non-standard MTU, which affects the overall network MTU.
How the MTU affects network performance
An incorrect MTU affects performance in the following ways:
Fragmentation and reassembly
When a packet crosses a network boundary with a smaller MTU, it splits into smaller fragments. These fragments must be reassembled at the destination. This adds latency, reduces efficiency, and increases processing load.
Reduced transmission efficiency
Fragmentation overhead lowers overall throughput. A lost fragment can incorrectly trigger TCP retransmission, further degrading performance.
Network congestion
A too-small MTU creates excessive fragments, increasing congestion. A larger MTU reduces packet count, decreasing congestion and improving throughput.
Set a consistent MTU across all devices on the path, as large as possible without exceeding any link's limit. This minimizes fragmentation and improves efficiency. For high-bandwidth scenarios such as video conferencing or large file transfers, tuning the MTU improves transmission quality.
View the MTU of an ECS network interface
All ECS instances default to an MTU of 1500 bytes. Instances with jumbo frames enabled support 8500 bytes. Connect to your instance and run the following commands to check the current NIC MTU.
View the MTU of a Windows instance
Sample operating system: Windows Server 2022.
Sample instance family: ecs.g8i.large.
Connect to the ECS instance.
Open Command Prompt or Windows PowerShell.
View the MTU of the current network interface:
netsh interface ipv4 show subinterfacesBefore you enable jumbo frames
The MTU of the primary NIC named Ethernet and the secondary Elastic Network Interface (ENI) named Ethernet 2 is 1500, which is the default value.
C:\Windows\system32>netsh interface ipv4 show subinterfaces MTU MediaSenseState Bytes In Bytes Out Interface ------ --------------- ---------- ---------- ------------- 4294967295 1 0 0 Loopback Pseudo-Interface 1 1500 1 15133287 1860371 Ethernet 1500 1 1519 3234 Ethernet 2After you enable jumbo frames
The MTU of the primary NIC named Ethernet and the secondary ENI named Ethernet 2 is 8500.
C:\Users\Administrator>netsh interface ipv4 show subinterfaces MTU MediaSenseState Bytes In Bytes Out Interface ------ --------------- --------- --------- ------------- 4294967295 1 0 0 Loopback Pseudo-Interface 1 8500 1 75314 1062294 Ethernet 8500 1 2386860 631043 Ethernet 2
View the MTU of a Linux instance
Sample operating system: Alibaba Cloud Linux 3.2.
Sample instance family: ecs.g8i.large.
Connect to the ECS instance.
View the MTU of the current network interface:
ip aBefore you enable jumbo frames
The MTU of the primary NIC eth0 and the secondary ENI eth1 is 1500, which is the default value.
[root@xxx ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:14:4d:09 brd ff:ff:ff:ff:ff:ff altname enp0s5 altname ens5 inet 172.17.0.139/24 brd 172.17.0.255 scope global dynamic noprefixroute eth0 valid_lft 315359999sec preferred_lft 315359999sec inet6 fe80::216:3eff:fe14:4d09/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:3f:f1:43 brd ff:ff:ff:ff:ff:ff altname enp0s7 altname ens7 inet 172.17.0.138/24 brd 172.17.0.255 scope global dynamic noprefixroute eth1 valid_lft 315359999sec preferred_lft 315359999sec inet6 fe80::24c1:8e90:7d8a:fc43/64 scope link noprefixroute valid_lft forever preferred_lft foreverAfter you enable jumbo frames
The MTU of the primary NIC eth0 and the secondary ENI eth1 is 8500.
[root@xxx ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:14:4d:09 brd ff:ff:ff:ff:ff:ff altname enp0s5 altname ens5 inet 172.17.0.139/24 brd 172.17.0.255 scope global dynamic noprefixroute eth0 valid_lft 315359996sec preferred_lft 315359996sec inet6 fe80::216:3eff:fe14:4d09/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 8500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:3f:f1:43 brd ff:ff:ff:ff:ff:ff altname enp0s7 altname ens7 inet 172.17.0.138/24 brd 172.17.0.255 scope global dynamic noprefixroute eth1 valid_lft 315359996sec preferred_lft 315359996sec inet6 fe80::24c1:8e90:7d8a:fc43/64 scope link noprefixroute valid_lft forever preferred_lft forever
Use the ping command to manually probe the PMTU
Manually probe the PMTU with the ping command:
This test may affect network communication. Perform it during off-peak hours.
Test method: Send a packet with the Don't Fragment (DF) flag set. Gradually increase the packet size until you receive an ICMP "Fragmentation needed and DF set" error. The packet size just before the error equals the PMTU minus the IP header (20 bytes) and ICMP header (8 bytes).
Test command: Test the MTU size of the network link:
ping -c 1 -M do -s [packet_size] [destination_address]Parameters:
-c 1: Send one packet.
-M do: Set the Don't Fragment (DF) flag.
-s [packet_size]: The ICMP PDU size. Start with a common value such as 1472.
NoteThe ping command uses ICMP over IP. The ICMP header is 8 bytes and the IP header is 20 bytes. So -s 1472 produces a total IP packet of 20 + 8 + 1472 = 1500 bytes.
Test example:
MTU information for hosts at both ends:
FROM: 172.17.0.127. Jumbo frames are enabled on the ECS instance (MTU = 8500 bytes). See Enable or disable jumbo frames.
TO: 172.17.0.128. The MTU is 1500.
Test: Send a packet of 8472 bytes (excluding IP and ICMP headers):
ping -c 1 -M do -s 8472 172.17.0.128Result: An ICMP error "Frag needed and DF set(mtu=1500)" is returned, indicating the packet exceeds the path MTU (1500 bytes). Because the DF flag is set, forwarding devices cannot fragment the packet, so it is dropped.
[root@ ~]# ping -c 1 -M do -s 8472 172.17.0.128 PING 172.17.0.128 (172.17.0.128) 8472(8500) bytes of data. From 172.17.0.253 icmp_seq=1 Frag needed and DF set (mtu = 1500) --- 172.17.0.128 ping statistics --- 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
Manually change the MTU of a network interface
Some networking services, such as VPN Gateway and traffic mirroring, require smaller packets from ECS instances. Change the ECS NIC MTU to meet these requirements.
Before you change the MTU, understand how a different MTU might affect network performance. An improper value can cause fragmentation and reduce efficiency.
The Linux MTU is obtained from the DHCP server automatically. If DHCP is active and you are not in a tunneling scenario (such as VPN Gateway), you typically do not need to manually change the NIC MTU.
For scenarios such as jumbo frames, follow the relevant best practices instead of manually changing the MTU. See Enable or disable jumbo frames.
Ensure the new MTU does not exceed the instance's maximum supported MTU. The maximum is 8500 bytes with jumbo frames enabled, or 1500 bytes when jumbo frames are disabled or unsupported.
The following example changes the MTU of an ECS NIC to 1399 bytes.
Windows instance
Sample operating system: Windows Server 2022.
Connect to the Windows instance.
Open Command Prompt or Windows PowerShell.
View the MTU of the Ethernet NIC:
netsh interface ipv4 show subinterfacesThe response shows the current MTU of the Ethernet NIC is 1500.
C:\Users\Administrator>netsh interface ipv4 show subinterfaces MTU MediaSenseState Bytes In Bytes Out Interface ------ --------------- ---------- ---------- ------------- 4294967295 1 0 0 Loopback Pseudo-Interface 1 1500 1 76093074 3922261 Ethernet 1500 1 943 3068 Ethernet 2Set the MTU of the Ethernet interface to 1399 permanently:
netsh interface ipv4 set subinterface "Ethernet" mtu=1399 store=persistent"Ok." confirms the command succeeded. If an error is returned, resolve it as prompted.
Verify the MTU of the Ethernet NIC. The change has taken effect.
C:\Users\Administrator>netsh interface ipv4 show subinterfaces MTU MediaSenseState Bytes In Bytes Out Interface ------ --------------- --------- --------- ------------- 4294967295 1 0 0 Loopback Pseudo-Interface 1 1399 1 76123457 4064932 Ethernet 1500 1 1099 3556 Ethernet 2
Linux instance
Sample operating system: Alibaba Cloud Linux 3.2.
Temporarily change the MTU using the ip command
This temporarily changes the NIC MTU. Restarting the network service or instance reverts the change.
Connect to the Linux instance.
View the current MTU of the NIC:
ip aThe primary NIC eth0 and secondary ENI eth1 both have an MTU of 1500.
[root@xxx ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:0e:de:c3 brd ff:ff:ff:ff:ff:ff altname enp1s3 inet 172.17.0.127/24 brd 172.17.0.255 scope global dynamic noprefixroute eth0 valid_lft 315359332sec preferred_lft 315359332sec inet6 fe80::216:3eff:fe0e:dec3/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:37:eb:bf brd ff:ff:ff:ff:ff:ff altname enp1s5 inet 172.17.0.122/24 brd 172.17.0.255 scope global dynamic noprefixroute eth1 valid_lft 315359332sec preferred_lft 315359332sec inet6 fe80::216:3eff:fe37:ebbf/64 scope link valid_lft forever preferred_lft foreverTemporarily change the MTU of eth1 to 1399:
sudo ip link set dev eth1 mtu 1399Verify the NIC information. The MTU of eth1 is now 1399.
[root@xxx ~]# sudo ip link set dev eth1 mtu 1399 [root@xxx ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:de:de:c3 brd ff:ff:ff:ff:ff:ff altname enp1s3 inet 172.17.0.127/24 brd 172.17.0.255 scope global dynamic noprefixroute eth0 valid_lft 315359127sec preferred_lft 315359127sec inet6 fe80::216:3eff:fede:dec3/64 scope link valid_lft forever preferred_lft forever 3: eth1 <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1399 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:37:eb:bf brd ff:ff:ff:ff:ff:ff altname enp1s5 inet 172.17.0.122/24 brd 172.17.0.255 scope global dynamic noprefixroute eth1 valid_lft 315359127sec preferred_lft 315359127sec inet6 fe80::216:3eff:fe37:ebbf/64 scope link valid_lft forever preferred_lft forever
Edit the network configuration file to make the change permanent
Edit the network configuration file to permanently change the MTU. Restart the network service or instance to apply.
The network configuration file varies based on the Linux distribution and version. In the following example, the Alibaba Cloud Linux 3.2 image, which is compatible with Red Hat Enterprise Linux (RHEL) and CentOS, is used.
If you attached a secondary ENI, such as eth1, and need to change its MTU, ensure the ENI is correctly configured. See Configure a secondary ENI.
Connect to the Linux instance.
View the current MTU of the NIC:
ip aThe MTU of the primary NIC eth0 and the secondary ENI eth1 is 1500.
[root@ ~]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:0e:de:c3 brd ff:ff:ff:ff:ff:ff altname enp1s3 inet 172.17.0.127/24 brd 172.17.0.255 scope global dynamic noprefixroute eth0 valid_lft 315359332sec preferred_lft 315359332sec inet6 fe80::216:3eff:fe0e:dec3/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:37:eb:bf brd ff:ff:ff:ff:ff:ff altname enp1s5 inet 172.17.0.122/24 brd 172.17.0.255 scope global dynamic noprefixroute eth1 valid_lft 315359332sec preferred_lft 315359332sec inet6 fe80::216:3eff:fe37:ebbf/64 scope link valid_lft forever preferred_lft foreverView the network interface configuration files:
ls /etc/sysconfig/network-scriptsThe response shows the configuration files for eth0 and eth1.
[root@xxx ~]# cd /etc/sysconfig/network-scripts/ [root@xxx network-scripts]# ls -l total 8 -rw-r--r-- 1 root root 170 Sep 19 10:11 ifcfg-eth0 -rw-r--r-- 1 root root 179 Sep 19 10:43 ifcfg-eth1Disable the network configuration feature of cloud-init:
sudo vim /etc/cloud/cloud.cfg.d/99-disable-network-config.cfgAdd the following line:
network: {config: disabled}Edit the network configuration file of eth1 and add the MTU setting:
sudo vi /etc/sysconfig/network-scripts/ifcfg-eth1Example file content after editing (add MTU=1399 at the end of the file):
# Created by cloud-init on instance boot automatically, do not edit. # BOOTPROTO=dhcp DEVICE=eth1 HWADDR=00:16:3e:37:eb:bf METRIC=200 ONBOOT=yes TYPE=Ethernet USERCTL=no MTU=1399Restart the network service to apply the configuration:
sudo systemctl restart NetworkManagerVerify the network interface information. The MTU of eth1 is now 1399.
[root@xxx network-scripts]# sudo systemctl restart NetworkManager [root@xxx network-scripts]# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:0e:de:c3 brd ff:ff:ff:ff:ff:ff altname enp1s3 inet 172.17.0.127/24 brd 172.17.0.255 scope global dynamic noprefixroute eth0 valid_lft 315359946sec preferred_lft 315359946sec inet6 fe80::216:3eff:fe0e:dec3/64 scope link valid_lft forever preferred_lft forever 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1399 qdisc mq state UP group default qlen 1000 link/ether 00:16:3e:37:eb:bf brd ff:ff:ff:ff:ff:ff altname enp1s5 inet 172.17.0.122/24 brd 172.17.0.255 scope global dynamic noprefixroute eth1 valid_lft 315359946sec preferred_lft 315359946sec inet6 fe80::216:3eff:fe37:ebbf/64 scope link valid_lft forever preferred_lft forever
MTU limits in practice
MTU limits for ECS-to-ECS communication
When an ECS instance that supports jumbo frames is the source, the maximum link MTU to the destination varies by scenario.
Destination host | Maximum allowed MTU |
An ECS instance with jumbo frames enabled in the same VPC or in a peered VPC in the same region | 8500 |
An ECS instance without jumbo frames enabled in the same VPC or in a peered VPC in the same region | 1500 |
Any ECS instance in a VPC connected through CEN | |
A host in an on-premises data center connected through Express Connect | |
An external host accessed through an EIP or public IP address |
See VPC peering connections and VPC connections.
MTU limits of Alibaba Cloud networking services
Note the MTU limits of networking services:
Within the Alibaba Cloud network, links default to 1500 bytes MTU. When communicating with ECS instances that do not support jumbo frames, note the MTU limits of network components such as VPN Gateway.
When using non-TCP protocols (such as UDP or ICMP) to access networking services, note the MTU limits of those services.
Most Alibaba Cloud services do not support jumbo frames. The following table shows MTU limits for some networking services.
Network Products | Maximum supported MTU | Description |
NAT Gateway | 1500 | None |
Server Load Balancer (including ALB, NLB, and CLB) | ALB and CLB do not forward fragmented packets. When using UDP or ICMP, packets from the source ECS instance must not exceed 1500 bytes. | |
Alibaba Cloud services (such as OSS and RDS) | Traffic passes through Server Load Balancer products. Note their limits. | |
Global Accelerator | None | |
Cloud Firewall | None | |
PrivateLink | None | |
VPN Gateway | 1399 |
Best practices for setting the MTU
Follow these practices to reduce fragmentation, lower latency, and increase throughput:
Determine a suitable MTU:
The default MTU for Ethernet is 1500 bytes. See MTU classifications.
Probe the PMTU with the ping command. See Use the ping command to manually probe the PMTU.
Enable and adapt to PMTUD: Enable PMTUD on your OS and network devices so the path MTU is discovered dynamically. Applications then reduce packet size in response to ICMP messages, avoiding fragmentation. See How PMTUD works.
Consider network device limits: Match the MTU on routers, vSwitches, and other network devices to the OS MTU to prevent fragmentation or packet drops.
Adapt to specific applications: Real-time applications such as VoIP and video conferencing may benefit from a smaller MTU to reduce latency.
Regularly monitor network performance: Track throughput, latency, and application performance to adjust the MTU as network conditions change.