OPCP - How to set up Trunk ports on a Node
Objective
Trunk ports allow a single instance (bare metal or virtual machine) to send and receive traffic on multiple Neutron networks using vlan tagging, through a single physical interface or an LACP bond.
This guide explains how to configure Neutron Trunk ports in OPCP to enable multi-network (vlan) connectivity on a bare metal node or a virtual machine.
This guide also shows how to configure vlan sub-interfaces within your instance to access each network attached to the trunk.
Trunk creation requires the admin role. A project user cannot create trunks.
Adding sub-ports to a trunk also requires admin rights by default, but this can be delegated by your administrator.
It is recommended to configure the trunk before deploying an instance.
This guide does not cover configuring a trunk on an instance that is already in production.
Why Use Trunk Ports?
Trunk ports can be used in three specific use cases:
- Multi-network access from a single instance: Trunk ports allow a bare metal server or a virtual machine to communicate on multiple isolated Neutron networks using vlan tagging, without needing separate ports for each network.
- Overcome physical interface limits on bare metal: On a bare metal server, the number of Neutron networks is normally limited by the number of physical network interfaces. With trunk ports, you can connect to more networks than available physical interfaces by multiplexing multiple vlans over a single interface or LACP bond.
- Simplified network management: Instead of provisioning multiple ports and attaching them individually, you create a single trunk with sub-ports, each tagged with a specific vlan ID. This keeps the network topology clean and manageable.
Requirements
Before starting, ensure you have the following:
- An active OPCP service.
- Configured OpenStack CLI access with the necessary permissions (
clouds.yamlor environment variables). - The admin role (required for trunk creation and sub-port management).
- At least two Neutron networks already created in your project (one for the parent port and one or more for sub-ports).
- An available bare metal node or virtual machine project.
Trunk port configuration is an advanced networking feature requiring familiarity with OpenStack Neutron networking concepts, vlan tagging, and the OpenStack CLI.
Instructions
Network and Trunk Configuration
1. Identify Your Networks
Before creating the trunk, identify the networks your instance needs access to. List the available networks in your project:
Example output:
2. Create the Parent Port
Create a Neutron port that will serve as the parent port of the trunk. This port is required by the Neutron trunk model to anchor the trunk to the instance.
Example:
Example output:
On bare metal instances, the parent port is a dummy port. It exists in the Neutron database but has no effect on the network fabric. The network assigned to the parent port will not carry any traffic to the instance. All actual network connectivity must be configured through sub-ports (see steps 4 and 5).
On virtual machines, the parent port carries the parent network as untagged traffic on the base interface. Sub-port networks are delivered as tagged vlan traffic.
3. Create the Trunk
Create a Neutron trunk using the parent port created in the previous step:
Example:
Example output:
At this point, the trunk exists but is not attached to any server. The parent port is a standard Neutron port that will be referenced when creating the instance.
4. Create a Sub-Port
Create a Neutron port on each network you want to make accessible through the trunk:
Example:
5. Add Sub-Port to the Trunk
Attach the sub-port to the trunk, specifying the segmentation type (vlan) and the segmentation ID matching the network's vlan tag:
Example:
The behaviour of segmentation-id differs depending on the instance type:
- Bare metal: the
segmentation-idmust match the segmentation ID of the network assigned to the sub-port. Neutron does not verify this value, but if it does not match, traffic will not reach the instance. - Virtual machines: the
segmentation-idcan be any value you choose. The hypervisor handles the translation between the sub-port vlan tag and the network's actual segmentation ID.
To add more networks, repeat steps 4 and 5 for each additional network. For bare metal instances, use the matching segmentation-id of each network.
6. Verify the Trunk Configuration
Confirm the trunk is properly configured with all expected sub-ports:
Example:
Example output:
7. Deploy an Instance Using the Trunk
Create the instance referencing the parent port. OpenStack will configure the trunk during provisioning.
Bare metal example:
Virtual machine example:
You must use --port (referencing the parent port) rather than --nic net-id=.... Using --nic would create a new port and bypass the trunk configuration entirely.
Summary of Steps
| Step | Action | Command |
|---|---|---|
| 1 | List networks | openstack network list |
| 2 | Create parent port | openstack port create --network <network-name> <parent-port-name> |
| 3 | Create trunk | openstack network trunk create --parent-port <parent-port-name> <trunk-name> |
| 4 | Create sub-port | openstack port create --network <network-name> <sub-port-name> |
| 5 | Add sub-port to trunk | openstack network trunk set --subport port=<sub-port-name>,segmentation-type=vlan,segmentation-id=<vlan-id> <trunk-name> |
| 6 | Verify trunk | openstack network trunk show <trunk-name> |
| 7 | Deploy instance | openstack server create --port <parent-port-name> --flavor <flavor> ... |
Instance Operating System Configuration
After deploying your instance, you need to configure vlan sub-interfaces inside the guest OS to access each network attached through the trunk sub-ports.
Automatic trunk configuration via cloud-init is not possible. OpenStack does not pass trunk metadata to the instance userdata. You must configure vlan sub-interfaces manually or through a post-deployment provisioning tool.
On bare metal instances, since the parent port is a dummy port with no effect on the network fabric, the base network interface will not have any network connectivity by default. All networks must be accessed through vlan sub-interfaces matching the segmentation-id assigned to each sub-port.
On virtual machines, the base interface carries the parent network as untagged traffic. Only sub-port networks require vlan sub-interfaces.
1. Identify the Main Network Interface
Connect to your instance and identify the primary network interface:
Look for the main interface (e.g., ens3, ens21f0np0, or bond0 if LACP is configured). This is the physical interface carrying the trunk.
2. Create vlan Sub-Interfaces (Temporary)
For each sub-port, create a vlan sub-interface matching the segmentation-id you assigned. This is a non-persistent method for testing:
Example:
This configuration will not survive a reboot. See the next step for a persistent configuration.
3. Persistent Configuration (Netplan Example)
For a persistent vlan sub-interface configuration using Netplan (Ubuntu/Debian with cloud-init), create a configuration file (e.g., /etc/netplan/60-vlans.yaml):
Then apply the configuration:
If your instance uses LACP bonding (see LACP guide), replace ens3 with your bond interface name (e.g., bond0). The vlan sub-interfaces then become bond0.100, bond0.200, etc.
4. Verify Connectivity
Check that your vlan sub-interfaces are up and have the correct IP addresses:
Then test connectivity:
Example:
If the ping succeeds, your vlan sub-interface is correctly configured and the trunk is carrying traffic for the corresponding network.
Conclusion
You have successfully configured:
- Neutron Trunk ports at the OpenStack level, connecting an instance to multiple networks via vlan tagging;
- vlan sub-interfaces within the guest OS to access each network attached through trunk sub-ports;
- And verified network connectivity on each vlan.
Your instance can now communicate on multiple isolated networks through a single trunk configuration.
Go further
If you need training or technical assistance for the implementation of our solutions, contact your sales representative or click this link to request a quote and have your project analyzed by our Professional Services team experts.
Join our community of users.