How do I install and activate the latest ENA driver for enhanced network support on an Amazon EC2 instance that runs RHEL?

5 minute read
1

I want to use the latest Elastic Network Adapter (ENA) driver for enhanced network support on a Red Hat Enterprise Linux (RHEL) Amazon Elastic Compute Cloud (Amazon EC2) instance.

Resolution

To install the latest ENA driver on your Amazon EC2 instance, refer to the section that applies to your version of RHEL. Some earlier versions of the RHEL operating system (OS) don't include an ENA driver. For Nitro instances, the ENA driver must change your EC2 instance type for network connectivity.

Note: Before you install or update an ENA driver, it's a best practice to create a snapshot of your instance.

For more information on how to update Linux drivers, see ENA Linux driver best practices and performance optimization guide on the GitHub website.

RHEL version 7.4 and later

The module for enhanced networking with an ENA is preinstalled on RHEL version 7.4 Amazon Machine Images (AMIs) and all later RHEL versions. For more information, see Activate enhanced networking with the Elastic Network Adapter (ENA) on Linux instances.

RHEL versions earlier 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.
    Note: When you stop an instance, data in instance store volumes are lost. For more information, see Determine the root device type of your instance. Be sure that you back up any data that you want to keep on an instance store volume.

  3. Run the following AWS Command Line Interface (AWS CLI) command:

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

    Note: If you receive errors when you run AWS CLI commands, see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version.

  4. Start the instance.

  5. Run the following command to validate that the ENA driver is loaded on the instance. Replace the eth0 default interface name with the name of the interface that you want to check. If your OS uses predictable network names, then the network name might be different.

    $ ethtool -i eth0

RHEL 6

Note: RHEL 6 doesn't include Amazon EC2 production-ready NVMe drivers, and you can't upgrade to NVME drivers. To use a Nitro-based instance, or any instance type with NVMe instance store volumes, upgrade to RHEL 7.4 or higher.

Download and install the ENA driver

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

    sudo yum upgrade kernel -y && sudo reboot
  2. Install the development package to build kernel modules that 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 module 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: When you're compiling and installing the ENA driver on your system, the version might be later than 2.2.11g.

    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 turn off network interface naming:

    sudo sed -i '/kernel/s/$/ net.ifnames=0/' /boot/grub/grub.conf
  7. Stop the instance. Then, activate enhanced network support at the instance level. The following example modifies the instance's attribute from the AWS CLI:

    aws ec2 modify-instance-attribute --instance-id i-xxxxxxxxxxxxxxxxx --ena-support --region xx-xxxxx-x
  8. Change the instance type to one of the ENA-supported instance types.

  9. Start the instance, use SSH to connect to the instance, and then run the ethtool command:

    ethtool -i eth0

    The following example output includes the ENA driver version:

    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 DKMS program to make sure that the driver is included in future kernel upgrades

Note: AWS and RHEL don't support software from the EPEL repository. If you use Dynamic Kernel Module Support (DKMS), then you void the support agreement for your subscription.

To configure the DKMS program:

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

    sudo yum install https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/epel-release-6-8.noarch.rpm -y

    Note: For a list of the most recent .rpm packages, see Extra Packages for Enterprise Linux (EPEL) on the Fedora Project 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. Create 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
AWS OFFICIAL
AWS OFFICIALUpdated 2 months ago