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

Some earlier versions of the Red Hat Enterprise Linux operating system don't include an ENA driver. The ENA driver is needed to change your Amazon Elastic Compute Cloud (Amazon EC2) instance type for network connectivity.

Note: RHEL version 7.4 and higher has an older version of the ENA driver preinstalled. Run this procedure if you want the latest ENA network driver.

1.    Download and install the ENA driver:

sudo -i    # Become root. The rest of the steps assume that they are being run by root user.
yum install kernel-devel-$(uname -r) gcc git patch rpm-build wget
wget https://github.com/amzn/amzn-drivers/archive/master.zip
unzip master.zip
cd amzn-drivers-master/kernel/linux/ena
make
cp ena.ko /lib/modules/$(uname -r)/                          # Copy the module to the modules directory    
insmod ena.ko                                                # Insert the module to validate it loads successfully
depmod                                                       # Regenerate kernel module dependency map files
echo 'add_drivers+=" ena "' >> /etc/dracut.conf.d/ena.conf   # Append once                         
dracut -f -v                                                 # Generate the new initrd image
lsinitrd /boot/initramfs-xxx.el6.x86_64.img | grep ena.ko    # Validate that the initramfs image contains the ena driver

The output from the lsinitrd command should contain the driver location lib/modules/..../ena.ko. Confirm that the ena.ko is present in the initramfs to make sure that the ENA driver will get initialized at boot.

Note: If the make command gives a "kcompat.h:219:27: error: net/busy_poll.h: No such file or directory" error, then upgrade the kernel, reboot, and re-run the ENA installation commands from the beginning:

yum upgrade kernel && reboot

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

Install one of the following Red Hat Package Manager (rpm) files:

RHEL 6

yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

RHEL 7

yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

3.    Install the DKMS:

yum install dkms

VER=$( grep ^VERSION /root/amzn-drivers-master/kernel/linux/rpm/Makefile | cut -d' ' -f2 )   # Detect current version

sudo cp -a /root/amzn-drivers-master /usr/src/amzn-drivers-${VER}   # Copy source into the source directory.

cat > /usr/src/amzn-drivers-${VER}/dkms.conf <<EOM                  # Generate the dkms config file.
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

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

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

modinfo ena

5.    Append net.ifnames=0 to the boot file to disable network interface naming.

RHEL 6

Append net.ifnames=0 to the kernel line in the /boot/grup/menu.lst file.

vi /boot/grub/menu.lst

RHEL 7

Append net.ifnames=0 to GRUB_CMDLINE_LINUX in the /etc/default/grub file as shown in the following example:

GRUB_CMDLINE_LINUX="selinux=0 console=tty0 crashkernel=auto console=ttyS0,115200 nvme_core.io_timeout=4294967295 net.ifnames=0"

You can also use the sed command:

sudo sed -i '/^GRUB\_CMDLINE\_LINUX/s/\"$/\ net\.ifnames\=0\"/' /etc/default/grub

Then, regenerate the configuration files for grub2:

grub2-mkconfig -o /boot/grub2/grub.cfg 

6.    Run "poweroff" to stop the instance from an SSH terminal, or stop the instance using the AWS Command Line Interface (AWS CLI) or Amazon EC2 Console.

7.    Enable Enhanced Network support at the instance level. The following example modifies the instance's attribute from AWS CLI:

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

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

9.    Start the instance, SSH into the instance, and run the ethtool command:

ethtool -i eth0

The output should include the ENA driver version.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2019-03-21