How do I install and enable the latest ENA driver for Enhanced Network Support on an Amazon EC2 instance running Red Hat 6/7?

Last updated: 2020-09-22

How do I install and enable the latest Elastic Network Adapter (ENA) driver for enhanced network support on an Amazon Elastic Compute Cloud (Amazon EC2) instance running Red Hat Enterprise Linux version 6 or 7?

Short description

Some earlier versions of the Red Hat Enterprise Linux operating system don't include an ENA driver. The ENA driver is required to change your EC2 instance type for network connectivity.

Resolution

RHEL 7.4 and later

RHEL 7.4 and later AMIs come preinstalled with the module needed for enhanced networking with ENA. For more information, see Enabling enhanced networking with the ENA on Linux instances.

RHEL 7 lower than 7.4

1.    Run the following command to upgrade the kernel to the latest version:

sudo yum upgrade kernel -y

2.    Stop the instance.

3.    Run the following command:

aws ec2 modify-instance-attribute --instance-id i-xxxxxxxxxxxxxxxxx --ena-support --region xx-xxxxx-x

RHEL 6

Note: This procedure is for earlier generation instance types that support ENA. This procedure isn't intended for migration to a Nitro-based instance type. RHEL 6 doesn't come with Amazon EC2 production-ready NVME drivers and you can't upgrade to NVME drivers separately. If you want to use a Nitro-based or any ENA interface instance type, upgrade to RHEL 7.4 or higher.

Download and install the ENA driver

1.    Update the kernel and reboot the system so that the latest kernel takes effect:

sudo yum upgrade kernel -y && sudo reboot

2.    Install the development package for building kernel modules to match the kernel:

sudo yum install kernel-devel-$(uname -r) gcc git patch rpm-build wget -y
cd /usr/src/
sudo wget https://github.com/amzn/amzn-drivers/archive/master.zip
sudo unzip master.zip
cd amzn-drivers-master/kernel/linux/ena
sudo make

3.    Copy the module to the modules directory:

sudo cp ena.ko /lib/modules/$(uname -r)/

4.    Regenerate the kernel module dependency map files:

sudo depmod

5.    Use the modinfo command to confirm that the ENA module is present:

modinfo ena

The modinfo command output shows the ENA driver information.

Note: The ENA driver version might be newer than 2.2.11g while you compile and install it on your system.

filename:       /lib/modules/2.6.32-754.33.1.el6.x86_64/ena.ko
version:        2.2.11g
license:        GPL
description:    Elastic Network Adapter (ENA)
author:         Amazon.com, Inc. or its affiliates
retpoline:      Y
srcversion:     17C7CD1CEAD3F0ADB3A5E5E
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*
alias:          pci:v00001D0Fd00000051sv*sd*bc*sc*i*
depends:        
vermagic:       2.6.32-754.33.1.el6.x86_64 SMP mod_unload modversions 
parm:           debug:Debug level (0=none,...,16=all) (int)
parm:           rx_queue_size:Rx queue size. The size should be a power of 2. Max value is 8K
 (int)
parm:           force_large_llq_header:Increases maximum supported header size in LLQ mode to 224 bytes, while reducing the maximum TX queue size by half.
 (int)
parm:           num_io_queues:Sets number of RX/TX queues to allocate to device. The maximum value depends on the device and number of online CPUs.
 (int)

6.    Append net.ifnames=0 to /boot/grub/grub.conf to disable network interface naming:

sudo sed -i '/^kernel/s/$/ net.ifnames=0/' /boot/grub/grub.conf

7.    Stop the instance.

8.    Enable enhanced network support at the instance level. The following example modifies the instance's attribute from the AWS Command Line Interface (AWS CLI).

Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.

aws ec2 modify-instance-attribute --instance-id i-xxxxxxxxxxxxxxxxx --ena-support --region xx-xxxxx-x

9.    Change the instance type to one of the ENA supported instance types.

10.    Start the instance, connect to the instance using SSH, and then run the ethtool command:

ethtool -i eth0

The output includes the ENA driver version, as shown in the following example:

driver: ena
version: 2.2.11g
firmware-version: 
bus-info: 0000:00:05.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

Configure the Dynamic Kernel Module Support (DKMS) program to make sure that the driver is included during future kernel upgrades

Keep the following in mind:

  • Software from the EPEL repository is not supported by Red Hat or AWS.
  • Using DKMS voids the support agreement for your subscription.

1.    Install the following Red Hat Package Manager (rpm) file:

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm -y

Note: For a list of the most recent .rpm packages, refer to the EPEL - Fedora Project Wiki website.

2.    Run the install command:

sudo yum install dkms -y

3.    Detect the current version:

VER=$( grep ^VERSION /usr/src/amzn-drivers-master/kernel/linux/rpm/Makefile | cut -d' ' -f2 )

4.    Copy the source files into the source directory:

sudo cp -a /usr/src/amzn-drivers-master /usr/src/amzn-drivers-${VER}

5.    Generate the DKMS config file and build and install the ENA module:

sudo cat <<EOM | sudo tee /usr/src/amzn-drivers-${VER}/dkms.conf
PACKAGE_NAME="ena"
PACKAGE_VERSION="$VER"
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"
EOM

sudo dkms add -m amzn-drivers -v $VER
sudo dkms build -m amzn-drivers -v $VER
sudo dkms install -m amzn-drivers -v $VER

Did this article help?


Do you need billing or technical support?