Create a subnet
Create a subnet to divide and isolate network traffic.
Before you begin Copy linkLink copied!
- The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. - The
python-openstackclientpackage is on your workstation.$ dnf list installed python-openstackclient
About this task Copy linkLink copied!
Subnets logically divide a network to provide efficiency and isolation.
Instances that use the same subnet can communicate without passing data traffic through a router. Locating systems that require a high volume of traffic between them in the same subnet avoids the subsequent latency and load.
By using different subnets for different purposes, you can isolate data traffic. For example, web server traffic might use one subnet, and database traffic might use another subnet. Instances that want to communicate with instances in another subnet must direct their data traffic through a router.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Confirm that the subnet was added:
$ openstack subnet list -c Name -c Network -c Subnet --max-width=72- Sample output
-
+----------------------+-------------------------+---------------------+ | Name | Network | Subnet | +----------------------+-------------------------+---------------------+ | private_subnet24 | 317be3d3-5265-43f7-b52b | 10.0.24.0/24 | | | -930e3fd19b8b | | | lb-mgmt-subnet | c4588d49-9151-414b-8832 | 172.24.0.0/16 | | | -37313e3b4c57 | | | external_subnet | bcdb3cc0-8c0b-4d2d-813c | 10.0.0.0/24 | | | -e141bb97aa8f | | | external_ipv6_subnet | bcdb3cc0-8c0b-4d2d-813c | 2620:52:0:13b8::/64 | | | -e141bb97aa8f | | | private_subnet | 317be3d3-5265-43f7-b52b | 10.0.1.0/24 | | | -930e3fd19b8b | | +----------------------+-------------------------+---------------------+When you create instances, you can configure them now to use its subnet, and they receive any specified DHCP options.
What to do next Copy linkLink copied!
- If you need to modify the subnet, use the
openstack subnet setcommand.
Multi-tenancy networking with subnets Copy linkLink copied!
Plan your subnets to provide secure, efficient multi-tenancy networking.
Subnets enable network connectivity to instances. A subnet is a pool of IP addresses. Instances are assigned to a Networking service (neutron) network. One network can have multiple subnets, and you can also add IP addresses from multiple subnets to the port.
You can create subnets only in pre-existing networks. Project networks in the Networking service can host multiple subnets. This is useful if you intend to host distinctly different systems in the same network, and prefer a measure of isolation between them.
You can decrease network latency and load by grouping systems in the same subnet that require a high volume of traffic between each other.
Create an IPv6 subnet with Stateful DHCPv6 Copy linkLink copied!
Create an IPv6 subnet by using Stateful DHCPv6.
Before you begin Copy linkLink copied!
- The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. - The
python-openstackclientpackage is on your workstation.$ dnf list installed python-openstackclient
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Validate this configuration by reviewing the network list.
$ openstack network list -c Name -c Subnets --max-width=72- Sample output
-
Note that the entry for
private2now reflects the newly created IPv6 subnet:+-------------+--------------------------------------------------------+ | Name | Subnets | +-------------+--------------------------------------------------------+ | private | 47d34cf0-0dd2-49bd-a985-67311d80c5c4, | | | 82014d36-9e60-43eb-92fc-74674573f4e8, | | | d7535565-113f-4192-baa6-da21f301f141 | | private2 | 7ee56cef-83c0-40d1-b4e7-5287dae1c23c, | | | cdfc3398-997b-46eb-9db1-ebbd88f7de05 | | public | 6745edd4-d15f-4971-89bf-70307b0ad2f1, | | | cc3f81bb-4d55-4ead-aad4-5362a7ca5b04 | | lb-mgmt-net | 5ca08724-568c-4030-93eb-f2e286570a25 | +-------------+--------------------------------------------------------+
- Create an instance, and confirm that the instance is associated with a DHCP IPv6 address when added to the
private2subnet:$ openstack server list -c Name -c Status -c Networks- Sample output
-
+---------+--------+-----------------------------+ | Name | Status | Networks | +---------+--------+-----------------------------+ | server1 | ACTIVE | private2=fdf8:f53b:82e4::52 | +---------+--------+-----------------------------+
IPv6 subnet configuration options Copy linkLink copied!
Review IPv6 subnet address and router advertisement mode options.
RHOSO does not support IPv6 prefix delegation from an external entity. You must obtain the Global Unicast Address (GUA) prefix from your external prefix delegation router and set it by using the subnet-range argument during creation of a IPv6 subnet.
- Example
-
$ openstack subnet create --ip-version 6\ --subnet-range 2002:c000:200::64 \ --no-dhcp \ --gateway 2002:c000:2fe:: \ --dns-nameserver 2002:c000:2fe:: \ --network provider \ provider-subnet-2002:c000:200:: - Sample output
-
+----------------------+--------------------------------------+ | Field | Value | +----------------------+--------------------------------------+ | allocation_pools | 2002:c000:200::64-2002:c000:200::64 | | cidr | 2002:c000:200::64/128 | | created_at | 2024-09-24T19:30:07Z | | description | | | dns_nameservers | 2002:c000:2fe:: | | dns_publish_fixed_ip | None | | enable_dhcp | False | | gateway_ip | 2002:c000:200::64 | | host_routes | | | id | 49dda67d-814e-457b-b14b-77ef32935c0f | | ip_version | 6 | | ipv6_address_mode | None | | ipv6_ra_mode | None | | name | provider-subnet-2002:c000:200:: | | network_id | bcdb3cc0-8c0b-4d2d-813c-e141bb97aa8f | | prefix_length | None | | project_id | 24089d2fe1a94dd29ca2f665794fbe92 | | revision_number | 0 | | segment_id | None | | service_types | None | | subnetpool_id | None | | tags | | | updated_at | 2024-09-24T19:30:07Z | +----------------------+--------------------------------------+
| RA Mode | Address Mode | Result |
|---|---|---|
| ipv6_ra_mode=not set |
ipv6-address-mode=slaac |
The instance receives an IPv6 address from the external router (not managed by OpenStack Networking) using stateless address autoconfiguration (SLAAC). The RHOSO Networking service (neutron) supports only EUI-64 IPv6 address assignment for SLAAC. This allows for simplified IPv6 networking, as hosts self-assign addresses based on the base 64-bits plus the MAC address. You cannot create subnets with a different netmask and address_assign_type of SLAAC. |
| ipv6_ra_mode=not set |
ipv6-address-mode=dhcpv6-stateful |
The instance receives an IPv6 address and optional information from the Networking service (dnsmasq) using DHCPv6 stateful. |
| ipv6_ra_mode=not set |
ipv6-address-mode=dhcpv6-stateless |
The instance receives an IPv6 address from the external router using SLAAC, and optional information from the Networking service (dnsmasq) using DHCPv6 stateless. |
| ipv6_ra_mode=slaac |
ipv6-address-mode=not-set |
The instance uses SLAAC to receive an IPv6 address from the Networking service (radvd). |
| ipv6_ra_mode=dhcpv6-stateful |
ipv6-address-mode=not-set |
The instance receives an IPv6 address and optional information from an external DHCPv6 server using DHCPv6 stateful. |
| ipv6_ra_mode=dhcpv6-stateless |
ipv6-address-mode=not-set |
The instance receives an IPv6 address from the Networking service (radvd) using SLAAC, and optional information from an external DHCPv6 server using DHCPv6 stateless. |
| ipv6_ra_mode=slaac |
ipv6-address-mode=slaac |
The instance receives an IPv6 address from the Networking service (radvd) using SLAAC. |
| ipv6_ra_mode=dhcpv6-stateful |
ipv6-address-mode=dhcpv6-stateful |
The instance receives an IPv6 address from OpenStack Networking (dnsmasq) using DHCPv6 stateful, and optional information from OpenStack Networking (dnsmasq) using DHCPv6 stateful. |
| ipv6_ra_mode=dhcpv6-stateless |
ipv6-address-mode=dhcpv6-stateless |
The instance receives an IPv6 address from OpenStack Networking (radvd) using SLAAC, and optional information from OpenStack Networking (dnsmasq) using DHCPv6 stateless. |
Remove an unused subnet Copy linkLink copied!
Delete a subnet that is no longer in use.
Before you begin Copy linkLink copied!
- The administrator has created a project for you and has provided you with a
clouds.yamlfile for you to access the cloud. - The
python-openstackclientpackage is on your workstation.$ dnf list installed python-openstackclient - No instances are configured to use the subnet that you want to delete.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Confirm that the subnet was deleted:
$ openstack subnet list -c Name -c Network -c Subnet --max-width=72- Sample output
-
+----------------------+-------------------------+---------------------+ | Name | Network | Subnet | +----------------------+-------------------------+---------------------+ | lb-mgmt-subnet | c4588d49-9151-414b-8832 | 172.24.0.0/16 | | | -37313e3b4c57 | | | external_subnet | bcdb3cc0-8c0b-4d2d-813c | 10.0.0.0/24 | | | -e141bb97aa8f | | | private2_subnet | 56e73380-a771-408f-bdc0 | 10.1.2.0/24 | | | -1e97f79677c6 | | | private_subnet2 | 317be3d3-5265-43f7-b52b | 10.0.2.0/24 | | | -930e3fd19b8b | | | external_ipv6_subnet | bcdb3cc0-8c0b-4d2d-813c | 2620:52:0:13b8::/64 | | | -e141bb97aa8f | | | private_subnet | 317be3d3-5265-43f7-b52b | 10.0.1.0/24 | | | -930e3fd19b8b | | +----------------------+-------------------------+---------------------+