Managing compute subnets
You can add, edit, and delete subnets of physical compute networks. Also, if you exhaust all public IP addresses in a physical compute network, you can add more subnets to this network by using the vinfra command-line tool. The new subnets will be available in the admin and self-service panel for IP address allocation and management.
Limitations
- For an IPv6 subnet, you cannot change the IPv6 address mode.
- A compute network with enabled IP address management must have at least one subnet.
Prerequisites
- Compute networks are created automatically during the compute cluster deployment or manually, as described in Creating physical compute networks and Creating virtual compute networks.
To add a subnet to a physical compute network
Admin panel
- On the Compute > Networks tab, click the desired physical network.
- In the Subnets section, click Add, and then select IPv4 subnet or IPv6 subnet, depending on the available option.
- In the new window, specify the subnet settings, and then click Add.
Command-line interface
Use the following command:
vinfra service compute subnet create [--dhcp | --no-dhcp] [--dns-nameserver <dns-nameserver>]
                                     [--allocation-pool <allocation-pool>] [--gateway <gateway> | --no-gateway]
                                     [--ipv6-address-mode {dhcpv6-stateful,dhcpv6-stateless,slaac}]
                                     --network <network> --cidr <cidr>
                                    - --dhcp
- Enable DHCP
- --no-dhcp
- Disable DHCP
- --dns-nameserver <dns-nameserver>
- DNS server IP address. This option can be used multiple times.
- --allocation-pool <allocation-pool>
- Allocation pool to create inside the network in the format: <starting_ip_address>-<ending_ip_address>. This option can be used multiple times.
- --gateway <gateway>
- Gateway IP address
- --no-gateway
- Do not configure a gateway for this network.
- --ipv6-address-mode {dhcpv6-stateful,dhcpv6-stateless,slaac}
- IPv6 address mode. Valid modes are dhcpv6-stateful,dhcpv6-stateless, andslaac.
- --network <network>
- Network ID or name
- --cidr <cidr>
- Subnet range in CIDR notation
For example, to add an IPv6 subnet to the physical network public, run:
# vinfra service compute subnet create --network public --cidr 2001:bd8::/64 --ipv6-address-mode dhcpv6-stateful \ --dhcp --allocation-pool 2001:bd8::100-2001:bd8::200 --dns-nameserver 2001:4860:4860::8888
The created subnet will appear in the vinfra service compute subnet list output:
# vinfra service compute subnet list --network public -c id -c network_id -c cidr +--------------------------------------+--------------------------------------+----------------+ | id | network_id | cidr | +--------------------------------------+--------------------------------------+----------------+ | 8d2169a1-3459-4e87-9f5c-6d2d20353eea | d94545f0-c974-49ac-99f6-db6da73cd23d | 10.136.16.0/20 | | afa4710a-a82c-4273-a1b0-72d5d2884be6 | d94545f0-c974-49ac-99f6-db6da73cd23d | 2001:bd8::/64 | +--------------------------------------+--------------------------------------+----------------+
To add more subnets to a physical compute network
- 
                                    Identify the required network by listing all of the existing networks: # vinfra service compute network list -c id -c name -c physical_network -c cidr +--------------------------------------+---------+------------------+------------------+ | id | name | physical_network | cidr | +--------------------------------------+---------+------------------+------------------+ | 3cbd594b-a1ff-4ee4-a771-1010822607c4 | private | | 192.168.128.0/24 | | d94545f0-c974-49ac-99f6-db6da73cd23d | public | Public | 10.136.16.0/20 | +--------------------------------------+---------+------------------+------------------+ 
- 
                                    Create a new subnet in the network by using the vinfra service compute subnet createcommand. For example:# vinfra service compute subnet create --network public --cidr 10.164.132.0/24 --gateway 10.164.132.1 \ --dhcp --allocation-pool 10.164.132.201-10.164.132.250 --dns-nameserver 8.8.8.8 
To edit a subnet of a physical compute network
Admin panel
- On the Compute > Networks tab, click the desired physical network.
- In the Subnets section, click the pencil icon next to the subnet you want to edit.
- In the Edit subnet window, change the subnet settings, and then click Save.
Command-line interface
Use the following command:
vinfra service compute subnet set [--dhcp | --no-dhcp] [--dns-nameserver <dns-nameserver>]
                                  [--allocation-pool <allocation-pool>]
                                  [--gateway <gateway> | --no-gateway] <subnet>
                                    - --dhcp
- Enable DHCP
- --no-dhcp
- Disable DHCP
- --dns-nameserver <dns-nameserver>
- DNS server IP address. This option can be used multiple times.
- --allocation-pool <allocation-pool>
- Allocation pool to create inside the network in the format: <starting_ip_address>-<ending_ip_address>. This option can be used multiple times.
- --gateway <gateway>
- Gateway IP address
- --no-gateway
- Do not configure a gateway for this network.
- <subnet>
- Subnet ID
For example, to add more IP addresses to the subnet allocation pool, run:
# vinfra service compute subnet set 8d2169a1-3459-4e87-9f5c-6d2d20353eea --allocation-pool 10.136.18.201-10.136.18.250
To delete a subnet from a physical compute network
Admin panel
- On the Compute > Networks tab, click the desired physical network.
- 
                                            In the Subnets section, click the bin icon next to the subnet you want to remove. You cannot delete the only subnet. 
Command-line interface
Use the following command:
vinfra service compute subnet delete <subnet>
- <subnet>
- Subnet ID
For example, to delete the IPv6 subnet from the physical network public, run:
# vinfra service compute subnet delete afa4710a-a82c-4273-a1b0-72d5d2884be6
 See also
See also