Openstack Thumbnail

OpenStack CLI subnet commands for IPv4 and IPv6

Assumptions made here:

  • The public network has already been created
  • That by doing a openstack subnet list there is no subnets called public-v6 or public1
  • You have already installed the Openstack CLI client LINK using your preferred method.
  • You are not using the individual project CLI client for instance Neutron in this case but instead the common client.
  • That you are using the default gw of the first usable address in the subnet. If not you can manually select the gateway here --gateway

OpenStack CLI Commands

For IPv4

Actual terminal commands are below:
openstack subnet create --dhcp --network public --ip-version 6 --ipv6-address-mode slaac --subnet-range '2600:100:1:1::/64' '2600:100:1:1::/64' public-v6

For IPv6

Actual terminal commands are below:
openstack subnet create --network public --allocation-pool start=,end= --subnet-range public1

Confirmation of OpenStack CLI subnet Commands

You can confirm that you have created the subnets by using the OpenStack CLI subnet commands to show you your subnets. You will issue the following commands in order to the see the subnets from the CLI:

jfarr@nertwork1:~$ openstack subnet list
| ID | Name | Network | Subnet |
| 0dc86c16-f87b-4edf-b746-8832e7689444 | public1 | 75de19cb-cb43-42ff-97a2-847fc79fff3e | |

Here you will see your subnet, if you want more information you can issue the following commands:

openstack subnet show public1

Your output will be seen below:

jfarr@nertwork1:~$ openstack subnet show public1
| Field | Value |
| allocation_pools | |
| cidr | |
| created_at | 2017-12-05T19:51:53Z |
| description | |
| dns_nameservers | |
| enable_dhcp | True |
| gateway_ip | |
| host_routes | |

OpenStack CLI Commands Reference

Public subnets and networks do not actually mean public to the outside world in this guide. What they mean in this guide is that these networks can be accessed by anything outside of OpenStack that is routed to the OpenStack cluster. In this sense they are public networks.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.