ModifySubnetStackType
1. API Description
This API (ModifySubnetStackType) is used to modify the IP stack type of the specified subnet (IPv4, IPv4_IPv6, or IPv6). When switching to dual-stack or IPv6-only, you must provide the IPv6 type and the corresponding CIDR block configuration.
Notes
Switching from
IPv4toIPv4_IPv6is supported: after the switch, an IPv6 address block is assigned to the subnet.Switching from
IPv4_IPv6toIPv4(disabling IPv6) is supported: this is supported for both public and private IPv6 subnets; before disabling, ensure all network interfaces in the subnet have had their IPv6 addresses removed viaUnassignNetworkInterfaceIpv6.
2. Input Parameters
The following request parameter list only provides API request parameters.
subnetId
Yes
String
Subnet ID.
stackType
Yes
IP stack type of the subnet.
IPv4_IPv6: enables public IPv6; whether it is public or private is determined by ipv6Type.
IPv4: disables IPv6 — before disabling, ensure all network interfaces in the subnet have had their IPv6 addresses removed via UnassignNetworkInterfaceIpv6.
ipv6CidrBlockId
No
String
ID of the public IPv6 CIDR block.
This field can only be specified when ipv6Type is Public.
If not specified, it will be allocated from the system's default IP pool.
ipv6MaskLength
No
Integer
The size of the IPv6 CIDR prefix assigned to the instance.
This parameter must be used together with the ipv6CidrBlockId parameter.
The default value is 96 if not explicitly provided.
The minimum value must be greater than or equal to the prefix of the specified ipv6CidrBlockId, and the maximum value cannot exceed 96.
Value range: [-, 96]
3. Output Parameters
requestId
String
The unique request ID, which is returned for each request.
RequestId is required for locating a problem.
ipv6CidrBlock
String
IPv6 CIDR block of subnet.
4. Code Example
1. Modify the subnet stack type: IPv4 → IPv4_IPv6, specifying private IPv6.
2. Disable public IPv6 for the subnet: IPv4_IPv6 → IPv4.
5. Developer Resources
Zenlayer Cloud API 2.0 integrates SDKs,to make it easier for you to call APIs. More programming languages will be supported.
6. Error Codes
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
400
INVALID_CIDR_BLOCK_STATUS
The CIDR block state is invalid.
404
INVALID_CIDR_IPV6_NOT_FOUND
The IPv6 CIDR block does not exist.
400
INVALID_CIDR_REGION_MISMATCH
The subnet region does not match the IPv6 CIDR block region.
400
INVALID_MASK_LENGTH
The IPv6 address mask length must be greater than or equal to the subnet IPv6 prefix length.
400
INVALID_SUBNET_HAS_IPV6_ALLOCATED
The subnet still has network interfaces with IPv6 allocated. Please call UnassignNetworkInterfaceIpv6 on all of them first.
404
INVALID_SUBNET_NOT_FOUND
Subnet does not exist.
404
INVALID_VPC_NOT_FOUND
The global VPC does not exist.
404
INVALID_ZONE_NOT_FOUND
Region does not exist.
400
OPERATION_DENIED_NO_AVAILABLE_CIDR
No available CIDR block.
400
OPERATION_DENIED_REGION_NOT_SUPPORT_PUB_IPV6
Public IPv6 is not supported in the specified region.
400
OPERATION_DENIED_SUBNET_TYPE_NOT_SUPPORT
Operations on subnets with such IP stack type is not supported.
400
OPERATION_DENIED_VPC_NOT_SUPPORT_PRI_IPV6
Private IPv6 is not supported for the specified global VPC.
Last updated