• Virtual Private Cloud

vpc
  1. Help Center
  2. Virtual Private Cloud
  3. API Reference
  4. OpenStack Neutron APIs
  5. Subnet
  6. Subnet API Overview

Subnet API Overview

Object Introduction

This interface is used to manage and perform operations on subnet resources, including querying subnets, creating a subnet, querying a specified subnet, deleting a subnet, and updating a subnet.

Object Model

Table 1 subnet object

Attribute

Mandatory

Type

CRUD

Default Value

Constraint

Description

id

Yes

Uuid-str

R

Automatically generated

N/A

Specifies the subnet ID.

This parameter is not mandatory when you query subnets.

name

No

String(255)

CRU

None

N/A

Specifies the subnet name.

ip_version

No

Int

CR

N/A

The value can only be 4 or 6.

Specifies the Internet Protocol (IP) version.

Only IPv4 is supported.

ipv6_address_mode

No

String

CR

N/A

The value can only be dhcpv6-stateful, dhcpv6-stateless, or slaac.

Specifies the IPv6 addressing mode.

ipv6_ra_mode

No

String

CR

N/A""

The value can only be dhcpv6-stateful, dhcpv6-stateless, or slaac.

Specifies the IPv6 route broadcast mode.

network_id

No

Uuid-str

CR

N/A

The value must be an existing network ID.

Specifies the ID of the network to which the subnet belongs.

cidr

No

String(64)

CR

N/A

The value must be in the valid CIDR format.

Specifies the CIDR format.

Only the addresses in the 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 network segments are supported. In addition, the subnet mask cannot be greater than 28.

gateway_ip

No

String(64)

CRUD

First IP address in a CIDR block

The value must be a valid IP address or null.

The gateway IP address cannot conflict with IP addresses configured for allocation_pools.

This attribute cannot be modified.

allocation_pools

No

List(allocation_pool)

CR

All IP addresses in a CIDR block excepting the gateway and broadcast addresses

The start and end IP addresses must be valid.

Specifies the available IP address pool. For details about the allocation_pool object, see Table 2.

For example, [ { "start": "10.0.0.2", "end": "10.0.0.251"} ]

The last three and the first IP addresses in each subnet are the ones reserved by the system. For example, in subnet 192.168.1.0/24, IP addresses 192.168.1.0, 192.168.1.253, 192.168.1.254, and 192.168.1.255 are reserved by the system. By default, the IP addresses reserved by the system are not in the IP address pool specified by allocation_pool.

When updating an IP address pool, the allocation_pool value can contain neither gateway nor broadcast IP addresses.

dns_nameservers

No

List(String)

CRU

Empty list

A maximum of five DNS server addresses are supported.

Specifies the DNS server address.

Example: "dns_nameservers": ["8.xx.xx.8","8.xx.xx.4"]

host_routes

No

List(host_route)

CRU

Empty list

A maximum of 20 static VM routes are supported.

Specifies the static VM routes. For details, see the host_route object.

Static routes are not supported, and entered information will be ignored.

tenant_id

No

String(255)

R

N/A

N/A

Specifies the project ID.

enable_dhcp

No

Bool

CRU

true

The value can only be true or false.

Specifies whether to enable the DHCP function. Value false indicates that the DHCP function is not enabled.

The value can only be true.

project_id

No

String(64)

R

N/A

N/A

Specifies the project ID of a resource.

created_at

No

String(64)

R

Automatically generated

N/A

Specifies the time when the resource was created.

updated_at

No

String(64)

R

Automatically generated

N/A

Specifies the time when the resource was updated.

Table 2 allocation_pool object

Parameter

Type

Constraint

Mandatory

Remarks

start

String(64)

The value must be a valid IP address.

No

Specifies the start IP address of a network pool.

end

String(64)

The value must be a valid IP address.

No

Specifies the end IP address of a network pool.

Table 3 host_route object

Parameter

Type

Constraint

Mandatory

Remarks

destination

String(64)

The value must be in the valid CIDR format.

No

Specifies the destination subnet of a route.

nexthop

String(64)

The value must be a valid IP address.

No

Specifies the next-hop IP address of a route.