Set the MTU for your Amazon EC2 instances
The maximum transmission unit (MTU) of a network connection is the size, in bytes, of the largest permissible packet that can be passed over the connection. All Amazon EC2 instances support standard frames (1500 MTU) and all current generation instance types support jumbo frames (9001 MTU).
You can view the MTU for your Amazon EC2 instances, view the path MTU between your instance and another host, and configure your instances to use either standard or jumbo frames.
Tasks
Check the path MTU between two hosts
You can check the path MTU between your EC2 instance and another host. You can specify a DNS name or an IP address as the destination. If the destination is another EC2 instance, verify that its security group allows inbound UDP traffic.
The procedure that you use depends on the operating system of the instance.
Run the tracepath command on your instance to check the path MTU
between your EC2 instance and the specified destination. This command is part of the
iputils
package, which is available by default in many Linux
distributions.
This example checks the path MTU between the EC2 instance and amazon.com
.
[ec2-user ~]$
tracepathamazon.com
In this example output, the path MTU is 1500.
1?: [LOCALHOST] pmtu 9001 1: ip-172-31-16-1.us-west-1.compute.internal (172.31.16.1) 0.187ms pmtu 1500 1: no reply 2: no reply 3: no reply 4: 100.64.16.241 (100.64.16.241) 0.574ms 5: 72.21.222.221 (72.21.222.221) 84.447ms asymm 21 6: 205.251.229.97 (205.251.229.97) 79.970ms asymm 19 7: 72.21.222.194 (72.21.222.194) 96.546ms asymm 16 8: 72.21.222.239 (72.21.222.239) 79.244ms asymm 15 9: 205.251.225.73 (205.251.225.73) 91.867ms asymm 16 ... 31: no reply Too many hops: pmtu 1500 Resume: pmtu 1500
To check path MTU using mturoute
-
Download mturoute.exe to your EC2 instance from http://www.elifulkerson.com/projects/mturoute.php
. -
Open a Command Prompt window and change to the directory where you downloaded mturoute.exe.
-
Use the following command to check the path MTU between your EC2 instance and the specified destination. This example checks the path MTU between the EC2 instance and
www.elifulkerson.com
..\mturoute.exe
www.elifulkerson.com
In this example output, the path MTU is 1500.
* ICMP Fragmentation is not permitted. * * Speed optimization is enabled. * * Maximum payload is 10000 bytes. * + ICMP payload of 1472 bytes succeeded. - ICMP payload of 1473 bytes is too big. Path MTU: 1500 bytes.
Check the MTU for your instance
You can check the MTU value for your instance. Some instances are configured to use jumbo frames, and others are configured to use standard frame sizes.
The procedure that you use depends on the operating system of the instance.
To check the MTU setting on a Linux instance
Run the following ip command on your EC2 instance. If the
primary network interface is not eth0
, replace eth0
with your network interface.
[ec2-user ~]$
ip link showeth0
In this example output, mtu 9001
indicates that the
instance uses jumbo frames.
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP>
mtu 9001
qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000 link/ether 02:90:c0:b7:9e:d1 brd ff:ff:ff:ff:ff:ff
The procedure that you use depends on the driver on your instance.
Set the MTU for your instance
You might want to use jumbo frames for network traffic within your VPC and standard frames for internet traffic. Whatever your use case, we recommend that you verify that your instance behaves as expected.
The procedure that you use depends on the operating system of the instance.
To set the MTU value on a Linux instance
-
Run the following ip command on your instance. It sets the desired MTU value to 1500, but you could use 9001 instead.
[ec2-user ~]$
sudo ip link set deveth0
mtu1500
-
(Optional) To persist your network MTU setting after a reboot, modify the following configuration files, based on your operating system type.
-
For Amazon Linux 2, add the following line to the
/etc/sysconfig/network-scripts/ifcfg-
file:eth0
MTU=
1500
Add the following line to the
/etc/dhcp/dhclient.conf
file:request subnet-mask, broadcast-address, time-offset, routers, domain-name, domain-search, domain-name-servers, host-name, nis-domain, nis-servers, ntp-servers;
-
For Amazon Linux AMI, add the following lines to your
/etc/dhcp/dhclient-eth0.conf
file.interface "eth0" { supersede interface-mtu
1500
; } -
For other Linux distributions, consult their specific documentation.
-
-
(Optional) Reboot your instance and verify that the MTU setting is correct.
The procedure that you use depends on the driver on your instance.