You need to enable JavaScript to run this app.
导航

AssignPrivateIpAddresses

最近更新时间2024.01.10 10:41:31

首次发布时间2022.03.01 09:03:59

调用 AssignPrivateIpAddresses 接口,为网卡(主网卡/辅助网卡)分配辅助私网IPv4地址。

调用说明

  • 火山引擎官方服务网卡不支持分配辅助私网IPv4地址。
  • 仅状态为AvailableInUse状态下的辅助网卡,可分配辅助私网IPv4地址。
  • 为主网卡分配辅助私网IPv4时,主网卡所属的实例状态必须为RUNNINGSTOPPED状态。
  • 辅助网卡处于Available状态,最多可以分配49个辅助私网IPv4地址;辅助网卡处于InUse状态,可分配的辅助私网IPv4地址数量受挂载实例的规格限制。

调试

请求参数

参数名称
类型
是否必选
示例值
描述
ActionStringAssignPrivateIpAddresses要执行的操作。取值:AssignPrivateIpAddresses。
VersionString2020-04-01API版本信息,取值为:2020-04-01。

NetworkInterfaceId

String

eni-bp67acfmxazb4p****

网卡的ID。
您可以调用 DescribeNetworkInterfaces 接口,查询网卡的ID。

PrivateIpAddress.N

String

PrivateIpAddress.1=192.168.XX.10&PrivateIpAddress.2=192.168.XX.12

为网卡指定私网IP地址的IP和数量。

  • 参数 - N:表示私网IPv4地址的序号,取值范围由网卡状态决定。
    • 当网卡处于未挂载(Available)状态时,取值范围为1~49。
    • 当网卡处于已挂载(InUse)状态时,N的取值范围受到实例规格限制,更多详情请参见实例规格介绍
  • 多个私网IPv4地址之间用&分隔。
  • 指定的私网IPv4地址必须为网卡所属子网中的空闲私网IPv4地址。

说明

PrivateIpAddress.NSecondaryPrivateIpAddressCount二者必须传入且只能传入一个。

SecondaryPrivateIpAddressCount

Integer

1

为网卡分配辅助私网IPv4地址数量。系统会自动从网卡所属子网中,分配相应数量的空闲IP地址作为网卡的辅助私网IPv4地址。

说明

参数PrivateIpAddress.NSecondaryPrivateIpAddressCount二者必须传入且只能传入一个。

返回数据

参数名称
类型
示例值
描述
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3****请求ID。
NetworkInterfaceIdStringeni-bp125p95hhdhn3ot****网卡ID。
PrivateIpSetArray[ "192.168.XX.10","192.168.XX.12" ]网卡辅助私网IPv4地址集合。

请求示例

GET /?Action=AssignPrivateIpAddresses&Version=2020-04-01&NetworkInterfaceId=eni-bp67acfmxazb4p****&PrivateIpAddress.1=192.168.XX.10&PrivateIpAddress.2=192.168.XX.12 HTTP/1.1
Host: open.volcengineapi.com
Service: vpc
Region: cn-beijing

返回示例

{
    "ResponseMetadata": {
        "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
        "Action": "AssignPrivateIpAddresses",
        "Version": "2020-04-01",
        "Service": "vpc",
        "Region": "cn-beijing"
    },
    "Result": {
        "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
        "NetworkInterfaceId": "eni-bp125p95hhdhn3ot****",
        "PrivateIpSet": [
            "192.168.XX.10",
            "192.168.XX.12"
        ]
    }
}

错误码

此处仅展示当前API的错误码,更多错误码请参见公共错误码

HttpCode
错误码
错误信息
描述
400InsufficientIpInSubnetThe specified subnet does not contain enough free private IP addresses to fulfill your request.指定子网下可用IP不足。
400InvalidEni.InvalidStatusThe specified elastic network interface is not in the correct status for the request.指定的弹性网卡所处的状态无法响应该请求。
400InvalidEniIp.MalformedThe specified elastic network interface ip is malformed. If you are specifying an IP of an elastic network interface, ensure it must fall into the range of the CIDR block of the subnet to which the elastic network interface belongs to.指定的弹性网卡IP不合法。请确保网卡IP必须从属于所在子网的网段。
400InvalidInstance.InvalidStatusThe specified instance is not in the correct status for the request.指定的ECS实例所处的状态无法响应该请求。
400InvalidPrivateIp.MalformedThe specified private ip is malformed.指定的私网IP不合法。
400LimitExceeded.Ipv6AddressesPerEniYou've reached the limit on the number of IPv6 addresses per ENI that you can assign.已达到网卡可分配的IPv6地址的数量上限。
400LimitExceeded.PrivateIpsPerEniYou've reached the limit on the number of private IPs per ENI that you can assign.已达到网卡可分配的辅助IP的数量上限。
400QuotaExceeded.SecurityGroupIpThe number of IP addresses bound to the security group exceeded quota.已达到安全组可绑定IP地址的数量上限。
403ForbiddenYou are not authorized to perform operations on the specified elastic network interface. The specified elastic network interface is a service-managed elastic network interface.无权限对指定弹性网卡进行操作。指定的弹性网卡为云产品托管的弹性网卡。
404InvalidEniId.NotFoundThe specified elastic network interface does not exist.指定的弹性网卡不存在。
409InvalidIpAddress.InUseThe specified IP address is in use.指定的IP地址已被占用。
409InvalidParameter.ParameterConflictThe parameters for IP address number and IP addresses cannot be specified at the same time.该请求不允许同时传入IP地址数量以及IP地址。