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
Create new subnet
os subnet create
[--project <project> [--project-domain <project-domain>]]
[--subnet-pool <subnet-pool> | --use-default-subnet-pool [--prefix-length <prefix-length>]]
[--subnet-range <subnet-range>]
[--allocation-pool start=<ip-address>,end=<ip-address>]
[--dhcp | --no-dhcp]
[--dns-nameserver <dns-nameserver>]
[--gateway <gateway>]
[--host-route destination=<subnet>,gateway=<ip-address>]
[--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>
<name>
Owner’s project (name or ID)
Domain the project belongs to (name or ID). This can be used in case collisions between project names exist.
Subnet pool from which this subnet will obtain a CIDR (name or ID)
Use default subnet pool for --ip-version
Prefix length for subnet allocation from subnet pool
Subnet range in CIDR notation (required if --subnet-pool is not specified, optional otherwise)
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)
Enable DHCP (default)
Disable DHCP
DNS server for this subnet (repeat option to set multiple DNS servers)
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’).
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)
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 (Router Advertisement) mode, valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]
IPv6 address mode, valid modes: [dhcpv6-stateful, dhcpv6-stateless, slaac]
Network segment to associate with this subnet (ID only)
Caution
This is a beta command option and subject to change. Use global option --os-beta-command to enable this command option.
Network this subnet belongs to (name or ID)
Name of subnet to create
Delete subnet(s)
os subnet delete
<subnet> [<subnet> ...]
Subnet(s) to delete (name or ID)
List subnets
os subnet list
[--long]
[--ip-version {4,6}]
[--dhcp | --no-dhcp]
List additional fields in output
List only subnets of given IP version in output. Allowed values for IP version are 4 and 6.
List subnets which have DHCP enabled
List subnets which have DHCP disabled
Set subnet properties
os subnet set
[--allocation-pool start=<ip-address>,end=<ip-address>]
[--dhcp | --no-dhcp]
[--dns-nameserver <dns-nameserver>]
[--gateway <gateway-ip>]
[--host-route destination=<subnet>,gateway=<ip-address>]
[--name <new-name>]
<subnet>
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)
Enable DHCP
Disable DHCP
DNS server for this subnet (repeat option to set multiple DNS servers)
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.
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)
Updated name of the subnet
Subnet to modify (name or ID)
Unset subnet properties
os subnet unset
[--allocation-pool start=<ip-address>,end=<ip-address> [...]]
[--dns-nameserver <dns-nameserver> [...]]
[--host-route destination=<subnet>,gateway=<ip-address> [...]]
<subnet>
DNS server to be removed from this subnet (repeat option to unset multiple DNS servers)
Allocation pool 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)
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)
subnet to modify (name or ID)