> 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/bmc/cidr-block/bindcidrblockips.md).

# BindCidrBlockIps

## 1. 接口描述

本接口(BindCidrBlockIps)用于实例绑定一个或多个Cidr Block IP。

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

* 只有状态为 **AVAILABLE** 的Cidr Block才能操作。
* Cidr Block与实例的可用区需一致。
* 实例的状态需要是**RUNNING。**
* 本接口属于异步接口，即系统会先返回一个请求ID，但Cidr Block与实例并未绑定完成，系统后台的绑定任务仍在进行。您可以调用`DescribeCidrBlockIps`查询Cidr Block的绑定状态。
* 实例若单独绑定IPv6需要实例已绑定IPv4。
  {% endhint %}

## 2. 请求参数

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

| 参数名称        | 必选 | 类型                                                                                 | 描述                                                                         |
| ----------- | -- | ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| ipBindList  | 是  | Array of [IpBindParam](/api-reference/cn/compute/bmc/datastructure.md#ipbindparam) | 待绑定的IP参数列表。                                                                |
| cidrBlockId | 是  | String                                                                             | <p>待操作的Cidr Block ID。</p><p>可通过DescribeCidrBlocks接口返回值中的cidrBlockId获取。</p> |

## 3. 响应结果

| 参数名称      | 类型     | 描述                                                       |
| --------- | ------ | -------------------------------------------------------- |
| requestId | String | <p>唯一请求 ID。</p><p>每次请求都会返回。定位问题时需要提供该次请求的 requestId。</p> |

## 4. 代码示例

{% tabs %}
{% tab title="示例" %}
**1. 批量绑定IP**

```json
POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: BindCidrBlockIps
Request:
{
  "cidrBlockId": "cidrBlockId",
  "ipBindList": [
    {
      "instanceId": "instanceId1",
      "ip": "1111:1111:2:25::2"
    },
    {
      "instanceId": "instanceId2",
      "ip": "1.1.1.1"
    }
  ]
}
Response:
{
  "requestId": "T2979BBDB-5B06-444F-857E-93FEFE665C0D",
  "response": {
    "requestId": "T2979BBDB-5B06-444F-857E-93FEFE665C0D"
  }
}
```

{% 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状态码 | 错误码                                                   | 说明                      |
| ------- | ----------------------------------------------------- | ----------------------- |
| 403     | OPERATION\_DENIED\_SERVER\_NO\_IPV4                   | 指定的实例没有IPv4。            |
| 403     | OPERATION\_DENIED\_CIDRBLOCK\_IP\_COUNT\_REACH\_LIMIT | 已绑定的IP数量达到了上限。          |
| 403     | OPERATION\_DENIED\_DIFFERENT\_ZONE                    | Subnet与实例有不一致的可用区。      |
| 403     | OPERATION\_DENIED\_CIDRBLOCK\_RECYCLED                | 在回收站中的Cidr Block不支持该操作。 |
| 404     | INVALID\_CIDRBLOCK\_NOT\_FOUND                        | 指定的Cidr Block不存在。       |
| 403     | OPERATION\_DENIED\_INSTANCE\_NOT\_RUNNING             | 实例状态不是Running。          |
| 404     | INVALID\_INSTANCE\_NOT\_FOUND                         | 实例不存在。                  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/cn/compute/bmc/cidr-block/bindcidrblockips.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
