Generally adding additional interfaces to Centos and Rhel instances can be time consuming. An easier way to achieve this is by installing the ec2-net-utils package on the instance. The package however isnt available from the repo’s which means we will need to copy it over from another instance by doing the following:

  • Launch an Amazon linux 2 instance
  • Update the instance using the following command:
  • $ sudo yum update -y
  • Once updated, make sure the ec2-net-utils package is installed by running the following command:
  • $ yum list installed | grep ec2-net-utils
  • ec2-net-utils.noarch 1.2-2.1.amzn2 @amzn2-core
  • Next we need to download the rpm for the package using yum downloader:
  • $ sudo yumdownloader ec2-net-utils
  • Once downloaded, you will see the following rpm: ec2-net-utils-1.3-1.amzn2.noarch.rpm
  • Now that we have the rpm, we need to copy it over to the rhel or centos instance we would like to add additional interfaces to. You can do this with any ftp client however I have used the scp command as seen here:
  • $ scp -i keys/mykey.pem /home/ec2-user/ec2-net-utils-1.3-1.amzn2.noarch.rpm ec2-user@10.0.0.11:/home/ec2-user/
  • Once transferred, connect to the rhel or centos instance via ssh and verify the rpm is available:

$ cat /etc/system-release
Red Hat Enterprise Linux Server release 7.8 Beta (Maipo)

$ ls
ec2-net-utils-1.3-1.amzn2.noarch.rpm

Install the rpm:

$ yum install ec2-net-utils-1.3-1.amzn2.noarch.rpm

Once installed, using the AWS Management console, add the additional ENI’s and reboot the instance. once rebooted, the ENI’s should show:

$ ifconfig
eth0: flags=4163 mtu 9001
inet 10.0.0.78 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::12:60ff:fea5:bc04 prefixlen 64 scopeid 0x20
ether 02:12:60:a5:bc:04 txqueuelen 1000 (Ethernet)
RX packets 433 bytes 52536 (51.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 574 bytes 59755 (58.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=4163 mtu 9001
inet 10.0.0.181 netmask 255.255.255.0 broadcast 10.0.0.255
inet6 fe80::a4:aaff:fe39:8f6c prefixlen 64 scopeid 0x20
ether 02:a4:aa:39:8f:6c txqueuelen 1000 (Ethernet)
RX packets 7 bytes 700 (700.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 14 bytes 1364 (1.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 96 bytes 8872 (8.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 96 bytes 8872 (8.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

PLEASE NOTE, after installing the above rpm, whenever adding another eni you will need to reboot the instance. Rebooting the network alone is not enough for the change to reflect.

Leave a Reply

Your email address will not be published. Required fields are marked *