# subnet

A subnet is a block of IP addresses and associated configuration state. Subnets are used to allocate IP addresses when new ports are created on a network.

Network v2

## subnet create

Create a subnet

    openstack subnet create
        [--extra-property type=<property_type>,name=<property_name>,value=<property_value>]
        [--project <project>]
        [--project-domain <project-domain>]
        [--subnet-pool
        <subnet-pool>
        |
        --use-prefix-delegation
        |
        --use-default-subnet-pool
        ]
        [--prefix-length <prefix-length>]
        [--subnet-range <subnet-range>]
        [--dhcp
        |
        --no-dhcp
        ]
        [--dns-publish-fixed-ip
        |
        --no-dns-publish-fixed-ip
        ]
        [--gateway <gateway>]
        [--ip-version {4,6}]
        [--ipv6-ra-mode {dhcpv6-stateful,dhcpv6-stateless,slaac}]
        [--ipv6-address-mode {dhcpv6-stateful,dhcpv6-stateless,slaac}]
        [--network-segment <network-segment>]
        --network <network>
        [--description <description>]
        [--allocation-pool start=<ip-address>,end=<ip-address>]
        [--dns-nameserver <dns-nameserver>]
        [--host-route destination=<subnet>,gateway=<ip-address>]
        [--service-type <service-type>]
        [--tag
        <tag>
        |
        --no-tag
        ]
        <name>

--extra-property type=<property_type>,name=<property_name>,value=<property_value>

  Additional parameters can be passed using this property. Default type of the extra property is string (‘str’), but other types can be used as well. Available types are: ‘dict’, ‘list’, ‘str’, ‘bool’, ‘int’. In case of ‘list’ type, ‘value’ can be semicolon-separated list of values. For ‘dict’ value is semicolon-separated list of the key:value pairs.

--project <project>

  Owner’s project (name or ID)

--project-domain <project-domain>

  Domain the project belongs to (name or ID). This can be used in case collisions between project names exist.

--subnet-pool <subnet-pool>

  Subnet pool from which this subnet will obtain a CIDR (Name or ID)

--use-prefix-delegation

  Use ‘prefix-delegation’ if IP is IPv6 format and IP would be delegated externally

--use-default-subnet-pool

  Use default subnet pool for –ip-version

--prefix-length <prefix-length>

  Prefix length for subnet allocation from subnet pool

--subnet-range <subnet-range>

  Subnet range in CIDR notation (required if –subnet-pool is not specified, optional otherwise)

--dhcp

  Enable DHCP (default)

--no-dhcp

  Disable DHCP

--dns-publish-fixed-ip

  Enable publishing fixed IPs in DNS

--no-dns-publish-fixed-ip

  Disable publishing fixed IPs in DNS (default)

--gateway <gateway>

  Specify a gateway for the subnet. The three options are: <ip-address>: Specific IP address to use as the gateway, ‘auto’: Gateway address should automatically be chosen from within the subnet itself, ‘none’: This subnet will not use a gateway. For example, –gateway 192.168.9.1, –gateway auto or –gateway none (default is ‘auto’).

--ip-version <IP_VERSION>

  IP version (default is 4). Note that when subnet pool is specified, IP version is determined from the subnet pool and this option is ignored.

--ipv6-ra-mode <IPV6_RA_MODE>

  IPv6 RA (Router Advertisement) mode, valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]

--ipv6-address-mode <IPV6_ADDRESS_MODE>

  IPv6 address mode, valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]

--network-segment <network-segment>

  Network segment to associate with this subnet (name or ID)

--network <network>

  Network this subnet belongs to (name or ID)

--description <description>

  Set subnet description

--allocation-pool start=<ip-address>,end=<ip-address>

  Allocation pool IP addresses for this subnet, for example, start=192.168.199.2,end=192.168.199.254 (repeat option to add multiple IP addresses)

--dns-nameserver <dns-nameserver>

  DNS server for this subnet (repeat option to set multiple DNS servers)

--host-route destination=<subnet>,gateway=<ip-address>

  Additional route for this subnet, for example, destination=10.10.0.0/16,gateway=192.168.71.254 destination: destination subnet (in CIDR notation) gateway: next-hop IP address (repeat option to add multiple routes)

--service-type <service-type>

  Service type for this subnet, for example, network:floatingip_agent_gateway. Must be a valid device owner value for a network port (repeat option to set multiple service types)

--tag <tag>

  Tag to be added to the subnet (repeat option to set multiple tags)

--no-tag

  No tags associated with the subnet

name

  New subnet name

## subnet delete

Delete subnet(s)

    openstack subnet delete <subnet> [<subnet> ...]

subnet

  Subnet(s) to delete (name or ID)

## subnet list

List subnets

    openstack subnet list
        [--format-config-file FORMAT_CONFIG]
        [--sort-column SORT_COLUMN]
        [--sort-ascending
        |
        --sort-descending
        ]
        [--long]
        [--ip-version <ip-version>]
        [--dhcp | --no-dhcp]
        [--service-type <service-type>]
        [--project <project>]
        [--project-domain <project-domain>]
        [--network <network>]
        [--gateway <gateway>]
        [--name <name>]
        [--subnet-range <subnet-range>]
        [--subnet-pool <subnet-pool>]
        [--tags <tag>[,<tag>,...]]
        [--any-tags <tag>[,<tag>,...]]
        [--not-tags <tag>[,<tag>,...]]
        [--not-any-tags <tag>[,<tag>,...]]

--format-config-file <FORMAT_CONFIG>

  Config file for the dict-to-csv formatter

--sort-column SORT_COLUMN

  specify the column(s) to sort the data (columns specified first have a priority, non-existing columns are ignored), can be repeated

--sort-ascending

  sort the column(s) in ascending order

--sort-descending

  sort the column(s) in descending order

--long

  List additional fields in output

--ip-version <ip-version>

  List only subnets with the specified IP version. Allowed values for IP version are 4 and 6.

--dhcp

  List only subnets which have DHCP enabled

--no-dhcp

  List only subnets which have DHCP disabled

--service-type <service-type>

  List only subnets with the specified service type, for example, network:floatingip_agent_gateway. Must be a valid device owner value for a network port (repeat option to list multiple service types).

--project <project>

  List only subnets with the specified project (name or ID)

--project-domain <project-domain>

  Domain the project belongs to (name or ID). This can be used in case collisions between project names exist.

--network <network>

  List only subnets which belong to the specified network (name or ID)

--gateway <gateway>

  List only subnets with the specified gateway IP

--name <name>

  List only subnets with the specified name

--subnet-range <subnet-range>

  List only subnets with the specified subnet range (in CIDR notation). For example, –subnet-range 10.10.0.0/16

--subnet-pool <subnet-pool>

  List only subnets which belong to the specified subnet pool (name or ID)

--tags <tag>[,<tag>,...]

  List subnets which have all given tag(s) (Comma-separated list of tags)

--any-tags <tag>[,<tag>,...]

  List subnets which have any given tag(s) (Comma-separated list of tags)

--not-tags <tag>[,<tag>,...]

  Exclude subnets which have all given tag(s) (Comma-separated list of tags)

--not-any-tags <tag>[,<tag>,...]

  Exclude subnets which have any given tag(s) (Comma-separated list of tags)

## subnet set

Set subnet properties

    openstack subnet set
        [--extra-property type=<property_type>,name=<property_name>,value=<property_value>]
        [--name <name>]
        [--dhcp | --no-dhcp]
        [--dns-publish-fixed-ip
        |
        --no-dns-publish-fixed-ip
        ]
        [--gateway <gateway>]
        [--network-segment <network-segment>]
        [--description <description>]
        [--tag <tag>]
        [--no-tag]
        [--allocation-pool start=<ip-address>,end=<ip-address>]
        [--no-allocation-pool]
        [--dns-nameserver <dns-nameserver>]
        [--no-dns-nameservers]
        [--host-route destination=<subnet>,gateway=<ip-address>]
        [--no-host-route]
        [--service-type <service-type>]
        <subnet>

--extra-property type=<property_type>,name=<property_name>,value=<property_value>

  Additional parameters can be passed using this property. Default type of the extra property is string (‘str’), but other types can be used as well. Available types are: ‘dict’, ‘list’, ‘str’, ‘bool’, ‘int’. In case of ‘list’ type, ‘value’ can be semicolon-separated list of values. For ‘dict’ value is semicolon-separated list of the key:value pairs.

--name <name>

  Updated name of the subnet

--dhcp

  Enable DHCP

--no-dhcp

  Disable DHCP

--dns-publish-fixed-ip

  Enable publishing fixed IPs in DNS

--no-dns-publish-fixed-ip

  Disable publishing fixed IPs in DNS

--gateway <gateway>

  Specify a gateway for the subnet. The options are: <ip-address>: Specific IP address to use as the gateway, ‘none’: This subnet will not use a gateway. For example, –gateway 192.168.9.1 or –gateway none.

--network-segment <network-segment>

  Network segment to associate with this subnet (name or ID). It is only allowed to set the segment if the current value is None. The network must also have only one segment and only one subnet can exist on the network.

--description <description>

  Set subnet description

--tag <tag>

  Tag to be added to the subnet (repeat option to set multiple tags)

--no-tag

  Clear tags associated with the subnet. Specify both –tag and –no-tag to overwrite current tags

--allocation-pool start=<ip-address>,end=<ip-address>

  Allocation pool IP addresses for this subnet, for example, start=192.168.199.2,end=192.168.199.254 (repeat option to add multiple IP addresses)

--no-allocation-pool

  Clear associated allocation-pools from the subnet. Specify both –allocation-pool and –no-allocation-pool to overwrite the current allocation pool information.

--dns-nameserver <dns-nameserver>

  DNS server for this subnet (repeat option to set multiple DNS servers)

--no-dns-nameservers

  Clear existing information of DNS Nameservers. Specify both –dns-nameserver and –no-dns-nameserver to overwrite the current DNS Nameserver information.

--host-route destination=<subnet>,gateway=<ip-address>

  Additional route for this subnet, for example, destination=10.10.0.0/16,gateway=192.168.71.254 destination: destination subnet (in CIDR notation) gateway: next-hop IP address (repeat option to add multiple routes)

--no-host-route

  Clear associated host-routes from the subnet. Specify both –host-route and –no-host-route to overwrite the current host route information.

--service-type <service-type>

  Service type for this subnet, for example, network:floatingip_agent_gateway. Must be a valid device owner value for a network port (repeat option to set multiple service types)

subnet

  Subnet to modify (name or ID)

## subnet show

Display subnet details

    openstack subnet show <subnet>

subnet

  Subnet to display (name or ID)

## subnet unset

Unset subnet properties

    openstack subnet unset
        [--extra-property type=<property_type>,name=<property_name>,value=<property_value>]
        [--allocation-pool start=<ip-address>,end=<ip-address>]
        [--gateway]
        [--dns-nameserver <dns-nameserver>]
        [--host-route destination=<subnet>,gateway=<ip-address>]
        [--service-type <service-type>]
        [--tag
        <tag>
        |
        --all-tag
        ]
        <subnet>

--extra-property type=<property_type>,name=<property_name>,value=<property_value>

  Additional parameters can be passed using this property. Default type of the extra property is string (‘str’), but other types can be used as well. Available types are: ‘dict’, ‘list’, ‘str’, ‘bool’, ‘int’. In case of ‘list’ type, ‘value’ can be semicolon-separated list of values. For ‘dict’ value is semicolon-separated list of the key:value pairs.

--allocation-pool start=<ip-address>,end=<ip-address>

  Allocation pool IP addresses to be removed from this subnet, for example, start=192.168.199.2,end=192.168.199.254 (repeat option to unset multiple allocation pools)

--gateway

  Remove gateway IP from this subnet

--dns-nameserver <dns-nameserver>

  DNS server to be removed from this subnet (repeat option to unset multiple DNS servers)

--host-route destination=<subnet>,gateway=<ip-address>

  Route to be removed from this subnet, for example, destination=10.10.0.0/16,gateway=192.168.71.254 destination: destination subnet (in CIDR notation) gateway: next-hop IP address (repeat option to unset multiple host routes)

--service-type <service-type>

  Service type to be removed from this subnet, for example, network:floatingip_agent_gateway. Must be a valid device owner value for a network port (repeat option to unset multiple service types)

--tag <tag>

  Tag to be removed from the subnet (repeat option to remove multiple tags)

--all-tag

  Clear all tags associated with the subnet

subnet

  Subnet to modify (name or ID)

this page last updated: 2026-04-01 09:44:20

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