# openstack.network.v2.subnet

## The Subnet Class

The `Subnet` class inherits from `Resource`.

class openstack.network.v2.subnet.Subnet(_synchronized=False, connection=None, **attrs)

  The base resource

  Parameters:

    - _synchronized (bool) – This is not intended to be used directly. See `new()` and `existing()`.

    - connection (openstack.connection.Connection) – Reference to the Connection being used. Defaults to None to allow Resource objects to be used without an active Connection, such as in unit tests. Use of `self._connection` in Resource code should protect itself with a check for None.

  resource_key = 'subnet'

    Singular form of key for resource.

  resources_key = 'subnets'

    Plural form of key for resource.

  base_path = '/subnets'

    The base part of the URI for this resource.

  allow_create = True

    Allow create operation for this resource.

  allow_fetch = True

    Allow get operation for this resource.

  allow_commit = True

    Allow update operation for this resource.

  allow_delete = True

    Allow delete operation for this resource.

  allow_list = True

    Allow list operation for this resource.

  allocation_pools

    List of allocation pools each of which has a start and an end address for this subnet

  cidr

    The CIDR.

  created_at

    Timestamp when the subnet was created.

  description

    The subnet description.

  dns_nameservers

    A list of DNS nameservers.

  dns_publish_fixed_ip

    Whether to publish DNS records for fixed IPs

  gateway_ip

    The gateway IP address.

  host_routes

    A list of host routes.

  ip_version

    The IP version, which is 4 or 6. Type: int

  ipv6_address_mode

    The IPv6 address modes which are ‘dhcpv6-stateful’, ‘dhcpv6-stateless’ or ‘slaac’.

  ipv6_ra_mode

    The IPv6 router advertisements modes which can be ‘slaac’, ‘dhcpv6-stateful’, ‘dhcpv6-stateless’.

  is_dhcp_enabled

    Set to `True` if DHCP is enabled and `False` if DHCP is disabled. Type: bool

  name

    The subnet name.

  network_id

    The ID of the attached network.

  prefix_length

    The prefix length to use for subnet allocation from a subnet pool

  project_id

    The ID of the project this subnet is associated with.

  tenant_id

    Tenant_id (deprecated attribute).

  segment_id

    The ID of the segment this subnet is associated with.

  service_types

    Service types for this subnet

  subnet_pool_id

    The subnet pool ID from which to obtain a CIDR.

  updated_at

    Timestamp when the subnet was last updated.

  use_default_subnet_pool

    Whether to use the default subnet pool to obtain a CIDR.

this page last updated: 2026-01-16 23:06:19

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.