Create subnet
Creates a subnet on the specified network.
URI
/v2.0/subnets
HTTP method
POST
Request parameter
Key | Description | Type | Required/optional |
---|---|---|---|
name | The subnet name. | xsd:string | Optional |
network_id | The ID of the attached network. | csapi:uuid | required |
allocation_pools | The start and end addresses for the allocation pools. | xsd:dict | Optional |
dns_nameservers | A list of DNS name servers for the subnet. For example ["8.8.8.7", "8.8.8.8"]. The specified IP addresses are displayed in sorted order in ascending order. The lowest IP address will be the primary DNS address. |
xsd:string | Optional |
host_routes | A list of host route dictionaries for the subnet. For example:
|
xsd:list | Optional |
gateway_ip | The gateway IP address. | xsd:string | Optional |
ip_version | The IP version, which can be 4 or 6. | xsd:string | Required |
cidr | The CIDR. | xsd:bool | required |
enable_dhcp | Set to "true" if DHCP is enabled, or "false" otherwise. | xsd:boolean | Optional |
availability_zone | The Availability Zone name. If you do not specify this, the resource will be created in the default Availability Zone. |
xsd:string | Optional |
CAUTION:
- Do not specify an ISP shared address (100.64.0.0/10 or a subnet address of a division of that subnet).
- Only one subnet can be related to a single network.
CAUTION:
When creating a subnet for use with the Window virtual server for SAP service or the physical server for SAP HANA service, please take note of the following points.
- Perform creation with the following string attached to the head of the name parameter.
- For the Windows virtual server for SAP service:
- fcx_subnet-w:
- For the physical server for SAP HANA service:
- fcx_subnet-b:
- The range of the mask value that can be specified for cidr is 16 - 29.
- IP addresses other than those specified for allocation_pools and gateway_ip will be allocated to the servers (VMs) created in the Windows virtual server for SAP service or the physical server for SAP HANA service.
Specify allocation_pools excluding the range of IP addresses that will be used for the Windows virtual server for SAP service or the physical server for SAP HANA service.
- Specify 4 for ip_version.
- The information specified for host_routes, enable_dhcp, and dns_nameservers is not set for the servers (VMs) created in the Windows virtual server for SAP service or the physical server for SAP HANA service.
CAUTION:
When creating a subnet that uses an SSL-VPN connection, take note of the following points.
- The range of the mask value that can be specified for cidr is 16 - 29.
- Specify the IP address of the router specified for the VPN Service for gateway_ip.
Example request
{
"subnet": {
"network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
"ip_version": 4,
"cidr": "192.168.199.0/24",
"availability_zone": "AZ1"
}
}
Response status
Status code | Description |
---|---|
201 | Normal response codes |
badRequest (400) | Error response codes |
unauthorized (401) | Error response codes |
forbidden (403) | Error response codes |
itemNotFound (404) | Error response codes |
conflict (409) | Error response codes |
Response body (normal status)
{
"subnet": {
"name": "",
"enable_dhcp": true,
"network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
"tenant_id": "4fd44f30292945e481c7b8a0c8908869",
"dns_nameservers": [],
"gateway_ip": "192.168.199.1",
"ipv6_ra_mode": null,
"allocation_pools": [
{
"start": "192.168.199.2",
"end": "192.168.199.254"
}
],
"host_routes": [],
"ip_version": 4,
"ipv6_address_mode": null,
"cidr": "192.168.199.0/24",
"id": "3b80198d-4f7b-4f77-9ef5-774d54e17126",
"subnetpool_id": null,
"availability_zone": "AZ1"
}
Description of response body (normal status)
Item | Description |
---|---|
name | The subnet name. |
network_id | The ID of the attached network. |
tenant_id | The ID of the project who owns the network. |
dns_nameservers | A list of DNS name servers for the subnet. For example ["8.8.8.7", "8.8.8.8"]. |
allocation_pools | The start and end addresses for the allocation pools. |
host_routes | A list of host route dictionaries for the subnet. For example:
|
gateway_ip | The gateway IP address. |
ip_version | The IP version, which is 4. |
cidr | The CIDR. |
id | The ID of the subnet. |
enable_dhcp | Set to "true" if DHCP is enabled, or "false" otherwise. |
availability_zone | The Availability Zone name. |
ipv6_ra_mode | This attribute is used to specify if the Networking service should transmit ICMPv6 packets, for a subnet. Value is 0. |
ipv6_address_mode | This attribute is used to control how addressing is handled by OpenStack. There are a number of different ways that guest instances can obtain an IPv6 address, and this attribute exposes these choices to users of the Networking API. Value is 0. |
subnetpool_id | The UUID of the subnet pool. |