Elastic Network Interfaces (ENIs) are virtual network interfaces that enable network connectivity and IP address assignment for ECS instances within Virtual Private Clouds (VPCs). Each ECS instance can be associated with one or more ENIs, which support multiple IP configurations and can be migrated between ECS instances within the same VPC and zone. This flexibility and scalability cater to various business network requirements, such as creating multi-IP address, multi-NIC, or high-availability networks.
Types of elastic network interfaces
Alibaba Cloud offers the following types of network interfaces:
-
Primary Network Interface
The default network interface for each instance in a VPC is known as the primary network interface. Each instance is equipped with a single primary network interface.
-
Secondary Elastic Network Interface
-
In scenarios with a single primary network interface, all network traffic is routed through this interface, suitable for simple traffic patterns. For more complex network segmentation and isolation, or to mitigate the risk of a single point of failure, secondary ENIs can be created and attached within the same VPC and zone to expand the network capabilities of an ECS instance.
-
Secondary ENIs are independently creatable network interfaces that can be dynamically attached or detached from instances in addition to the primary network interface.
For detailed instructions, see Create and Use Elastic Network Interfaces.
-
Features of elastic network interfaces
-
Support for Multiple IP Addresses: An ENI can be associated with several private IP addresses, enabling a single ECS instance to serve or access external resources through various IPs, thus enhancing network flexibility. For more information, see Secondary Private IP Addresses.
-
Release with Instance Feature: When creating an ENI or afterwards, you can enable or disable the release with instance feature to determine whether the ENI should be retained or released along with the instance.
NoteENIs that are retained upon instance release can be reattached as a primary or secondary ENI when creating a new instance.
-
Hot Swapping: The hot swapping capability of secondary elastic network interfaces (ENIs) offers significant flexibility and convenience. It allows dynamic addition or removal of secondary ENIs while the ECS instance is operational, without the need to reboot the server or disrupt ongoing services. For instance, you can detach a secondary ENI from one instance and bind it to another within the same VPC and zone, all without having to restart the instance.
NoteThe primary network interface cannot be detached from the instance and does not support hot swapping.
-
Certain instance types support network interface hot swapping. For more information, see Instance Families.
-
For ECS instance types that do not support hot swapping:
-
Secondary ENIs cannot be added during instance creation but can be attached after the instance is created.
-
The instance must be in the Stopped state to bind or unbind secondary ENIs.
-
-
Limits
-
ENIs are provided at no cost, but there is a limit to the number of ENIs that can be created by a single Alibaba Cloud account. For more information, see ENI Quotas.
-
Instances and their bound ENIs must be in the same VPC and zone.
-
Multiple ENIs attached to an instance can be from different subnets within the same VPC and zone.
-
If two or more network interfaces from the same subnet are attached to an instance, network issues such as asymmetric routing may occur. Assigning one or more secondary private IP addresses to an ENI can optimize the utilization of VPC-type ECS instances and manage traffic in case of load failure. For more information, see Secondary Private IP Addresses.
-
-
The number of network interfaces that can be attached to each instance depends on the instance type. For more details, see Instance Families under Elastic Network Interfaces.
-
Attaching multiple network interfaces to an instance does not increase the instance's network bandwidth. For more information, see Network Bandwidth.
Important attributes of elastic network interfaces
By attaching ENIs, ECS instances gain resources such as private IP addresses and Elastic IP Addresses (EIPs) for communication with the Internet or other cloud resources. Key attributes of ENIs include the following:
-
Virtual Private Cloud (VPC): ENIs can only be attached to instances within the same VPC. Once created, the VPC of an ENI cannot be changed.
-
vSwitch: Each VPC has its own IP address range, and multiple vSwitches can be created to segment subnets. Subnets within the same VPC are interconnected by default. When an ENI is associated with a vSwitch, it receives one or more IP addresses from that subnet. ENIs and their instances must be in the same zone but can connect to different vSwitches.
-
MAC Address: Each ENI has a unique MAC address that serves as its identifier.
You can view details such as the VPC and MAC address of the network interface through the console or API. For more information, see View or Modify ENI Attributes.
-
Assign One or More Private IP Addresses for Private Network Communication: By default, each ENI is assigned a primary private IPv4 address within its subnet.
-
For multi-IP requirements in scenarios such as multi-application, failover, and load balancing, you can assign additional secondary private IPv4 addresses to an ENI. For more information, see Add Secondary Private IP Addresses to ENIs.
-
For IPv6 public and private network communication, you can assign IPv6 addresses to the ENI of an instance in a VPC and vSwitch with an IPv6 CIDR block. For more information, see IPv6 Communication.
-
-
Bind Static Public IP or Elastic IP Address (EIP) for Public Network Communication: By themselves, ENIs do not have public network communication capabilities. Public network communication can be achieved by:
-
Assigning a static public IP to the instance for public network communication. For more information, see Static Public IP.
-
Binding an EIP to an ENI for flexible public network communication. By binding an EIP to multiple private IP addresses of an ENI, an ECS instance can provide multiple public IPs. For more information, see Bind EIP to ENI.
-
-
Security Group: ENIs are linked to security groups for network-layer security control.
-
Associating an ECS instance with a security group effectively associates the instance's primary network interface with the security group. For more information, see Associate a Security Group with an Instance (Primary Network Interface).
-
Within the same VPC, a secondary network interface can be associated with a different security group than the primary network interface. For more information, see Associate a Security Group with a Secondary Network Interface.
-
-
Route Table: A route table is necessary for data packet path selection within a VPC and to other networks. Proper routing configuration is crucial for ENIs to send and receive data correctly. For more information, see Configure Routing.
NoteIn a multi-network interface environment, the default route of a secondary network interface usually has a lower priority than that of the primary network interface. This means that data is sent from the primary network interface by default. To ensure data packets corresponding to the private IP of a secondary network interface are sent from that interface, you can configure policy-based routing for the secondary network interface.
Network enhancement features of elastic network interfaces
Elastic RDMA capability
ENIs support the addition of elastic RDMA interfaces, enabling low-latency and high-throughput network communication on ECS instances that support elastic RDMA. For more information, see Elastic RDMA Network Interfaces (ERI).
Multi-queue network interface
NIC multi-queue enables the configuration of multiple send and receive queues on a network interface, with each queue processed by different CPU cores. Its primary goal is to enhance network I/O throughput and minimize latency by engaging multiple CPU cores in the simultaneous processing of network packets.
For more information, see the Multi-queue network interface document.
Network card mapping
To enhance network performance, certain instance types offer network card mapping. This feature allows you to designate a specific physical network card index when attaching an elastic network interface to an instance, thereby binding the ENI to distinct underlying communication channels to optimize bandwidth utilization and enhance the instance's network throughput.
For additional details, please refer to Network Card Mapping.
View elastic network interfaces of ECS instances
You can view information about the ENIs bound to an instance through the ECS console or directly within the instance.
View in the console
-
Log on to the ECS console.
-
In the left-side navigation pane, select
. -
In the upper-left corner of the page, select the resource group and region where the target resources reside.
-
Click the target instance ID to go to the instance details page.
-
Click the Elastic Network Interfaces tab to view the list of ENIs for the instance.
You can see information such as the ID, name, type, status, and IP address of the ENIs in the list:
View through API
You can call DescribeInstances to query detailed information about the target instances specified by InstanceIds. The returned NetworkInterfaces are the collection of ENIs bound to the instances, including the network interface type Type, network interface ID NetworkInterfaceId, and primary private IP address PrimaryIpAddress.
View within the instance
Linux instances
Sample operating system: Alibaba Cloud Linux 3.2.
-
Connect to the Linux instance remotely.
For specific operations, see Log on to a Linux Instance Using the Workbench Tool over SSH.
-
Execute the following command to view the network interface information of the instance.
ip a
The output displays the network interface information of the current instance:
-
Network interface identifiers: eth0, eth1. In this example, the instance has two ENIs, one primary network interface eth0 and one secondary ENI eth1.
-
Network interface status: state UP indicates that the network interface is active and functioning properly within the instance.
If the network interface is not functioning correctly, you may see state DOWN. In such cases, you need to Configure the Secondary ENI.
-
Primary private IP address of the network interface: The primary private IP address of each ENI is displayed. If a secondary private IP address is assigned but not recognized by the operating system, refer to Configure the Operating System to Recognize Secondary Private IP Addresses for reconfiguration.
-
-
Execute the following command to view the routing information of the network interface.
route -n
Two routes are configured for the secondary ENI eth1:
-
Route with Destination 0.0.0.0: This default route handles packets destined for external or remote networks. Packets not within the local subnet are sent to the gateway address for forwarding.
The default route of an additional network interface typically has a lower priority than that of the primary network interface. To direct data packets from the secondary network interface, refer to (Conditionally Required) Step 4: Configure Routing.
-
Route with Destination 192.168.xx.xx: This subnet-specific route ensures direct communication with other hosts within the subnet without an additional router.
-
Windows instances
Sample operating system: Windows Server 2022.
-
Connect to the Windows instance remotely.
For specific operations, see Log on to a Windows Instance Using the Workbench Tool over RDP.
-
Open the Network and Sharing Center.
-
Click Change Adapter Settings.
This example shows two ENIs (one primary and one secondary) bound to the instance, indicating they are active and properly configured.
If the secondary ENI is not recognized, refer to Troubleshoot ENI Configuration Failure on Windows Instances.
-
View the network interface status and detailed information.
-
Double-click the network interface name to view its status.
For the primary network interface Ethernet, the following information is displayed:
-
Click Details to view the network interface properties.
The dialog box shows details such as the primary private IPv4 address, subnet mask, and default gateway:
-
-
Open the Command Prompt page.
Use the keyboard shortcut Win+R to open the Run dialog box, type cmd, and click OK.
-
Execute the following command to view the routing information of the network interface.
References
-
The Terway network plug-in facilitates network address management and pod communication within Kubernetes clusters. It allows for the implementation of access policies between containers using standard Kubernetes network policies and offers both VPC mode, utilizing ENIs, and inclusive ENI mode, using secondary IP addresses of ENIs. You can select the mode that best suits your needs for intra-cluster communication. For more information, see Using the Terway network plug-in.
-
ENIs can be paired with Server Load Balancers, such as ELB, to manage and distribute network traffic effectively. For more information, see Adding backend servers through ENIs.
-
Certain Alibaba Cloud services, including Container Service for Kubernetes (ACK) and NAT Gateway, rely on ENI capabilities to deliver their services. You can grant the cloud product system permission to manage the lifecycle of ENIs created for these products, safeguarding against unintended modifications and ensuring service availability. For more information, see Managed ENIs.
-
To bind ENIs to ECS instances outside the VPC CIDR block range, you must add a CIDR block to the VPC, create a vSwitch within this new CIDR block in the same zone as the ECS instance, and then create and attach ENIs under that vSwitch to the instance. For more information, see Expanding VPC address space with additional CIDR blocks.