Create Private Networks with IPv4 and IPv6 Subnets
-
Create private network with IPv4 subnet
To create a private network, navigate to Project > Network > Networks and click Create Network.
A popup window will appear with the Create Network form, which is divided into three tabs: Network, Subnet, and Subnet Details, each described below.
Network tab
- Network Name (required): This field specifies the name of the new network.
- Enable Admin state: This option allows you to enable or disable the administrative state of the network. When enabled, the network is active and operational. When disabled, the network is administratively down.
- Create Subnet (required to create either an IPv4 or IPv6 subnet upon network creation): This option must be selected if you want to create a subnet for the network during its creation. It is necessary for defining the network's IP address range and other related settings. You can always uncheck this checkbox and add subnets later. Adding subnets to already existing network is described below in Add IPv6 subnet to your private network
- Availability Zone Hints: (Please leave this field empty) This field allows you to specify availability zones (AZs) where the DHCP agents will be scheduled. Leaving this field empty will set the network in the nova AZ automatically.
- MTU: (Please leave this field empty) This field specifies the Maximum Transmission Unit size for the network. MTU defines the largest size of packets that can be transmitted on the network.
You only need to provide the Network Name. The other fields, such as Enable Admin state, Create Subnet, and Availability Zone Hints, can be left at their default values unless you have specific needs to configure them.
Subnet tab
- Subnet Name(Required): Enter a name for the subnet you are creating.
-
Network Address Source: Choose how you want to assign the network address. The options are:
- Enter Network Address Manually: Allows you to manually specify the network address - this option is recommended for IPv4 subnet.
- Allocate Network Address from a Pool: Allows you to select a network address from a predefined pool - this option is recommended for IPv6 subnet.
-
Network Address: This field is available when
Enter Network Address Manually
is selected in the Network Address Source field. Here, you can manually enter the desired network address e.g. 192.168.0.0/16 for IPv4. For more information about private IPv4 addresses please check Private Network.
Subnet Details tab
After filling out the Subnet tab form go to Subnet Details tab (click Next in the bottom of the form or on Subnet Details tab in the upper section of the dialog) and just click the Create in the bottom of the dialog.
Congratulations! You have now created a private network with one IPv4 subnet. Proceed to add the IPv6 subnet to your newly created network.
-
Add IPv6 subnet to your private network
There are two options to add subnets to already existing network, choose one of them and you will be transferred to Create Subnet dialog.
- Option 1 - click
Create Subnet
in the dropdown list of the Action column on the right side of your network in the networks list view. - Option 2 - click on the specific network in the network list view, go to Subnets tab and click Create Subnet.
In the Network Address Source field select
Allocate Network Address from a Pool
.In the new field Address pool that should appear below select
public-ipv6 (2001:620:6:e000::/51)
.In the new field Network Mask that should appear below leave the default value.
Select IPv6 in IP Version field.
Subnet Details tab
In this tab you should care only for the IPv6 Address Configuration Mode. Switch strongly recommends to select
DHCPv6 stateful: Address discovered from OpenStack DHCP
option.For more details regarding SLAAC and DHCPv6 in OpenStack visit Configure IPv6.
- Option 1 - click
Save below script in a file e.g. os-my-prviate-network.sh
and run it to create you private network through OpenStack CLI.
NETWORK="mynetwork"
# IPV4_RANGE="10.0.0.0/8"
# IPV4_RANGE="172.16.0.0/12"
IPV4_RANGE="192.168.0.0/16"
# create network and subnets IPv4 and IPv6
openstack network create $NETWORK
openstack subnet create $NETWORK-ipv4 \
--network $NETWORK \
--ip-version 4 \
--subnet-range ${IPV4_RANGE} \
--dhcp
openstack subnet create $NETWORK-ipv6 \
--network $NETWORK \
--ip-version 6 \
--ipv6-address-mode dhcpv6-stateful \
--ipv6-ra-mode dhcpv6-stateful \
--subnet-pool public-ipv6
Following the above instructions should result in creation of the private network with two subnets (IPv4 and IPv6).
After creating your private network, you should create a router to enable communication through SSH with your VM instance.
Important
Why you should create a Router after creating a private network?
To communicate with VM instance in IPv4 subnet you will require to create Floating IP and bind it with specific instance through router interface.
You DO NOT NEED a Floating IP to communicate with the instance in IPv6 subnet since it is already routed, and you can use VM IPv6 address in your ssh CLI command to connect with it.