Batch Adding Secondary IP Addresses for Primary Network Interface Card
Updated at:2025-10-20
API description
This API is used to batch add secondary IPs to the primary network interface cards, requiring a virtual machine reboot to take effect.
Request structure
Plain Text
1PUT /v{version}/instance/batchAddIp?clientToken={clientToken} HTTP/1.1
2Host: bcc.bj.baidubce.com
3Authorization: authorization string
4{
5 "instanceId": instanceId,
6 "secondaryPrivateIpAddressCount": secondaryPrivateIpAddressCount,
7 "privateIps":[
8 privateIps
9 ],
10 "allocateMultiIpv6Addr":true
11}
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| version | String | Yes | URL parameter | API version number. |
| clientToken | String | Yes | Query | Idempotence Token, which is an ASCII string with a length not exceeding 64 bits. For details, see the [Idempotence ](BCC/API Reference/General Description.md#Idempotence). |
| instanceId | String | Yes | RequestBody | Virtual machine ID |
| secondaryPrivateIpAddressCount | int | No | RequestBody | Count of IPV6/IPV4 to be added. Either this or privateIps must exist |
| privateIps | List | No | RequestBody | IPV6/IPV4 addresses to be added. Either this or secondaryPrivateIpAddressCount must exist |
| allocateMultiIpv6Addr | boolean | Yes | RequestBody | Whether to allocate IPV6. Creating IPV6 must be true |
Response headers
There are no special headers required beyond the common headers.
Response parameters
No parameters
Request example
Plain Text
1PUT http://bcc.bj.baidubce.com/v2/instance/batchAddIp?clientToken=3A8d84403d-a94b-40ce-9d6a-f6225dd26676
2Host: bcc.bj.baidubce.com
3Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
4{
5 "instanceId": "i-DhjUXmSA",
6 "privateIps": [
7 "2400:da00:e003:0:219::2f",
8 "2400:da00:e003:0:219::30"
9 ],
10 "allocateMultiIpv6Addr": true
11}
12 Or
13{
14 "instanceId": "i-DhjUXmSA",
15 "secondaryPrivateIpAddressCount": 2,
16 "allocateMultiIpv6Addr": true
17}
Response example
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3Date: Wed, 08 Jul 2015 03:28:11 GMT
4x-bce-request-id: d8752367-38e8-45e4-b4c7-e53be3137ce5
5Server: BWS
6{
7 "privateIps": [
8 "2400:da00:e003:0:219::2f",
9 "2400:da00:e003:0:219::30"
10 ],
11 "eniPrivateIps": null
12}
