
Creating a Network with a specific VLAN
When the user creates a Network, the VLAN ID is automatically assigned to it. However, there can be situations when a Network is required to use a specific VLAN. This can happen when the physical network is preconfigured to carry a certain type of traffic using a specific VLAN ID.
Getting ready
You will need the following information to create a Network with a specific VLAN:
- The project (tenant) name for which the Network needs to be created
- A VLAN ID from the range configured in the ML2 configuration file
How to do it…
The following steps will show you how to create a Network with a specific VLAN ID:
- Log in to the OpenStack Horizon dashboard using a user ID with an administrative role.
- In the left navigation menu, click on Admin | System and Networks.
- On the right-hand side, we will get a list of all the Networks. As we logged in with an administrative role, we should be able to view all the networks across all the projects:
- Click on the + Create Network button to display the Create Network screen for the administrators. Note that this screen is different from the one shown for tenants, which is as follows:
- Enter a name for the Network. Select a Project and select VLAN as Provider Network Type. Once you choose VLAN as the Network type, the screen will prompt you to provide more details as shown here:
- Enter
physnet1
as the value for Physical Network. This was the alias that was used when configuring OVS as the mechanism driver in the recipe titled Configuring Neutron to use the Open vSwitch mechanism driver. - In the Segmentation ID field, enter a VLAN ID from the range that was configured for Neutron. Note that if you enter a VLAN ID that is already in use, the create network request will fail.
- Now click on Create Network. Once the network creation succeeds, the network will show in the list. Note that this mechanism creates a Network without a subnet. Therefore, you will see that the Subnets Associated column is empty:
- Click on the Network name of the newly created Network to view its details. You can see that the Segmentation ID that we entered has been used to create the Network:
Users can use the + Create Subnet button to add a Subnet to this Network. The preceding steps showed you how a user with an administrative role could create a Network with a specific VLAN.
How it works…
When a network is created as shown in this recipe, the Neutron server validates the segmentation ID against the VLAN ID range configured in Neutron. If the segmentation ID falls within the range, Neutron will check whether the segmentation ID is already in use or not. If the ID is not in use, then the Network creation will succeed.