Queries the details of one or more elastic network interfaces (ENIs).

Description

The DescribeNetworkInterfaces operation supports paged queries. During a paged query, when you call the DescribeNetworkInterfaces operation to retrieve the first page of results, set MaxResults to limit the maximum number of entries to return in the call. The return value of NextToken is a pagination token, which can be used in the next call to retrieve a new page of results. When you call the DescribeNetworkInterfaces operation to retrieve a new page of results, set NextToken to the NextToken value returned in the previous call and set MaxResults to limit the maximum number of entries to return in this call.

Note If you specify MaxResults or NextToken, the system uses the preceding paged query method to return results. If you specify neither of MaxResults and NextToken, the system returns paginated results based on the PageNumber and PageSize parameters.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesDescribeNetworkInterfaces

The operation that you want to perform. Set the value to DescribeNetworkInterfaces.

RegionIdStringYescn-hangzhou

The region ID of the ENI. You can call the DescribeRegions operation to query the most recent region list.

Tag.N.KeyStringNoTestKey

The key of tag N of the ENI. Valid values of N: 1 to 20.

Tag.N.ValueStringNoTestValue

The value of tag N of the ENI. Valid values of N: 1 to 20.

If a single tag is specified to query ENIs, up to 1,000 ENIs that have this tag added can be displayed in the response. If multiple tags are specified to query ENIs, up to 1,000 ENIs that have all these tags added can be displayed in the response. To query more than 1,000 ENIs that have specified tags added, call the ListTagResources operation.

ResourceGroupIdStringNorg-bp67acfmxazb4p****

The ID of the resource group. If this parameter is specified to query ENIs, up to 1,000 ENIs that belong to the specified resource group can be displayed in the response.

Note ENIs in the default resource group are displayed in the response regardless of how this parameter is set.
VSwitchIdStringNovsw-bp16usj2p27htro3****

The ID of the vSwitch to which the ENI is connected.

VpcIdStringNovpc-bp1j7w3gc1cexjqd****

The ID of the virtual private cloud (VPC) to which the ENI belongs.

PrimaryIpAddressStringNo192.168.**.**

The primary private IPv4 address of the ENI.

SecurityGroupIdStringNosg-bp144yr32sx6ndw****

The ID of the security group to which the secondary ENI belongs.

  • To query the details of secondary ENIs based on the ID of a security group, specify this parameter.
  • To query the details of primary ENIs based on the ID of a security group, call the DescribeInstances operation with the SecurityGroupId parameter specified.
NetworkInterfaceNameStringNotest-eni-name

The name of the ENI.

TypeStringNoSecondary

The type of the ENI. Valid values:

  • Primary
  • Secondary

This parameter is empty by default, which indicates that both primary and secondary ENIs are queried.

InstanceIdStringNoi-bp1e2l6djkndyuli****

The ID of the instance to which the ENI is attached.

ServiceManagedBooleanNotrue

Specifies whether the user of the ENI is an Alibaba Cloud service or a distributor.

StatusStringNoAvailable

The state of the ENI. Valid values:

  • Available: The ENI is not attached to an instance.
  • Attaching: The ENI is being attached to an instance.
  • InUse: The ENI is attached to an instance.
  • Detaching: The ENI is being detached from an instance.
  • Deleting: The ENI is being deleted.

This parameter is empty by default, which indicates that ENIs in all states are queried.

PageNumberIntegerNo1

The number of the page to return.

Page start from page 1.

Default value: 1.

Note This parameter will be removed in the future. We recommend that you use the NextToken and MaxResults parameters for a paged query.
PageSizeIntegerNo100

The number of entries to return on each page.

Maximum value: 1,000.

Default value: 10.

Note This parameter will be removed in the future. We recommend that you use the NextToken and MaxResults parameters for a paged query.
NextTokenStringNoAAAAAdDWBF2****

The query token. Set the value to the NextToken value returned in the last call to the DescribeNetworkInterfaces operation.

For more information about how to check the responses returned by this operation, see the preceding "Description" section.

MaxResultsIntegerNo50

The maximum number of entries to return on each page. Valid values: 10 to 500.

Default value:

  • If this parameter is not specified or if this parameter is set to a value less than 10, the default value is 10.
  • If this parameter is set to a value greater than 500, the default value is 500.
PrivateIpAddress.NStringNo192.168.**.**

Secondary private IPv4 address N of the ENI. Valid values of N: 1 to 100.

NetworkInterfaceId.NStringNoeni-bp125p95hhdhn3ot****

The ID of ENI N. Valid values of N: 1 to 100.

Ipv6Address.NStringNo2408:4321:180:1701:94c7:bc38:3bfa:****

IPv6 address N of the ENI. Valid values of N: 1 to 100.

Response parameters

ParameterTypeExampleDescription
NextTokenStringAAAAAdDWBF2****

The query token returned in this call.

PageSizeInteger1

The number of entries returned per page.

Note This parameter will be removed in the future. We recommend that you use the NextToken and MaxResults parameters for a paged query.
PageNumberInteger1

The page number of the returned page.

Note This parameter will be removed in the future. We recommend that you use the NextToken and MaxResults parameters for a paged query.
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

TotalCountInteger2

The total number of ENIs returned.

Note If you specify the MaxResults and NextToken parameters to perform a paged query, the value of the TotalCount response parameter is invalid.
NetworkInterfaceSetsArray of NetworkInterfaceSet

Details about the ENIs.

NetworkInterfaceSet
CreationTimeString2019-12-25T12:31:31Z

The time when the ENI was created.

VpcIdStringvpc-bp1j7w3gc1cexjqd****

The ID of the VPC to which the ENI belongs.

TypeStringSecondary

The type of the ENI.

StatusStringAvailable

The state of the ENI.

NetworkInterfaceTrafficModeStringStandard

The communication mode of the ENI. Valid values:

  • Standard: The TCP communication mode is used.
  • HighPerformance: Elastic RDMA Interface (ERI) is enabled and the remote direct memory access (RDMA) communication mode is used.
    Note This parameter can have a value of HighPerformance only when the ENI is attached to a c7re RDMA-enhanced instance that resides in Beijing Zone K.
NetworkInterfaceNameStringmy-eni-name

The name of the ENI.

MacAddressString00:16:3e:12:**:**

The media access control (MAC) address of the ENI.

QueuePairNumberInteger0
Note This parameter is in invitational preview and unavailable for general users.
NetworkInterfaceIdStringeni-bp125p95hhdhn3ot****

The ID of the ENI.

ServiceIDLong12345678910

The ID of the distributor to which the ENI belongs.

InstanceIdStringi-bp1e2l6djkndyuli****

The ID of the instance to which the ENI is attached.

Note If the ENI that is managed and controlled by other Alibaba Cloud services, no instance ID is returned.
OwnerIdString123456****

The ID of the account to which the ENI belongs.

ServiceManagedBooleantrue

Indicates whether the user of the ENI is an Alibaba Cloud service or a distributor.

VSwitchIdStringvsw-bp16usj2p27htro3****

The ID of the vSwitch.

DescriptionStringDescriptionTest

The description of the ENI.

ResourceGroupIdStringrg-2ze88m67qx5z****

The ID of the resource group to which the ENI belongs.

ZoneIdStringcn-hangzhou-e

The zone ID of the ENI.

PrivateIpAddressString172.17.**.**

The private IP address of the ENI.

QueueNumberInteger8

The number of queues supported by the ENI.

  • If the ENI is a secondary ENI in the InUse (InUse) state and the number of queues supported by the ENI has never been modified, the default number of queues per secondary ENI that the instance type supports is returned.
  • If the number of queues supported by the secondary ENI has been modified, the new number of queues is returned.
  • If the ENI is a secondary ENI in the Available (Available) state and the number of queues supported by the ENI has never been modified, an empty value is returned.
  • If the ENI is a primary ENI, the default number of queues per primary ENI that the instance type supports is returned.
PrivateIpSetsArray of PrivateIpSet

Details about the private IP addresses.

PrivateIpSet
PrivateIpAddressString172.17.**.**

The private IP address of the instance to which the ENI is attached.

PrimaryBooleantrue

Indicates whether the IP address is the primary private IP address. Valid values:

  • true: The IP address is the primary private IP address.
  • false: The IP address is a secondary private IP address.
AssociatedPublicIpObject

Details about the elastic IP address (EIP) associated with the ENI.

PublicIpAddressString116.62.**.**

The EIP.

AllocationIdStringnull
Note This parameter is in invitational preview and unavailable for general users.
Ipv6SetsArray of Ipv6Set

The IPv6 addresses assigned to the ENI.

Ipv6Set
Ipv6AddressString2408:4321:180:1701:94c7:bc38:3bfa:****

The IPv6 address assigned to the ENI.

Ipv4PrefixSetsArray of Ipv4PrefixSet
Note This parameter is in invitational preview and unavailable for general users.
Ipv4PrefixSet
Ipv4PrefixStringhide
Note This parameter is in invitational preview and unavailable for general users.
Ipv6PrefixSetsArray of Ipv6PrefixSet
Note This parameter is in invitational preview and unavailable for general users.
Ipv6PrefixSet
Ipv6PrefixStringhide
Note This parameter is in invitational preview and unavailable for general users.
TagsArray of Tag

The tags of the ENI.

Tag
TagValueStringTestValue

The tag value of the ENI.

TagKeyStringTestKey

The tag key of the ENI.

SecurityGroupIdsArray of Stringsg-bp18kz60mefsicfg****

The IDs of the security groups to which the ENI belongs.

AssociatedPublicIpObject

The EIP associated with the secondary private IP address of the ENI.

PublicIpAddressString116.62.**.**

The EIP.

AllocationIdStringnull
Note This parameter is in invitational preview and unavailable for general users.
AttachmentObject
Note This parameter is in invitational preview and unavailable for general users.
DeviceIndexInteger0
Note This parameter is in invitational preview and unavailable for general users.
InstanceIdStringnull
Note This parameter is in invitational preview and unavailable for general users.
TrunkNetworkInterfaceIdStringnull
Note This parameter is in invitational preview and unavailable for general users.
NetworkCardIndexInteger0

The index of the physical network interface controller (NIC).

  • If the ENI is in the Available (Available) state or if no physical NIC index was specified when the ENI was attached, this parameter has no value.
  • If the ENI is in the InUse (InUse) state and a physical NIC index was specified when the ENI was attached, the specified NIC index is returned as the value of this parameter.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribeNetworkInterfaces
&RegionId=cn-hangzhou
&PrivateIpAddress.1=192.168.**.**
&PrivateIpAddress.2=192.168.**.**
&NextToken=AAAAAdDWBF2****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeNetworkInterfacesResponse>
    <TotalCount>2</TotalCount>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
    <PageSize>1</PageSize>
    <NextToken>AAAAAdDWBF2****</NextToken>
    <PageNumber>1</PageNumber>
    <NetworkInterfaceSets>
        <NetworkInterfaceSet>
            <Status>Available</Status>
            <NetworkInterfaceTrafficMode>Standard</NetworkInterfaceTrafficMode>
            <ServiceManaged>false</ServiceManaged>
            <PrivateIpAddress>172.17.**.**</PrivateIpAddress>
            <ZoneId>cn-hangzhou-e</ZoneId>
            <ResourceGroupId>rg-aek2boynwys****</ResourceGroupId>
            <InstanceId>i-wz91t9p4j9xsw2pn****</InstanceId>
            <VSwitchId>vsw-bp16usj2p27htro3****</VSwitchId>
            <NetworkInterfaceId>eni-bp125p95hhdhn3ot****</NetworkInterfaceId>
            <MacAddress>00:16:3e:12:**:**</MacAddress>
            <SecurityGroupIds>
                <SecurityGroupId>sg-bp18kz60mefsicfg****</SecurityGroupId>
            </SecurityGroupIds>
            <Type>Secondary</Type>
            <Ipv6Sets>
                <Ipv6Set>
                    <Ipv6Address>2408:4321:180:1701:94c7:bc38:3bfa:****</Ipv6Address>
                </Ipv6Set>
            </Ipv6Sets>
            <VpcId>vpc-bp1j7w3gc1cexjqd****</VpcId>
            <OwnerId>123456****</OwnerId>
            <NetworkInterfaceName>my-eni-name</NetworkInterfaceName>
            <AssociatedPublicIp/>
            <CreationTime>2019-12-25T12:31:31Z</CreationTime>
            <Tags>
                <Tag>
                    <TagKey>TestKey</TagKey>
                    <TagValue>TestValue</TagValue>
                </Tag>
            </Tags>
            <PrivateIpSets>
                <PrivateIpSet>
                    <PrivateIpAddress>172.17.**.**</PrivateIpAddress>
                    <AssociatedPublicIp/>
                    <Primary>true</Primary>
                </PrivateIpSet>
            </PrivateIpSets>
        </NetworkInterfaceSet>
    </NetworkInterfaceSets>
</DescribeNetworkInterfacesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TotalCount" : 2,
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "PageSize" : 1,
  "NextToken" : "AAAAAdDWBF2****",
  "PageNumber" : 1,
  "NetworkInterfaceSets" : {
    "NetworkInterfaceSet" : [ {
      "Status" : "Available",
      "NetworkInterfaceTrafficMode" : "Standard",
      "ServiceManaged" : false,
      "PrivateIpAddress" : "172.17.**.**",
      "ZoneId" : "cn-hangzhou-e",
      "ResourceGroupId" : "rg-aek2boynwys****",
      "InstanceId" : "i-wz91t9p4j9xsw2pn****",
      "VSwitchId" : "vsw-bp16usj2p27htro3****",
      "NetworkInterfaceId" : "eni-bp125p95hhdhn3ot****",
      "MacAddress" : "00:16:3e:12:**:**",
      "SecurityGroupIds" : {
        "SecurityGroupId" : [ "sg-bp18kz60mefsicfg****" ]
      },
      "Type" : "Secondary",
      "Ipv6Sets" : {
        "Ipv6Set" : [ {
          "Ipv6Address" : "2408:4321:180:1701:94c7:bc38:3bfa:****"
        } ]
      },
      "VpcId" : "vpc-bp1j7w3gc1cexjqd****",
      "OwnerId" : "123456****",
      "NetworkInterfaceName" : "my-eni-name",
      "AssociatedPublicIp" : { },
      "CreationTime" : "2019-12-25T12:31:31Z",
      "Tags" : {
        "Tag" : [ {
          "TagKey" : "TestKey",
          "TagValue" : "TestValue"
        } ]
      },
      "PrivateIpSets" : {
        "PrivateIpSet" : [ {
          "PrivateIpAddress" : "172.17.**.**",
          "AssociatedPublicIp" : { },
          "Primary" : true
        } ]
      }
    } ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400MissingParameter%sThe error message returned because a required parameter is not specified.
400UnsupportedParameter%sThe error message returned because a specified parameter is not supported.
400InvalidParameter%sThe error message returned because a specified parameter is invalid.
400InvalidInstanceID.Malformed%sThe error message returned because the specified InstanceId parameter is invalid.
400InvalidOperation.InvalidEcsState%sThe error message returned because the operation is not supported while the instance is in the current state.
400InvalidOperation.InvalidEniState%sThe error message returned because the operation is not supported while the ENI is in the current state.
400InvalidOperation.DetachPrimaryEniNotAllowed%sThe error message returned because the primary ENI cannot be detached from the instance.
400Forbidden.RegionId%sThe error message returned because the service is unavailable in the current region.
400InvalidRegionId.MalFormedThe specified parameter RegionId is not valid.The error message returned because the specified RegionId parameter is invalid.
403InvalidUserType.NotSupported%sThe error message returned because your account does not support the operation.
403Abs.InvalidAccount.NotFound%sThe error message returned because your Alibaba Cloud account does not exist or because your AccessKey pair has expired.
403Forbidden.NotSupportRAM%sThe error message returned because Resource Access Management (RAM) users are not authorized to perform this operation.
403Forbidden.SubUser%sThe error message returned because you are not authorized to manage this resource. Contact the owner of the Alibaba Cloud account for authorization.
403MaxEniCountExceeded%sThe error message returned because the maximum number of ENIs that can be managed has been reached.
403EniPerInstanceLimitExceeded%sThe error message returned because the maximum number of ENIs that can be attached to the specified instance has been reached.
403InvalidOperation.AvailabilityZoneMismatch%sThe error message returned because the operation is invalid.
403InvalidOperation.VpcMismatch%sThe error message returned because the operation is invalid. Check whether the VPC in the operation corresponds to other parameters.
403SecurityGroupInstanceLimitExceed%sThe error message returned because the maximum number of instances in the security group has been reached.
403InvalidSecurityGroupId.NotVpc%sThe error message returned because the specified SecurityGroupId parameter is invalid and the network type of the security group is not VPC.
403InvalidOperation.InvalidEniType%sThe error message returned because the operation is not supported while the ENI is of the current type.
403InvalidVpc.Empty%sThe error message returned because no vSwitches exist in the specified VPC. For more information, see the return value of the %s placeholder in the error message.
404InvalidEcsId.NotFound%sThe error message returned because the specified instance ID does not exist.
404InvalidEniId.NotFound%sThe error message returned because the specified ENI ID does not exist.
404InvalidVSwitchId.NotFound%sThe error message returned because the specified vSwitch does not exist.
404InvalidSecurityGroupId.NotFound%sThe error message returned because the specified security group ID does not exist.

For a list of error codes, see Service error codes.