Enabling Enhanced Networking with the Elastic Network Adapter (ENA) on Linux Instances in a VPC
To prepare for enhanced networking with the ENA network adapter, set up your instance as follows:
Launch the instance from an HVM AMI using Linux kernel version of 3.2 or later. The latest Amazon Linux HVM AMIs have the modules required for enhanced networking installed and have the required attributes set. Therefore, if you launch an Amazon EBS–backed, enhanced networking–supported instance using a current Amazon Linux HVM AMI, ENA enhanced networking is already enabled for your instance.
Launch the instance in a VPC. (You can't enable enhanced networking if the instance is in EC2-Classic.)
Install and configure the AWS CLI on any computer you choose, preferably your local desktop or laptop. For more information, see Accessing Amazon EC2. Enhanced networking cannot be managed from the Amazon EC2 console.
If you have important data on the instance that you want to preserve, you should back that data up now by creating an AMI from your instance. Updating kernels and kernel modules, as well as enabling the
enaSupportattribute, may render incompatible instances or operating systems unreachable; if you have a recent backup, your data will still be retained if this happens.
Contents
Testing Whether Enhanced Networking with
ENA Is Enabled
To test whether enhanced networking with ENA is already
enabled, verify that the ena module
is installed on your instance and that
the enaSupport attribute is set. If
your instance satisfies these two conditions, then the ethtool -i
ethn command should show that the
module is in use on the network interface.
Kernel Module (ena)
To verify that the ena module is installed, use the
modinfo command as follows:
[ec2-user ~]$ modinfo ena
filename: /lib/modules/4.4.11-23.53.amzn1.x86_64/kernel/drivers/amazon/net/ena/ena.ko
version: 0.6.6
license: GPL
description: Elastic Network Adapter (ENA)
author: Amazon.com, Inc. or its affiliates
srcversion: 3141E47566402C79D6B8284
alias: pci:v00001D0Fd0000EC21sv*sd*bc*sc*i*
alias: pci:v00001D0Fd0000EC20sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00001EC2sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00000EC2sv*sd*bc*sc*i*
depends:
intree: Y
vermagic: 4.4.11-23.53.amzn1.x86_64 SMP mod_unload modversions
parm: debug:Debug level (0=none,...,16=all) (int)
parm: push_mode:Descriptor / header push mode (0=automatic,1=disable,3=enable)
0 - Automatically choose according to device capability (default)
1 - Don't push anything to device memory
3 - Push descriptors and header buffer to device memory (int)
parm: enable_wd:Enable keepalive watchdog (0=disable,1=enable,default=1) (int)
parm: enable_missing_tx_detection:Enable missing Tx completions. (default=1) (int)
parm: numa_node_override_array:Numa node override map
(array of int)
parm: numa_node_override:Enable/Disable numa node override (0=disable)
(int)In the above Amazon Linux case, the ena module is
installed.
ubuntu:~$ modinfo ena
ERROR: modinfo: could not find module enaIn the above Ubuntu instance, the module is not installed, so you must first install it. For more information, see Enabling Enhanced Networking with ENA on Ubuntu.
Instance Attribute (enaSupport)
To check whether an instance already has the enhanced networking
enaSupport attribute set, use the following
command:
describe-instances (AWS CLI)
$aws ec2 describe-instances --instance-idinstance_id--query Reservations[].Instances[].EnaSupportIf the
enaSupportattribute isn't set, the returned JSON is empty; otherwise, it is set as follows:[ true ]
Image Attribute (enaSupport)
To check whether an AMI already already has the enhanced networking
enaSupport attribute set, use the following
command:
describe-image-attribute (AWS CLI)
$aws ec2 describe-image-attribute --image-idami_id--attribute enaSupportNote
This command only works for images that you own. You receive an
AuthFailureerror for images that do not belong to your account.If the attribute isn't set,
EnaSupportis empty; otherwise, it is set as follows:{ "EnaSupport": { "Value": true }, "ImageId": "ami_id" }
Network Interface Driver
Use the following command to verify that the ena module is
being used on a particular interface, substituting the interface name that you
wish to check. If you are using a single interface (default), it will be
eth0.
[ec2-user ~]$ ethtool -i eth0
driver: vif
version:
firmware-version:
bus-info: vif-0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: noIn the above case, the ena module is not loaded,
because the listed driver is vif.
[ec2-user ~]$ ethtool -i eth0
driver: ena
version: 0.6.6
firmware-version:
bus-info: 0000:00:03.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: noIn this case, the ena module is loaded and at the
minimum recommended version. This instance has enhanced networking properly
configured.
Enabling Enhanced Networking with ENA on Amazon Linux
The latest Amazon Linux HVM AMIs have the module required for enhanced
networking with ENA installed and have the required enaSupport
attribute set. Therefore, if you launch an instance with the latest Amazon Linux HVM AMI on
a supported instance type, enhanced networking with ENA is already enabled for your
instance. For more information, see Testing Whether Enhanced Networking with
ENA Is Enabled.
If you launched your instance using an older Amazon Linux AMI and it does not have enhanced networking enabled already, use the following procedure to enable enhanced networking.
To enable enhanced networking with ENA
(EBS-backed instances)
From the instance, run the following command to update your instance with the newest kernel and kernel modules, including
ena:[ec2-user ~]$sudo yum updateFrom your local computer, reboot your instance using the Amazon EC2 console or the following command: reboot-instances (AWS CLI).
Connect to your instance again and verify that the
enamodule is installed and at the minimum recommended version using the modinfo ena command from Testing Whether Enhanced Networking withENAIs Enabled.From your local computer, stop the instance using the Amazon EC2 console or the following command: stop-instances (AWS CLI). If your instance is managed by AWS OpsWorks, you should stop the instance in the AWS OpsWorks console so that the instance state remains in sync.
Important
If you are using an instance store-backed instance, you can't stop the instance. Instead, proceed to To enable enhanced networking with ENA (instance store-backed instances).
From your local computer, enable the enhanced networking attribute using the following command.
Warning
Enhanced networking is supported only for HVM instances. Enabling enhanced networking with a PV instance can make it unreachable. Setting this attribute without the proper module or module version can also make your instance unreachable.
modify-instance-attribute (AWS CLI)
$aws ec2 modify-instance-attribute --instance-idinstance_id--ena-support
(Optional) Create an AMI from the instance, as described in Creating an Amazon EBS-Backed Linux AMI. The AMI inherits the enhanced networking
enaSupportattribute from the instance. Therefore, you can use this AMI to launch another instance with enhanced networking with ENA enabled by default.From your local computer, start the instance using the Amazon EC2 console or the following command: start-instances (AWS CLI). If your instance is managed by AWS OpsWorks, you should start the instance in the AWS OpsWorks console so that the instance state remains in sync.
Connect to your instance and verify that the
enamodule is installed and loaded on your network interface using the ethtool -i ethncommand from Testing Whether Enhanced Networking withENAIs Enabled.Note
If you are unable to connect to your instance after enabling enhanced networking with ENA, see Troubleshooting the Elastic Network Adapter (ENA).
To enable enhanced networking with ENA (instance store-backed instances)
If your instance is an instance store–backed instance, follow Step 1 through
Step 4 in the
previous procedure, and then create a new AMI as described in
Creating an Instance Store-Backed Linux AMI. Be sure
to enable the enhanced networking enaSupport attribute when
you register the AMI.
register-image (AWS CLI)
$aws ec2 register-image --ena-support ...
Enabling Enhanced Networking with ENA on Ubuntu
The following procedure provides the general steps that you'll take when enabling enhanced networking with ENA on an Ubuntu instance.
To enable enhanced networking with ENA on Ubuntu (EBS-backed instances)
Update the package cache and packages.
ubuntu:~$sudo apt-get update && sudo apt-get upgrade -yImportant
If during the update process you are prompted to install
grub, use/dev/xvdato installgrubonto, and then choose to keep the current version of/boot/grub/menu.lst.Install the
build-essentialpackages to compile the kernel module and thedkmspackage so that yourenamodule is rebuilt every time your kernel is updated.ubuntu:~$sudo apt-get install -y build-essential dkmsClone the source code for the
enamodule on your instance from GitHub at https://github.com/amzn/amzn-drivers.ubuntu:~$git clone https://github.com/amzn/amzn-driversMove the
amzn-driverspackage to the/usr/src/directory so dkms can find it and build it for each kernel update. Append the version number (you can find the current version number in the release notes) of the source code to the directory name. For example, version1.0.0is shown in the example below.ubuntu:~$sudo mv amzn-drivers /usr/src/amzn-drivers-1.0.0Create the dkms configuration file with the following values, substituting your version of
ena.Create the file.
ubuntu:~$sudo touch /usr/src/amzn-drivers-1.0.0/dkms.confEdit the file and add the following values.
ubuntu:~$sudo vim /usr/src/amzn-drivers-PACKAGE_NAME="ena" PACKAGE_VERSION="1.0.0/dkms.conf1.0.0" CLEAN="make -C kernel/linux/ena clean" MAKE="make -C kernel/linux/ena/ BUILD_KERNEL=${kernelver}" BUILT_MODULE_NAME[0]="ena" BUILT_MODULE_LOCATION="kernel/linux/ena" DEST_MODULE_LOCATION[0]="/updates" DEST_MODULE_NAME[0]="ena" AUTOINSTALL="yes"
Add, build, and install the
enamodule on your instance with dkms.Rebuild the
initramfsso the correct module is loaded at boot time.ubuntu:~$sudo update-initramfs -c -k allVerify that the
enamodule is installed using the modinfo ena command from Testing Whether Enhanced Networking withENAIs Enabled.ubuntu:~$modinfo enafilename: /lib/modules/3.13.0-74-generic/updates/dkms/ena.ko version: 1.0.0 license: GPL description: Elastic Network Adapter (ENA) author: Amazon.com, Inc. or its affiliates srcversion: 9693C876C54CA64AE48F0CA alias: pci:v00001D0Fd0000EC21sv*sd*bc*sc*i* alias: pci:v00001D0Fd0000EC20sv*sd*bc*sc*i* alias: pci:v00001D0Fd00001EC2sv*sd*bc*sc*i* alias: pci:v00001D0Fd00000EC2sv*sd*bc*sc*i* depends: vermagic: 3.13.0-74-generic SMP mod_unload modversions parm: debug:Debug level (0=none,...,16=all) (int) parm: push_mode:Descriptor / header push mode (0=automatic,1=disable,3=enable) 0 - Automatically choose according to device capability (default) 1 - Don't push anything to device memory 3 - Push descriptors and header buffer to device memory (int) parm: enable_wd:Enable keepalive watchdog (0=disable,1=enable,default=1) (int) parm: enable_missing_tx_detection:Enable missing Tx completions. (default=1) (int) parm: numa_node_override_array:Numa node override map (array of int) parm: numa_node_override:Enable/Disable numa node override (0=disable) (int)From your local computer, stop the instance using the Amazon EC2 console or the following command: stop-instances (AWS CLI). If your instance is managed by AWS OpsWorks, you should stop the instance in the AWS OpsWorks console so that the instance state remains in sync.
Important
If you are using an instance store-backed instance, you can't stop the instance. Instead, proceed to To enable enhanced networking with ENA on Ubuntu (instance store-backed instances).
From your local computer, enable the enhanced networking attribute using the following command.
Warning
Enhanced networking is supported only for HVM instances. Enabling enhanced networking with a PV instance can make it unreachable. Setting this attribute without the proper module or module version can also make your instance unreachable.
modify-instance-attribute (AWS CLI)
$aws ec2 modify-instance-attribute --instance-idinstance_id--ena-support
(Optional) Create an AMI from the instance, as described in Creating an Amazon EBS-Backed Linux AMI . The AMI inherits the enhanced networking attribute from the instance. Therefore, you can use this AMI to launch another instance with enhanced networking enabled by default.
From your local computer, start the instance using the Amazon EC2 console or the following command: start-instances (AWS CLI). If your instance is managed by AWS OpsWorks, you should start the instance in the AWS OpsWorks console so that the instance state remains in sync.
(Optional) Connect to your instance and verify that the module is installed.
Note
If you are unable to connect to your instance after enabling enhanced networking with ENA, see Troubleshooting the Elastic Network Adapter (ENA).
To enable enhanced networking with ENA on Ubuntu (instance store-backed instances)
If your instance is an instance store-backed instance, follow Step 1 through Step 9 in the previous
procedure, and then create a new AMI as described in Creating an Instance Store-Backed Linux
AMI. Be sure to enable the
enhanced networking enaSupport attribute when you register
the AMI.
Warning
Enhanced networking is supported only for HVM instances. Enabling enhanced networking with a PV instance can make it unreachable. Setting this attribute without the proper module or module version can also make your instance unreachable.
register-image (AWS CLI)
$aws ec2 register-image --ena-support ...
Enabling Enhanced Networking with ENA on Other Linux Distributions
The following procedure provides the general steps that you'll take when enabling enhanced networking with ENA on a Linux distribution other than Amazon Linux or Ubuntu. For more information, such as detailed syntax for commands, file locations, or package and tool support, see the specific documentation for your Linux distribution.
To enable enhanced networking with ENA on Linux (EBS-backed instances)
Clone the source code for the
enamodule on your instance from GitHub at https://github.com/amzn/amzn-drivers.ubuntu:~$git clone https://github.com/amzn/amzn-driversCompile and install the
enamodule on your instance.If your distribution supports dkms, then you should consider configuring dkms to recompile the
enamodule whenever your system's kernel is updated. If your distribution does not support dkms natively, you can find it in the EPEL repository (https://fedoraproject.org/wiki/EPEL) for Red Hat Enterprise Linux variants, or you can download the software at http://linux.dell.com/dkms/. Use Step 5 through Step 7 in To enable enhanced networking with ENA on Ubuntu (EBS-backed instances) for help configuring dkms.Run the sudo depmod command to update module dependencies.
Update the
initramfson your instance to ensure that the new module loads at boot time.Determine if your system uses predictable network interface names by default. Systems that use systemd or udev versions 197 or greater can rename Ethernet devices and they do not guarantee that a single network interface will be named
eth0. This behavior can cause problems connecting to your instance. For more information and to see other configuration options, see Predictable Network Interface Names on the freedesktop.org website.You can check the systemd or udev versions on RPM-based systems with the following command:
[ec2-user ~]$rpm -qa | grep -e '^systemd-[0-9]\+\|^udev-[0-9]\+'systemd-208-11.el7_0.2.x86_64In the above Red Hat 7 example, the systemd version is 208, so predictable network interface names must be disabled.
Disable predictable network interface names by adding the
net.ifnames=0option to theGRUB_CMDLINE_LINUXline in/etc/default/grub.[ec2-user ~]$sudo sed -i '/^GRUB\_CMDLINE\_LINUX/s/\"$/\ net\.ifnames\=0\"/' /etc/default/grubRebuild the grub configuration file.
[ec2-user ~]$sudo grub2-mkconfig -o /boot/grub2/grub.cfg
From your local computer, stop the instance using the Amazon EC2 console or the following command: stop-instances (AWS CLI). If your instance is managed by AWS OpsWorks, you should stop the instance in the AWS OpsWorks console so that the instance state remains in sync.
Important
If you are using an instance store-backed instance, you can't stop the instance. Instead, proceed to To enabled enhanced networking with ENA (instance store–backed instances)
From your local computer, enable the enhanced networking
enaSupportattribute using the following command.Warning
Enhanced networking is supported only for HVM instances. Enabling enhanced networking with a PV instance can make it unreachable. Setting this attribute without the proper module or module version can also make your instance unreachable.
modify-instance-attribute (AWS CLI)
$aws ec2 modify-instance-attribute --instance-idinstance_id--ena-support
(Optional) Create an AMI from the instance, as described in Creating an Amazon EBS-Backed Linux AMI . The AMI inherits the enhanced networking
enaSupprtattribute from the instance. Therefore, you can use this AMI to launch another instance with enhanced networking enabled by default.Important
If your instance operating system contains an
/etc/udev/rules.d/70-persistent-net.rulesfile, you must delete it before creating the AMI. This file contains the MAC address for the Ethernet adapter of the original instance. If another instance boots with this file, the operating system will be unable to find the device andeth0may fail, causing boot issues. This file is regenerated at the next boot cycle, and any instances launched from the AMI create their own version of the file.From your local computer, start the instance using the Amazon EC2 console or the following command: start-instances (AWS CLI). If your instance is managed by AWS OpsWorks, you should start the instance in the AWS OpsWorks console so that the instance state remains in sync.
(Optional) Connect to your instance and verify that the module is installed.
Note
If you are unable to connect to your instance after enabling enhanced networking with ENA, see Troubleshooting the Elastic Network Adapter (ENA).
To enabled enhanced networking with ENA (instance store–backed instances)
If your instance is an instance store–backed instance, follow the Step 1 through the Step 5 in the previous
procedure, and then create a new AMI as described in Creating an Instance Store-Backed Linux
AMI. Be sure to enable the
enhanced networking enaSupport attribute when you register
the AMI.
Warning
Enhanced networking is supported only for HVM instances. Enabling enhanced networking with a PV instance can make it unreachable. Setting this attribute without the proper module or module version can also make your instance unreachable.
register-image (AWS CLI)
$aws ec2 register-image --ena-support ...
Troubleshooting
For additional information about troubleshooting your ENA adapter, see Troubleshooting the Elastic Network Adapter (ENA).

