title | excerpt | updated |
---|---|---|
Creating multiple vLANs in a vRack |
This guide will show you how to create multiple vLANs within the vRack |
2023-09-12 |
The standard vRack configuration{.external} 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.
- An active vRack{.external} service in your account
- Two or more vRack-compatible servers{.external}
- Administrative (sudo) access to the server via SSH
- Access to the OVHcloud Control Panel{.external}
- Your chosen private IP address range
- You must have completed the vRack configuration guide{.external}
Warning
This feature might be unavailable or limited on servers of the Eco product line.
Please visit our comparison page for more information.
[!primary]
As an example, we'll use eno2 for Ubuntu and eth1 for Debian as the network interface, 10 as the vLAN tag, and 192.168.0.0/16 as the IP address range.
These commands were executed under Ubuntu 21.10 (Impish Indri).
First, you need to establish an SSH connection to your server, and run the following commands from the command line. This will install the vLAN package on your server:
sudo apt-get install vlan
Load the 8021q kernel module:
sudo su -c 'echo "8021q" >> /etc/modules'
Create or edit this configuration file to prevent changes to your network configuration from being made automatically:
sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
And add this line:
network: {config: disabled}
Get the network interface name and it's MAC address:
ip a
Here the interface that we want to configure is eno2
with MAC address: d0:50:99:d6:6b:14
.
Add the network configuration for this network interface and the VLAN declaration in the following file:
sudo nano /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
eno2:
match:
macaddress: d0:50:99:d6:6b:14
eno1:
...
...
vlans:
vlan10:
id: 10 # VLAN ID
link: eno2 # Interface name
addresses:
- 192.168.0.14/16
Save and close the file, then run the following commands:
sudo netplan try
sudo netplan apply
Use the following command to confirm the configuration:
ip a
First, you need to establish an SSH connection to your server, and run the following commands from the command line. This will install the vLAN package on your server:
# sudo apt-get install vlan
Next, we need to create a vLAN tag. The tag is an identifier that allows you differentiate between multiple vLANs:
# vconfig add eth1 10
Added VLAN with VID == 10 to IF -:eth1:-
Next, we need to declare the IP address range within the vRack and tag it with our identifier. We can do this with the following command:
# ip addr add 192.168.0.0/16 dev eth1.10
Lastly, we need to amend the configuration of our network interface so that it takes into account the vLAN tag. For this step, you will need to open your network interface configuration file for editing, and amend it as shown below:
# sudo /etc/network/interfaces
auto eth1.10
iface eth1.10 inet static
address 192.168.0.50
netmask 255.255.0.0
broadcast 192.168.255.255
Log on to your server via a remote desktop connection, and open the Server Manager app. Then select Local Server
{.action}. Now click the Disabled
{.action} link next to NIC Teaming:
Next, right-click on the network interface and select Add to New Team
{.action}.
In the popup window, create a new team by typing a team name into the Team name field. When you have finished, click OK
{.action}
Next, we need to define the vLAN tag. In the Adapters and Interfaces pane of the NIC Teaming screen, right-click the interface you have just added to the new team, then click Properties
{.action}. Now click Specific VLAN
{.action}, and define the tag:
Next, we need to configure the IP address of the vLAN. Click the Start
{.action} button on your keyboard, then click Control Panel
{.action}:
Next, click Network and Internet
{.action}:
Then Network and Sharing Center
{.action}:
Then click Change adapter settings
{.action}:
Next, right-click the vLAN interface, and click Properties
{.action}:
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)
{.action}:
Next, click Use the following IP address
{.action}. For IP address, type in an IP from your internal range. For Subnet mask, type in 255.255.0.0.
Finally, click the OK
{.action} button to save the changes, then reboot your server.
Configuring the vRack on your Dedicated Servers{.external}
Join our community of users.