Chapter 75. subnet


This chapter describes the commands under the subnet command.

75.1. subnet create

Create a subnet

Usage:

openstack subnet create [-h] [-f {json,shell,table,value,yaml}]
                               [-c COLUMN] [--noindent] [--prefix PREFIX]
                               [--max-width <integer>] [--fit-width]
                               [--print-empty] [--project <project>]
                               [--project-domain <project-domain>]
                               [--subnet-pool <subnet-pool> | --use-prefix-delegation USE_PREFIX_DELEGATION | --use-default-subnet-pool]
                               [--prefix-length <prefix-length>]
                               [--subnet-range <subnet-range>]
                               [--dhcp | --no-dhcp] [--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>

Table 75.1. Positional arguments
ValueSummary

<name>

New subnet name

Table 75.2. Command arguments
ValueSummary

-h, --help

Show this help message and exit

--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

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

--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, e.g.: --gateway 192.168.9.1, --gateway auto, --gateway none (default is auto).

--ip-version {4,6}

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 {dhcpv6-stateful,dhcpv6-stateless,slaac}

Ipv6 ra (router advertisement) mode, valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]

--ipv6-address-mode {dhcpv6-stateful,dhcpv6-stateless,slaac}

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 e.g.: 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 e.g.: destination=10.10.0.0/16,gateway=192.168.71.254 destination: destination subnet (in CIDR notation) gateway: nexthop IP address (repeat option to add multiple routes)

--service-type <service-type>

Service type for this subnet e.g.: 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

Table 75.3. Output formatter options
ValueSummary

-f {json,shell,table,value,yaml}, --format {json,shell,table,value,yaml}

The output format, defaults to table

-c COLUMN, --column COLUMN

Specify the column(s) to include, can be repeated

Table 75.4. JSON formatter options
ValueSummary

--noindent

Whether to disable indenting the json

Table 75.5. Shell formatter options
ValueSummary

--prefix PREFIX

Add a prefix to all variable names

Table 75.6. Table formatter options
ValueSummary

--max-width <integer>

Maximum display width, <1 to disable. you can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.

--fit-width

Fit the table to the display width. implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable

--print-empty

Print empty table if there is no data to show.

75.2. subnet delete

Delete subnet(s)

Usage:

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

Table 75.7. Positional arguments
ValueSummary

<subnet>

Subnet(s) to delete (name or id)

Table 75.8. Command arguments
ValueSummary

-h, --help

Show this help message and exit

75.3. subnet list

List subnets

Usage:

openstack subnet list [-h] [-f {csv,json,table,value,yaml}] [-c COLUMN]
                             [--quote {all,minimal,none,nonnumeric}]
                             [--noindent] [--max-width <integer>]
                             [--fit-width] [--print-empty]
                             [--sort-column SORT_COLUMN] [--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>]
                             [--tags <tag>[,<tag>,...]]
                             [--any-tags <tag>[,<tag>,...]]
                             [--not-tags <tag>[,<tag>,...]]
                             [--not-any-tags <tag>[,<tag>,...]]

Table 75.9. Command arguments
ValueSummary

-h, --help

Show this help message and exit

--long

List additional fields in output

--ip-version <ip-version>

List only subnets of given ip version in output. Allowed values for IP version are 4 and 6.

--dhcp

List subnets which have dhcp enabled

--no-dhcp

List subnets which have dhcp disabled

--service-type <service-type>

List only subnets of a given service type in output e.g.: 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 which belong to a given project in output (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 a given network in output (name or ID)

--gateway <gateway>

List only subnets of given gateway ip in output

--name <name>

List only subnets of given name in output

--subnet-range <subnet-range>

List only subnets of given subnet range (in cidr notation) in output e.g.: --subnet-range 10.10.0.0/16

--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)

Table 75.10. Output formatter options
ValueSummary

-f {csv,json,table,value,yaml}, --format {csv,json,table,value,yaml}

The output format, defaults to table

-c COLUMN, --column COLUMN

Specify the column(s) to include, can be repeated

--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

Table 75.11. CSV formatter options
ValueSummary

--quote {all,minimal,none,nonnumeric}

When to include quotes, defaults to nonnumeric

Table 75.12. JSON formatter options
ValueSummary

--noindent

Whether to disable indenting the json

Table 75.13. Table formatter options
ValueSummary

--max-width <integer>

Maximum display width, <1 to disable. you can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.

--fit-width

Fit the table to the display width. implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable

--print-empty

Print empty table if there is no data to show.

75.4. subnet pool create

Create subnet pool

Usage:

openstack subnet pool create [-h] [-f {json,shell,table,value,yaml}]
                                    [-c COLUMN] [--noindent] [--prefix PREFIX]
                                    [--max-width <integer>] [--fit-width]
                                    [--print-empty] --pool-prefix
                                    <pool-prefix>
                                    [--default-prefix-length <default-prefix-length>]
                                    [--min-prefix-length <min-prefix-length>]
                                    [--max-prefix-length <max-prefix-length>]
                                    [--project <project>]
                                    [--project-domain <project-domain>]
                                    [--address-scope <address-scope>]
                                    [--default | --no-default]
                                    [--share | --no-share]
                                    [--description <description>]
                                    [--default-quota <num-ip-addresses>]
                                    [--tag <tag> | --no-tag]
                                    <name>

Table 75.14. Positional arguments
ValueSummary

<name>

Name of the new subnet pool

Table 75.15. Command arguments
ValueSummary

-h, --help

Show this help message and exit

--pool-prefix <pool-prefix>

Set subnet pool prefixes (in cidr notation) (repeat option to set multiple prefixes)

--default-prefix-length <default-prefix-length>

Set subnet pool default prefix length

--min-prefix-length <min-prefix-length>

Set subnet pool minimum prefix length

--max-prefix-length <max-prefix-length>

Set subnet pool maximum prefix length

--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.

--address-scope <address-scope>

Set address scope associated with the subnet pool (name or ID), prefixes must be unique across address scopes

--default

Set this as a default subnet pool

--no-default

Set this as a non-default subnet pool

--share

Set this subnet pool as shared

--no-share

Set this subnet pool as not shared

--description <description>

Set subnet pool description

--default-quota <num-ip-addresses>

Set default per-project quota for this subnet pool as the number of IP addresses that can be allocated from the subnet pool

--tag <tag>

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

--no-tag

No tags associated with the subnet pool

Table 75.16. Output formatter options
ValueSummary

-f {json,shell,table,value,yaml}, --format {json,shell,table,value,yaml}

The output format, defaults to table

-c COLUMN, --column COLUMN

Specify the column(s) to include, can be repeated

Table 75.17. JSON formatter options
ValueSummary

--noindent

Whether to disable indenting the json

Table 75.18. Shell formatter options
ValueSummary

--prefix PREFIX

Add a prefix to all variable names

Table 75.19. Table formatter options
ValueSummary

--max-width <integer>

Maximum display width, <1 to disable. you can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.

--fit-width

Fit the table to the display width. implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable

--print-empty

Print empty table if there is no data to show.

75.5. subnet pool delete

Delete subnet pool(s)

Usage:

openstack subnet pool delete [-h] <subnet-pool> [<subnet-pool> ...]

Table 75.20. Positional arguments
ValueSummary

<subnet-pool>

Subnet pool(s) to delete (name or id)

Table 75.21. Command arguments
ValueSummary

-h, --help

Show this help message and exit

75.6. subnet pool list

List subnet pools

Usage:

openstack subnet pool list [-h] [-f {csv,json,table,value,yaml}]
                                  [-c COLUMN]
                                  [--quote {all,minimal,none,nonnumeric}]
                                  [--noindent] [--max-width <integer>]
                                  [--fit-width] [--print-empty]
                                  [--sort-column SORT_COLUMN] [--long]
                                  [--share | --no-share]
                                  [--default | --no-default]
                                  [--project <project>]
                                  [--project-domain <project-domain>]
                                  [--name <name>]
                                  [--address-scope <address-scope>]
                                  [--tags <tag>[,<tag>,...]]
                                  [--any-tags <tag>[,<tag>,...]]
                                  [--not-tags <tag>[,<tag>,...]]
                                  [--not-any-tags <tag>[,<tag>,...]]

Table 75.22. Command arguments
ValueSummary

-h, --help

Show this help message and exit

--long

List additional fields in output

--share

List subnet pools shared between projects

--no-share

List subnet pools not shared between projects

--default

List subnet pools used as the default external subnet pool

--no-default

List subnet pools not used as the default external subnet pool

--project <project>

List subnet pools according to their 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.

--name <name>

List only subnet pools of given name in output

--address-scope <address-scope>

List only subnet pools of given address scope in output (name or ID)

--tags <tag>[,<tag>,…​]

List subnet pools which have all given tag(s) (comma- separated list of tags)

--any-tags <tag>[,<tag>,…​]

List subnet pools which have any given tag(s) (comma- separated list of tags)

--not-tags <tag>[,<tag>,…​]

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

--not-any-tags <tag>[,<tag>,…​]

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

Table 75.23. Output formatter options
ValueSummary

-f {csv,json,table,value,yaml}, --format {csv,json,table,value,yaml}

The output format, defaults to table

-c COLUMN, --column COLUMN

Specify the column(s) to include, can be repeated

--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

Table 75.24. CSV formatter options
ValueSummary

--quote {all,minimal,none,nonnumeric}

When to include quotes, defaults to nonnumeric

Table 75.25. JSON formatter options
ValueSummary

--noindent

Whether to disable indenting the json

Table 75.26. Table formatter options
ValueSummary

--max-width <integer>

Maximum display width, <1 to disable. you can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.

--fit-width

Fit the table to the display width. implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable

--print-empty

Print empty table if there is no data to show.

75.7. subnet pool set

Set subnet pool properties

Usage:

openstack subnet pool set [-h] [--name <name>]
                                 [--pool-prefix <pool-prefix>]
                                 [--default-prefix-length <default-prefix-length>]
                                 [--min-prefix-length <min-prefix-length>]
                                 [--max-prefix-length <max-prefix-length>]
                                 [--address-scope <address-scope> | --no-address-scope]
                                 [--default | --no-default]
                                 [--description <description>]
                                 [--default-quota <num-ip-addresses>]
                                 [--tag <tag>] [--no-tag]
                                 <subnet-pool>

Table 75.27. Positional arguments
ValueSummary

<subnet-pool>

Subnet pool to modify (name or id)

Table 75.28. Command arguments
ValueSummary

-h, --help

Show this help message and exit

--name <name>

Set subnet pool name

--pool-prefix <pool-prefix>

Set subnet pool prefixes (in cidr notation) (repeat option to set multiple prefixes)

--default-prefix-length <default-prefix-length>

Set subnet pool default prefix length

--min-prefix-length <min-prefix-length>

Set subnet pool minimum prefix length

--max-prefix-length <max-prefix-length>

Set subnet pool maximum prefix length

--address-scope <address-scope>

Set address scope associated with the subnet pool (name or ID), prefixes must be unique across address scopes

--no-address-scope

Remove address scope associated with the subnet pool

--default

Set this as a default subnet pool

--no-default

Set this as a non-default subnet pool

--description <description>

Set subnet pool description

--default-quota <num-ip-addresses>

Set default per-project quota for this subnet pool as the number of IP addresses that can be allocated from the subnet pool

--tag <tag>

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

--no-tag

Clear tags associated with the subnet pool. specify both --tag and --no-tag to overwrite current tags

75.8. subnet pool show

Display subnet pool details

Usage:

openstack subnet pool show [-h] [-f {json,shell,table,value,yaml}]
                                  [-c COLUMN] [--noindent] [--prefix PREFIX]
                                  [--max-width <integer>] [--fit-width]
                                  [--print-empty]
                                  <subnet-pool>

Table 75.29. Positional arguments
ValueSummary

<subnet-pool>

Subnet pool to display (name or id)

Table 75.30. Command arguments
ValueSummary

-h, --help

Show this help message and exit

Table 75.31. Output formatter options
ValueSummary

-f {json,shell,table,value,yaml}, --format {json,shell,table,value,yaml}

The output format, defaults to table

-c COLUMN, --column COLUMN

Specify the column(s) to include, can be repeated

Table 75.32. JSON formatter options
ValueSummary

--noindent

Whether to disable indenting the json

Table 75.33. Shell formatter options
ValueSummary

--prefix PREFIX

Add a prefix to all variable names

Table 75.34. Table formatter options
ValueSummary

--max-width <integer>

Maximum display width, <1 to disable. you can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.

--fit-width

Fit the table to the display width. implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable

--print-empty

Print empty table if there is no data to show.

75.9. subnet pool unset

Unset subnet pool properties

Usage:

openstack subnet pool unset [-h] [--tag <tag> | --all-tag]
                                   <subnet-pool>

Table 75.35. Positional arguments
ValueSummary

<subnet-pool>

Subnet pool to modify (name or id)

Table 75.36. Command arguments
ValueSummary

-h, --help

Show this help message and exit

--tag <tag>

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

--all-tag

Clear all tags associated with the subnet pool

75.10. subnet set

Set subnet properties

Usage:

openstack subnet set [-h] [--name <name>] [--dhcp | --no-dhcp]
                            [--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>

Table 75.37. Positional arguments
ValueSummary

<subnet>

Subnet to modify (name or id)

Table 75.38. Command arguments
ValueSummary

-h, --help

Show this help message and exit

--name <name>

Updated name of the subnet

--dhcp

Enable dhcp

--no-dhcp

Disable dhcp

--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, e.g.: --gateway 192.168.9.1, --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 e.g.: 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 e.g.: destination=10.10.0.0/16,gateway=192.168.71.254 destination: destination subnet (in CIDR notation) gateway: nexthop 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 e.g.: network:floatingip_agent_gateway. Must be a valid device owner value for a network port (repeat option to set multiple service types)

75.11. subnet show

Display subnet details

Usage:

openstack subnet show [-h] [-f {json,shell,table,value,yaml}]
                             [-c COLUMN] [--noindent] [--prefix PREFIX]
                             [--max-width <integer>] [--fit-width]
                             [--print-empty]
                             <subnet>

Table 75.39. Positional arguments
ValueSummary

<subnet>

Subnet to display (name or id)

Table 75.40. Command arguments
ValueSummary

-h, --help

Show this help message and exit

Table 75.41. Output formatter options
ValueSummary

-f {json,shell,table,value,yaml}, --format {json,shell,table,value,yaml}

The output format, defaults to table

-c COLUMN, --column COLUMN

Specify the column(s) to include, can be repeated

Table 75.42. JSON formatter options
ValueSummary

--noindent

Whether to disable indenting the json

Table 75.43. Shell formatter options
ValueSummary

--prefix PREFIX

Add a prefix to all variable names

Table 75.44. Table formatter options
ValueSummary

--max-width <integer>

Maximum display width, <1 to disable. you can also use the CLIFF_MAX_TERM_WIDTH environment variable, but the parameter takes precedence.

--fit-width

Fit the table to the display width. implied if --max- width greater than 0. Set the environment variable CLIFF_FIT_WIDTH=1 to always enable

--print-empty

Print empty table if there is no data to show.

75.12. subnet unset

Unset subnet properties

Usage:

openstack subnet unset [-h]
                              [--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> | --all-tag]
                              <subnet>

Table 75.45. Positional arguments
ValueSummary

<subnet>

Subnet to modify (name or id)

Table 75.46. Command arguments
ValueSummary

-h, --help

Show this help message and exit

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

Allocation pool ip addresses to be removed from this subnet e.g.: start=192.168.199.2,end=192.168.199.254 (repeat option to unset multiple allocation pools)

--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 e.g.: destination=10.10.0.0/16,gateway=192.168.71.254 destination: destination subnet (in CIDR notation) gateway: nexthop IP address (repeat option to unset multiple host routes)

--service-type <service-type>

Service type to be removed from this subnet e.g.: 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

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.