Create Multiple vLANs in a vRack on a Dedicated Server

View as Markdown

Create and manage multiple vLANs within your OVHcloud vRack to segment network traffic between dedicated servers.

Objective

The standard vRack configuration enables you to create only one VLAN. This means that you can only use each IP address once. However, with the vRack version 2.0 configuration, you can create up to 4,000 VLANs within a single vRack. This means that you can use each IP address up to 4,000 times.

This guide will show you how to create multiple vLANs within the vRack.

Requirements

Warning

This feature might be unavailable or limited on servers of the Eco product line.

Please visit our comparison page for more information.

Instructions

Linux

Info

As an example, we'll use eno2 as the network interface, 10 and 11 as the VLAN tags, and 192.168.0.0/16 and 10.0.0.0/16 as the private IP address ranges.

All commands must be adapted to the distribution used. Please refer to the official documentation for your distribution if you have any doubts.

Debian 11
Ubuntu and Debian 12+
AlmaLinux and Rocky Linux (8/9)
Fedora 42+, AlmaLinux and Rocky Linux (10)

First, establish an SSH connection to your server and run the following commands from the command line to install the VLAN package on your server:

sudo apt update
sudo apt install vlan

Next, load the 8021q kernel module:

sudo modprobe 8021q

To verify that the module is loaded:

user@server:~$ lsmod | grep 8021q
8021q                  40960  0
garp                   16384  1 8021q
mrp                    20480  1 8021q

Run the following command to ensure the modules are permanently loaded at boot:

sudo su -c 'echo "8021q" >> /etc/modules'

Next, retrieve your interface names and identify the private interface:

ip a

Next, create a VLAN tag. The tag serves as an identifier, allowing you to differentiate between multiple VLANs:

sudo ip link add link <parent-interface> name <vlan-identifier> type vlan id <ID>

In this example:

sudo ip link add link eno2 name eno2.10 type vlan id 10

Use the same command for each VLAN tag you wish to add.

Next, declare the private IP address range within the vRack and tag it with the identifier using the following command:

sudo ip addr add 192.168.0.10/16 dev eno2.10

Amend the configuration of your network interface to incorporate the VLAN tag. Open your network interface configuration file and add the following entries:

sudo nano /etc/network/interfaces.d/50-cloud-init

auto eno2.10
iface eno2.10 inet static
address 192.168.0.10
netmask 255.255.0.0
broadcast 192.168.255.255
vlan-raw-device eno2

For multiple configured VLANs, your network configuration should look like this:

Debian network config file with multiple VLAN entries

Windows

Log on to your server via a remote desktop connection, and open the Server Manager app. Then select Local Server. Now click the Disabled link next to NIC Teaming:

Server Manager Local Server with NIC Teaming disabled

Next, right-click on the network interface and select Add to New Team.

Right-click context menu to add interface to new team

In the popup window, create a new team by typing a team name into the Team name field. When you have finished, click OK.

New Team dialog with team name and OK button

Next, we need to define the vLAN tag. In the ADAPTERS AND INTERFACES pane of the NIC Teaming screen, go to the Team Interfaces tab and right-click the interface you have just added to the new team, then click Properties. Now click Specific VLAN, and define the tag:

NIC Teaming interface properties with Specific VLAN tag

Next, we need to configure the IP address of the vLAN. Click the Start button on your keyboard, then click Control Panel:

Windows Start menu showing Control Panel option

Next, click Network and Internet:

Control Panel with Network and Internet category

Then Network and Sharing Center:

Network and Sharing Center link in Windows

Then click Change adapter settings:

Change adapter settings in Network and Sharing Center

Next, right-click the vLAN interface, and click Properties:

Right-click on VLAN interface to open Properties

Note that in our example Ethernet 2 is the interface used for the vRack. However, it is possible that the vRack NIC is a different interface in your configuration. The correct one to select will be the interface that does not have the server's main IP address or has a self-assigned IP.

Then double-click Internet Protocol Version 4 (TCP/IPv4):

Adapter properties with IPv4 protocol highlighted

Next, click Use the following IP address. For IP address, type in an IP from your internal range. For Subnet mask, type in 255.255.0.0.

IPv4 settings with VLAN IP address and subnet mask

Finally, click the OK button to save the changes, then reboot your server.

Go further

Configuring the vRack on your Dedicated Servers

Configuring vRack Between Public Cloud and Dedicated Server

Join our community of users.

Was this page helpful?