> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/cn/compute/zec/vnic/describenetworkinterfaces.md).

# DescribeNetworkInterfaces

## 1. 接口描述

本接口(DescribeNetworkInterfaces)用于查询一个或多个指定网卡的信息。用户可以根据 网卡ID、网卡名称等信息来搜索网卡信息。

{% hint style="info" %}
**注意事项**

* `publicIpList` 中，网段(Block)型 EIP 会展示为带掩码的完整 CIDR（如 `80.122.125.0/31`），单个地址型 EIP 仍展示为普通IP（如 `128.0.0.2`）。
  {% endhint %}

## 2. 请求参数

以下请求参数列表仅列出了接口中需要的请求参数

| 参数名称            | 必选 | 类型                                                                                | 描述                                                                                          |
| --------------- | -- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| nicIds          | 否  | Array of String                                                                   | <p>根据网卡ID过滤。</p><p>最多传入100个ID。</p>                                                          |
| name            | 否  | String                                                                            | <p>根据网卡所属的名称过滤。</p><p>该字段支持模糊搜索。</p>                                                        |
| regionId        | 否  | String                                                                            | 根据网卡所属的节点 ID过滤。                                                                             |
| vpcId           | 否  | String                                                                            | 根据网卡所属的VPC ID过滤。                                                                            |
| subnetId        | 否  | String                                                                            | 根据网卡所属的子网ID过滤。                                                                              |
| instanceId      | 否  | String                                                                            | 网卡关联的实例ID过滤。                                                                                |
| status          | 否  | [NicStatus](/api-reference/cn/compute/zec/datastructure.md#nicstatus)             | 根据网卡的状态过滤。                                                                                  |
| pageSize        | 否  | Integer                                                                           | <p>返回的分页大小。</p><p>可选值范围：\[1, 1000]</p>                                                      |
| pageNum         | 否  | Integer                                                                           | <p>返回的分页数。</p><p>可选值范围：\[1, +)</p><p>默认值：1</p>                                              |
| nicType         | 否  | [NicType](/api-reference/cn/compute/zec/datastructure.md#nictype)                 | 根据网卡的类型筛选过滤。                                                                                |
| resourceGroupId | 否  | String                                                                            | 根据网卡所属的资源组ID过滤。                                                                             |
| securityGroupId | 否  | String                                                                            | 根据网卡所属的安全组ID过滤。                                                                             |
| tagKeys         | 否  | Array of String                                                                   | <p>根据标签键进行搜索。</p><p>最长不得超过20个标签键。</p>                                                       |
| tags            | 否  | Array of [Tag](/api-reference/cn/compute/zec/datastructure.md#tag)                | <p>根据标签进行搜索。</p><p>最长不得超过20个标签。</p>                                                         |
| nicSubnetType   | 否  | [SubnetStackType](/api-reference/cn/compute/zec/datastructure.md#subnetstacktype) | <p>根据网卡堆栈类型筛选。</p><p>枚举值：IPv4 / IPv4\_IPv6 / IPv6。</p><p>配合subnetId使用可查出子网内持有IPv6的全部网卡。</p> |

## 3. 响应结果

| 参数名称       | 类型                                                                         | 描述                                                       |
| ---------- | -------------------------------------------------------------------------- | -------------------------------------------------------- |
| requestId  | String                                                                     | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |
| totalCount | Integer                                                                    | 符合条件的数据总数。                                               |
| dataSet    | Array of [NicInfo](/api-reference/cn/compute/zec/datastructure.md#nicinfo) | 网卡的结果集。                                                  |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 查询辅助网卡列表。**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeNetworkInterfaces
<Common Request Params>

Request：
{
  "nicType": "Secondary",
  "pageSize": 1,
  "pageNum": 1
}

Response：
{
  "requestId": "T33CFA599-AD4E-4B7E-9F56-A0D39857E91F",
  "response": {
      "requestId": "T33CFA599-AD4E-4B7E-9F56-A0D39857E91F",
      "totalCount": 1,
      "dataSet": [
          {
              "subnetId": "<subnetId>",
              "resourceGroup": {
                  "resourceGroupName": "Default Resource Group",
                  "resourceGroupId": "<resourceGroupId>"
              },
              "primaryIpv4": "10.130.0.2",
              "privateIpList": ["10.130.0.2","fd9c:d016:1eb2:2:0:2::2"],
              "nicSubnetType": "IPv4_IPv6",
              "updateTime": "2025-07-29T09:59:16Z",
              "primaryIpv6": "fd9c:d016:1eb2:2:0:2::2",
              "publicIpList": ["128.0.0.2","128.0.0.3"],
              "securityGroupId": "<securityGroupId>",
              "ipv6Cidr": "fd9c:d016:1eb2:2:0:2::/96",
              "macAddress": "52:54:xx:xx:xx:10",
              "instanceId": null,
              "regionId": "asia-east-1",
              "createTime": "2025-07-29T09:59:16Z",
              "nicType": "Secondary",
              "vpcId": "<vpcId>",
              "name": "Elastic-NIC-asia-east-1-1",
              "nicId": "1511370676722866275",
              "status": "AVAILABLE",
              "secondaryIpv4s": [],
              "tags":null
          }
      ]
  }
}
```

**2. 查询指定子网内持有IPv6的网卡列表（用于关闭子网IPv6前确认）。**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeNetworkInterfaces
<Common Request Params>

Request：
{
  "subnetId": "<subnetId>",
  "nicSubnetType": "IPv4_IPv6",
  "pageSize": 20,
  "pageNum": 1
}

Response：
{
  "requestId": "T33CFA599-AD4E-4B7E-9F56-A0D39857E91F",
  "response": {
      "requestId": "T33CFA599-AD4E-4B7E-9F56-A0D39857E91F",
      "totalCount": 1,
      "dataSet": [
          {
              "subnetId": "<subnetId>",
              "nicSubnetType": "IPv4_IPv6",
              "primaryIpv4": "10.130.0.2",
              "primaryIpv6": "fd9c:d016:1eb2:2:0:2::2",
              "nicId": "1511370676722866275",
              "status": "AVAILABLE"
          }
      ]
  }
}
```

{% endtab %}
{% endtabs %}

## 5. 开发者工具

Zenlayer Cloud API 2.0 提供了配套的[开发工具集（SDK）](/api-reference/cn/api-introduction/toolkit.md)，未来会陆续支持更多开发语言，方便快速接入和使用Zenlayer的产品和服务。

## 6. 错误码

下面包含业务逻辑中遇到的错误码，其他错误码见[公共错误码](/api-reference/cn/api-introduction/instruction/commonerrorcode.md)

| HTTP状态码 | 错误码 | 说明 |
| ------- | --- | -- |
