Chapter 2. Managing project networks
Chapter 2. Managing project networks Project networks help you to isolate network traffic for cloud computing. You can create IPv4 or IPv6 networks and subnets, and use routers to connect them. This section contains the following topics: Section 2.1, "Creating a network" Section 2.2, "Creating a subnet" Section 2.3, "IPv6 subnet options" Section 2.4, "Create an IPv6 subnet using Stateful DHCPv6" Section 2.5, "DVR overview" Section 2.6, "Adding a router" Section 2.7, "Adding a subnet to a router" Section 2.8, "Removing a subnet from a router" Section 2.9, "Purging all resources and deleting a project" Section 2.10, "Deleting a router" Section 2.11, "Deleting a subnet" Section 2.12, "Deleting a network" 2.1. Creating a network Create a network so that instances in your Red Hat OpenStack Services on OpenShift (RHOSO) can communicate with each other and receive IP addresses using DHCP. For more information about external network connections, see Bridging the physical network in Configuring networking services . Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Create a network. Example USD openstack network create my_network Tip If you do not intend to enter the network into production immediately, you can add the --disable option to the create network command. Consider naming your network for the role that the network provides. One example: webservers_122 is a network that host web servers and the VLAN ID is 122 . Verification Confirm that the network was added: USD openstack network list -c Name Sample output +-------------+ | Name | +-------------+ | my_network | | private | | public | | lb-mgmt-net | +-------------+ steps If you need to modify the network, use the openstack network set command. Most networks need at least one subnet. Proceed to Section 2.2, "Creating a subnet" . Additional resources network create in Command line interface reference network set in Command line interface reference 2.2. Creating a subnet Red Hat OpenStack Services on OpenShift (RHOSO) environments rely on subnets to logically divide a network as a means to provide efficiency and isolation. VM instances using 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. Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Obtain the name of the network to which you want to add a subnet: USD openstack network list Create a subnet. USD openstack subnet create <subnet-name> --subnet-range <CIDR> --network <name> Replace <subnet-name> with the name of the subnet you are creating. Replace <CIDR> with the IP address range and subnet mask in CIDR format. To determine the CIDR address, calculate the number of bits masked in the subnet mask and append that value to the IP address range. For example, the subnet mask 255.255.255.0 has 24 masked bits. To use this mask with the IPv4 address range 192.168.122.0, specify the address 192.168.122.0/24. Replace <name> with the name of the network to which you are adding the subnet. Tip DHCP services automate the distribution of IP settings to your instances and is enabled by default. Specify --no-dhcp to diable DHCP. Verification Confirm that the subnet was added: USD 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. steps If you need to modify the subnet, use the openstack subnet set command. Additional resources subnet create in Command line interface reference subnet set in Command line interface reference 2.3. IPv6 subnet options In Red Hat OpenStack Services on OpenShift (RHOSO) environments, when you create IPv6 subnets in a project network you can specify address mode and router advertisement mode to obtain a particular result as described in the following table. Note 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 USD 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). Note 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 . Additional resources Create an IPv6 subnet using Stateful DHCPv6 2.4. Create an IPv6 subnet using Stateful DHCPv6 In Red Hat OpenStack Services on OpenShift (RHOSO) environments, you can create an IPv6 subnet in a Red Hat OpenStack (RHOSP) project network. Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Obtain the project ID of the project where you want to create the IPv6 subnet. Retain this ID, because you will need it later: USD openstack project list Sample output +----------------------------------+----------+ | ID | Name | +----------------------------------+----------+ | 25837c567ed5458fbb441d39862e1399 | QA | | f59f631a77264a8eb0defc898cb836af | admin | | 4e2e1951e70643b5af7ed52f3ff36539 | demo | | 8561dff8310e4cd8be4b6fd03dc8acf5 | services | +----------------------------------+----------+ Obtain the name of the network where you want to host the IPv6 subnet. Retain this name, because you will need it later: USD openstack network list -c Name -c Subnets --max-width=72 Sample output +-------------+--------------------------------------------------------+ | Name | Subnets | +-------------+--------------------------------------------------------+ | private | 47d34cf0-0dd2-49bd-a985-67311d80c5c4, | | | 82014d36-9e60-43eb-92fc-74674573f4e8, | | | d7535565-113f-4192-baa6-da21f301f141 | | private2 | 7ee56cef-83c0-40d1-b4e7-5287dae1c23c | | public | 6745edd4-d15f-4971-89bf-70307b0ad2f1, | | | cc3f81bb-4d55-4ead-aad4-5362a7ca5b04 | | lb-mgmt-net | 5ca08724-568c-4030-93eb-f2e286570a25 | +-------------+--------------------------------------------------------+ Using the project ID and network name, create an IPv6 subnet: Example USD openstack subnet create --ip-version 6 --ipv6-address-mode \ dhcpv6-stateful --project 25837c567ed5458fbb441d39862e1399 \ --network private2 --subnet-range fdf8:f53b:82e4::53/125 \ subnet_name Sample output +-------------------+--------------------------------------------------------------+ | Field | Value | +-------------------+--------------------------------------------------------------+ | allocation_pools | {"start": "fdf8:f53b:82e4::52", "end": "fdf8:f53b:82e4::56"} | | cidr | fdf8:f53b:82e4::53/125 | | dns_nameservers | | | enable_dhcp | True | | gateway_ip | fdf8:f53b:82e4::51 | | host_routes | | | id | cdfc3398-997b-46eb-9db1-ebbd88f7de05 | | ip_version | 6 | | ipv6_address_mode | dhcpv6-stateful | | ipv6_ra_mode | | | name | | | network_id | 6aff6826-4278-4a35-b74d-b0ca0cbba340 | | tenant_id | 25837c567ed5458fbb441d39862e1399 | +-------------------+--------------------------------------------------------------+ Verification Validate this configuration by reviewing the network list. USD openstack network list -c Name -c Subnets --max-width=72 Sample output Note that the entry for private2 now reflects the newly created IPv6 subnet: Create an instance, and confirm that the instance is associated with a DHCP IPv6 address when added to the private2 subnet: USD openstack server list -c Name -c Status -c Networks Sample output +---------+--------+-----------------------------+ | Name | Status | Networks | +---------+--------+-----------------------------+ | server1 | ACTIVE | private2=fdf8:f53b:82e4::52 | +---------+--------+-----------------------------+ Additional resources IPv6 subnet options subnet create in Command line interface reference 2.5. DVR overview In Red Hat OpenStack Services on OpenShift (RHOSO) environments, distributed virtual routing (DVR) isolates the failure domain of the control plane and optimizes network traffic by using layer 3 high availability (L3 HA) and scheduling routers on every Compute node. DVR has these characteristics: East-West traffic is routed directly on the Compute nodes in a distributed fashion. North-South traffic that uses floating IP addresses is distributed and routed on the Compute nodes. This requires the external network to be connected to every Compute node. North-South traffic without floating IP addresses (SNAT traffic) is not distributed. The OVN metadata agent is distributed and deployed on all Compute nodes. The metadata proxy service is hosted on all the distributed routers. 2.6. Adding a router In Red Hat OpenStack Services on OpenShift (RHOSO) environments, the Networking service (neutron) provides routing services using an SDN-based virtual router. Routers are a requirement for your instances to communicate with external subnets, including those in the physical network. Routers and subnets connect using interfaces, with each subnet requiring its own interface to the router. The default gateway of a router defines the hop for any traffic received by the router. Its network is typically configured to route traffic to the external physical network using a virtual bridge. Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Create a router. USD openstack router create <router-name> --external-gateway <network> \ --project <name> Replace <router-name> with the name of the router you are creating. Replace <network> with the name of an external network. Replace <name> with the name of your project. Tip If you want to create a router in an availability zone (AZ) add the --availability-zone-hint <availability-zone> option. Repeat the option to set multiple AZs. Verification Confirm that the router was created: USD openstack router list -c Name -c Status -c State -c Project Sample output +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | | router2 | ACTIVE | UP | ecf285621c509223ade3358691bbde59 | +---------+--------+-------+----------------------------------+ steps Proceed to Adding a subnet to a router . Additional resources subnet create in Command line interface reference subnet set in Command line interface reference 2.7. Adding a subnet to a router In Red Hat OpenStack Services on OpenShift (RHOSO) environments, to allow traffic to be routed to and from your network, you must add an interface to the subnet to an existing virtual router. Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. You have access to a virtual router. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Obtain the virtual router name that you are using to route traffic to and from your network. Retain this name, because you will need it later: USD openstack router list Sample output +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | | router2 | ACTIVE | UP | ecf285621c509223ade3358691bbde59 | +---------+--------+-------+----------------------------------+ Obtain the name of the subnet for which you want to add an interface for your router. Retain this name, because you will need it later: USD 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 | | +----------------------+-------------------------+---------------------+ Using the router and subnet names, add an interface to your router for the subnet. Example In this example, private_subnet is added as an interface on router2 : USD openstack router add subnet router2 private_subnet Verification Confirm that the router lists the interface that was added: Example USD openstack router show router2 --max-width=72 Sample output Additional resources Adding a router 2.8. Removing a subnet from a router In Red Hat OpenStack Services on OpenShift (RHOSO) environments, if you no longer require a router to direct network traffic to a subnet, you can remove the corresponding interface from the router. Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. You have access to a virtual router. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Obtain the virtual router name that contains the interface to a subnet that you want to remove. Retain this name, because you will need it later: USD openstack router list Sample output +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | | router2 | ACTIVE | UP | ecf285621c509223ade3358691bbde59 | +---------+--------+-------+----------------------------------+ Obtain the name of the subnet that you are using as the interface for your router. Retain this name, because you will need it later: USD 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 | | +----------------------+-------------------------+---------------------+ Using the router and subnet names, remove the interface from your router. Example In this example, private_subnet is removed as an interface on router2 : USD openstack router remove subnet router2 private_subnet Verification Confirm that the subnet has been removed from the router: Example USD openstack router show router2 --max-width=72 Sample output Additional resources router remove subnet in Command line interface reference 2.9. Purging all resources and deleting a project In Red Hat OpenStack Services on OpenShift (RHOSO) environments, you can delete all resources that belong to a particular project as well as deleting the project, too. Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Using the project name, delete the project and all of the resources associated with the project: Example In this example, test-project is deleted: USD openstack project purge --project test-project Verification Confirm that the project has been deleted: USD openstack project list Sample output +----------------------------------+--------------+ | ID | Name | +----------------------------------+--------------+ | 519e6344f82e4c079c8e2eabb690023b | services | | 80bf5732752a41128e612fe615c886c6 | demo | | 98a2f53c20ce4d50a40dac4a38016c69 | admin | +----------------------------------+--------------+ Additional resources project purge in Command line interface reference 2.10. Deleting a router In Red Hat OpenStack Services on OpenShift (RHOSO) environments, you can delete a router if it has no connected interfaces. Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. No interfaces are connected to the router that you want to delete. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Obtain the name of the router that you want to delete. Retain this name, because you will need it later. USD openstack router list -c Name -c Status -c State -c Project Sample output +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | | router2 | ACTIVE | UP | ecf285621c509223ade3358691bbde59 | +---------+--------+-------+----------------------------------+ Using the router name, delete the router. Example In this example, router2 is deleted: USD openstack router delete router2 Verification Confirm that the router was deleted: USD openstack router list -c Name -c Status -c State -c Project Sample output +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | +---------+--------+-------+----------------------------------+ Additional resources router delete in Command line interface reference 2.11. Deleting a subnet In Red Hat OpenStack Services on OpenShift (RHOSO) environments, you can delete a subnet if it is no longer in use. Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. No instances are configured to use the subnet that you want to delete. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Obtain the name of the subnet that you want to delete. Retain this name, because you will need it later. USD openstack subnet list 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 | | | 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 | | +----------------------+-------------------------+---------------------+ Using the subnet name, delete the subnet. Example In this example, private_subnet24 is deleted: USD openstack subnet delete private_subnet24 Verification Confirm that the subnet was deleted: USD 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 | | +----------------------+-------------------------+---------------------+ Additional resources subnet create in Command line interface reference subnet set in Command line interface reference 2.12. Deleting a network In Red Hat OpenStack Services on OpenShift (RHOSO) environments, there are occasions where it becomes necessary to delete a network that was previously created, perhaps as housekeeping or as part of a decommissioning process. Prerequisites The administrator has created a project for you and has provided you with a clouds.yaml file for you to access the cloud. The python-openstackclient package resides on your workstation. No interfaces are connected to the network that you want to delete. Procedure Confirm that the system OS_CLOUD variable is set for your cloud: USD echo USDOS_CLOUD my_cloud Reset the variable if necessary: USD export OS_CLOUD=my_other_cloud As an alternative, you can specify the cloud name by adding the --os-cloud <cloud_name> option each time you run an openstack command. Obtain the name of the network that you want to delete. Retain this name, because you will need it later. USD openstack network list -c Name Sample output +-------------+ | Name | +-------------+ | my_network | | private | | public | | lb-mgmt-net | +-------------+ Using the network name, delete the network. Example In this example, my_network is deleted: USD openstack network delete my_network Verification Confirm that the network was deleted: USD openstack network list -c Name Sample output +-------------+ | Name | +-------------+ | private | | public | | lb-mgmt-net | +-------------+ Additional resources link:https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/command_line_interface_reference/network#network_delete [network delete] in Command line interface reference
dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack network create my_network openstack network list -c Name +-------------+ | Name | +-------------+ | my_network | | private | | public | | lb-mgmt-net | +-------------+ dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack network list openstack subnet create <subnet-name> --subnet-range <CIDR> --network <name> openstack subnet list -c Name -c Network -c Subnet --max-width=72 +----------------------+-------------------------+---------------------+ | 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 | | +----------------------+-------------------------+---------------------+ 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:: +----------------------+--------------------------------------+ | 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 | +----------------------+--------------------------------------+ dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack project list +----------------------------------+----------+ | ID | Name | +----------------------------------+----------+ | 25837c567ed5458fbb441d39862e1399 | QA | | f59f631a77264a8eb0defc898cb836af | admin | | 4e2e1951e70643b5af7ed52f3ff36539 | demo | | 8561dff8310e4cd8be4b6fd03dc8acf5 | services | +----------------------------------+----------+ openstack network list -c Name -c Subnets --max-width=72 +-------------+--------------------------------------------------------+ | Name | Subnets | +-------------+--------------------------------------------------------+ | private | 47d34cf0-0dd2-49bd-a985-67311d80c5c4, | | | 82014d36-9e60-43eb-92fc-74674573f4e8, | | | d7535565-113f-4192-baa6-da21f301f141 | | private2 | 7ee56cef-83c0-40d1-b4e7-5287dae1c23c | | public | 6745edd4-d15f-4971-89bf-70307b0ad2f1, | | | cc3f81bb-4d55-4ead-aad4-5362a7ca5b04 | | lb-mgmt-net | 5ca08724-568c-4030-93eb-f2e286570a25 | +-------------+--------------------------------------------------------+ openstack subnet create --ip-version 6 --ipv6-address-mode dhcpv6-stateful --project 25837c567ed5458fbb441d39862e1399 --network private2 --subnet-range fdf8:f53b:82e4::53/125 subnet_name +-------------------+--------------------------------------------------------------+ | Field | Value | +-------------------+--------------------------------------------------------------+ | allocation_pools | {"start": "fdf8:f53b:82e4::52", "end": "fdf8:f53b:82e4::56"} | | cidr | fdf8:f53b:82e4::53/125 | | dns_nameservers | | | enable_dhcp | True | | gateway_ip | fdf8:f53b:82e4::51 | | host_routes | | | id | cdfc3398-997b-46eb-9db1-ebbd88f7de05 | | ip_version | 6 | | ipv6_address_mode | dhcpv6-stateful | | ipv6_ra_mode | | | name | | | network_id | 6aff6826-4278-4a35-b74d-b0ca0cbba340 | | tenant_id | 25837c567ed5458fbb441d39862e1399 | +-------------------+--------------------------------------------------------------+ openstack network list -c Name -c Subnets --max-width=72 ------------- --------------------------------------------------------+ | 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 | ------------- --------------------------------------------------------+ openstack server list -c Name -c Status -c Networks +---------+--------+-----------------------------+ | Name | Status | Networks | +---------+--------+-----------------------------+ | server1 | ACTIVE | private2=fdf8:f53b:82e4::52 | +---------+--------+-----------------------------+ dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack router create <router-name> --external-gateway <network> --project <name> openstack router list -c Name -c Status -c State -c Project +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | | router2 | ACTIVE | UP | ecf285621c509223ade3358691bbde59 | +---------+--------+-------+----------------------------------+ dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack router list +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | | router2 | ACTIVE | UP | ecf285621c509223ade3358691bbde59 | +---------+--------+-------+----------------------------------+ openstack subnet list -c Name -c Network -c Subnet --max-width=72 +----------------------+-------------------------+---------------------+ | 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 | | +----------------------+-------------------------+---------------------+ openstack router add subnet router2 private_subnet openstack router show router2 --max-width=72 ------------------------- --------------------------------------------+ | Field | Value | ------------------------- --------------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2024-09-09T06:27:48Z | | description | | | external_gateway_info | {"network_id": | | | "bcdb3cc0-8c0b-4d2d-813c-e141bb97aa8f", | | | "external_fixed_ips": [{"subnet_id": | | | "6745edd4-d15f-4971-89bf-70307b0ad2f1", | | | "ip_address": "10.0.0.167"}, {"subnet_id": | | | "cc3f81bb-4d55-4ead-aad4-5362a7ca5b04", | | | "ip_address": "2620:52:0:13b8::1000:85"}], | | | "enable_snat": true} | | flavor_id | None | | id | 9119eade-cf28-42d7-a33d-eb589469bf62 | | interfaces_info | [{"port_id": | | | "5a40b083-27d0-4691-8208-99c507181a33", | | | "ip_address": "10.0.24.1", "subnet_id": | | | "47d34cf0-0dd2-49bd-a985-67311d80c5c4"}, | | | {"port_id": | | | "642e522e-2cbd-47b5-8f8b-88c1b5d5e535", | | | "ip_address": "10.1.2.1", "subnet_id": | | | "7ee56cef-83c0-40d1-b4e7-5287dae1c23c"}, | | | {"port_id": | | | "9f695259-680c-40a8-bbed-9ca84dd77c33", | | | "ip_address": "10.0.1.1", "subnet_id": | | | "d7535565-113f-4192-baa6-da21f301f141"}, | | | {"port_id": | | | "f43a55a7-2e91-4cb7-a6b2-b3b686fc2ebd", | | | "ip_address": "10.0.2.1", "subnet_id": | | | "317be3d3-5265-43f7-b52b-930e3fd19b8b"}] | | name | router2 | | project_id | ecf285621c509223ade3358691bbde59 | | revision_number | 7 | | routes | | | status | ACTIVE | | tags | | | updated_at | 2024-09-09T09:28:40Z | ------------------------- --------------------------------------------+ dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack router list +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | | router2 | ACTIVE | UP | ecf285621c509223ade3358691bbde59 | +---------+--------+-------+----------------------------------+ openstack subnet list -c Name -c Network -c Subnet --max-width=72 +----------------------+-------------------------+---------------------+ | 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 | | +----------------------+-------------------------+---------------------+ openstack router remove subnet router2 private_subnet openstack router show router2 --max-width=72 ------------------------- --------------------------------------------+ | Field | Value | ------------------------- --------------------------------------------+ | admin_state_up | UP | | availability_zone_hints | | | availability_zones | | | created_at | 2024-09-09T06:27:48Z | | description | | | external_gateway_info | {"network_id": | | | "bcdb3cc0-8c0b-4d2d-813c-e141bb97aa8f", | | | "external_fixed_ips": [{"subnet_id": | | | "6745edd4-d15f-4971-89bf-70307b0ad2f1", | | | "ip_address": "10.0.0.167"}, {"subnet_id": | | | "cc3f81bb-4d55-4ead-aad4-5362a7ca5b04", | | | "ip_address": "2620:52:0:13b8::1000:85"}], | | | "enable_snat": true} | | flavor_id | None | | id | 9119eade-cf28-42d7-a33d-eb589469bf62 | | interfaces_info | [{"port_id": | | | "5a40b083-27d0-4691-8208-99c507181a33", | | | "ip_address": "10.0.24.1", "subnet_id": | | | "47d34cf0-0dd2-49bd-a985-67311d80c5c4"}, | | | {"port_id": | | | "642e522e-2cbd-47b5-8f8b-88c1b5d5e535", | | | "ip_address": "10.1.2.1", "subnet_id": | | | "7ee56cef-83c0-40d1-b4e7-5287dae1c23c"}, | | | {"port_id": | | | "9f695259-680c-40a8-bbed-9ca84dd77c33", | | | "ip_address": "10.0.1.1", "subnet_id": | | | "d7535565-113f-4192-baa6-da21f301f141"}, | | name | router2 | | project_id | ecf285621c509223ade3358691bbde59 | | revision_number | 7 | | routes | | | status | ACTIVE | | tags | | | updated_at | 2024-09-09T11:14:33Z | ------------------------- --------------------------------------------+ dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack project purge --project test-project openstack project list +----------------------------------+--------------+ | ID | Name | +----------------------------------+--------------+ | 519e6344f82e4c079c8e2eabb690023b | services | | 80bf5732752a41128e612fe615c886c6 | demo | | 98a2f53c20ce4d50a40dac4a38016c69 | admin | +----------------------------------+--------------+ dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack router list -c Name -c Status -c State -c Project +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | | router2 | ACTIVE | UP | ecf285621c509223ade3358691bbde59 | +---------+--------+-------+----------------------------------+ openstack router delete router2 openstack router list -c Name -c Status -c State -c Project +---------+--------+-------+----------------------------------+ | Name | Status | State | Project | +---------+--------+-------+----------------------------------+ | router1 | ACTIVE | UP | 24089d2fe1a94dd29ca2f665794fbe92 | +---------+--------+-------+----------------------------------+ dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack subnet list +----------------------+-------------------------+---------------------+ | 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 | | | 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 | | +----------------------+-------------------------+---------------------+ openstack subnet delete private_subnet24 openstack subnet list -c Name -c Network -c Subnet --max-width=72 +----------------------+-------------------------+---------------------+ | 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 | | +----------------------+-------------------------+---------------------+ dnf list installed python-openstackclient echo USDOS_CLOUD my_cloud export OS_CLOUD=my_other_cloud openstack network list -c Name +-------------+ | Name | +-------------+ | my_network | | private | | public | | lb-mgmt-net | +-------------+ openstack network delete my_network openstack network list -c Name +-------------+ | Name | +-------------+ | private | | public | | lb-mgmt-net | +-------------+