List subnets

Lists subnets to which the specified project has access.

URI

/v2.0/subnets

HTTP method

GET

Response status

Status code Description
200 Normal response codes
unauthorized (401) Error response codes

Response body (normal status)


       {
        "subnets": [
         {
          "name": "private-subnet",
          "enable_dhcp": true,
          "network_id": "db193ab3-96e3-4cb3-8fc5-05f4296d0324",
          "tenant_id": "26a7980765d0414dbc1fc1f88cdb7e6e",
          "dns_nameservers": [],
          "gateway_ip": "10.0.0.1",
          "ipv6_ra_mode": null,
          "allocation_pools": [
           {
            "start": "10.0.0.2",
            "end": "10.0.0.254"
           }
          ],
          "host_routes": [],
          "ip_version": 4,
          "ipv6_address_mode": null,
          "cidr": "10.0.0.0/24",
          "id": "08eae331-0402-425a-923c-34f7cfe39c1b",
          "subnetpool_id": null,
          "availability_zone": "AZ1"
         },
         {
          "name": "my_subnet",
          "enable_dhcp": true,
          "network_id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
          "tenant_id": "4fd44f30292945e481c7b8a0c8908869",
          "dns_nameservers": [],
          "gateway_ip": "192.0.0.1",
          "ipv6_ra_mode": null,
          "allocation_pools": [
           {
            "start": "192.0.0.2",
            "end": "192.255.255.254"
           }
          ],
          "host_routes": [],
          "ip_version": 4,
          "ipv6_address_mode": null,
          "cidr": "192.0.0.0/8",
          "id": "54d6f61d-db07-451c-9ab3-b9609b6b6f0b",
          "subnetpool_id": null,
          "availability_zone": "AZ1"
         }
        ]
       }

Description of response body (normal status)

Item Description
name The subnet name.
enable_dhcp Set to "true" if DHCP is enabled, or "false" otherwise.
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"].

The specified IP addresses are displayed in sorted order in ascending order.

The lowest IP address will be the primary DNS address.

allocation_pools The start and end addresses for the allocation pools.
host_routes A list of host route dictionaries for the subnet. For example:

"host_routes":[
	{
		"destination":"0.0.0.0/0",
		"nexthop":"172.16.1.254"
	},
	{
		"destination":"192.168.0.0/24",
		"nexthop":"192.168.0.1"
	}
]             
               
ip_version The IP version, which is 4.
gateway_ip The gateway IP address.
cidr The CIDR.
id The ID of the subnet.
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.

This value is null.

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.

This value is null.

subnetpool_id The UUID of the subnet pool.

This value is null.