By utilizing vRack, our VLAN (Virtual LAN) technology, you can route traffic privately between your OVHcloud services. In this article, we will cover setting up a subinterface in Ubuntu 18.04.
Prerequisites
Topics
- Creating a Subinterface in Ubuntu 18.04
Note: Game Servers do not come with a private NIC and, therefore, cannot utilize vRack.
Creating a Subinterface in Ubuntu 18.04
Before we begin, we need to install the VLAN module which is required to tag traffic. Use the apt
command to install it:
$ sudo apt install vlan
Next, activate the module using the modprobe
command:
$ sudo modprobe 8021q
Next, we will need to change to root to add our VLAN program to the kernel modules file.
$ sudo su
To ensure that the module loads when the server boots, use the following command to add it to the /etc/modules
file:
# echo "8021q" >> /etc/modules
Now exit root.
# exit
With the VLAN module installed and activated, let's find the name of the private ethernet interface. Use the ip
command to display a list of the server's network interfaces:
$ ip addr list
Note: The private ethernet interface is the one that is NOT configured with the WAN (Wide Area Network) IP address.
The name of our private ethernet interface is: eno2
With the name of the private ethernet interface, let's create a subinterface. Use a text editor of your choice to edit the network configuration file:
$ sudo vi /etc/netplan/01-netcfg.yaml
Add the following to the file to create a subinterface and assign it a private IP address on the private ethernet interface. Adjusting the items in red according to your specifications.
Note: Any server connected to vRack with a private IP address (in the following ranges: 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16), on the same subnet, and using the same VLAN ID will be able to connect over vRack. In our example, we are using 192.168.0.0/16 (Subnet mask: 255.255.0.0).
network: version: 2 renderer: networkd
ethernets:
eno2: {}
vlans:
vlan.99:
id: 99
link: eno2
addresses: [192.168.0.2/16]
Note: The 99
denotes the VLAN ID we have chosen; this is used to tag traffic. You can choose any VLAN ID between 2 and 4000, however, any servers you wish to privately connect together must use the same VLAN ID.
Next, save the file and exit the editor. Then, use the netplan
command to bring up the interface:
$ sudo netplan apply
Lastly, use the ifconfig
command to confirm the configuration of the subinterface:
vlan.99 Link encap:Ethernet HWaddr ac:1f:6b:01:45:fb
inet addr:192.168.0.2 Bcast:192.168.255.255 Mask:255.255.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1732 (1.7 KB) TX bytes:6042 (6.0 KB)
Memory:fb100000-fb11ffff
Repeat these steps on the other server(s) using Ubuntu 18.04 with a different IP address but within the same subnet (e.g., if you used our example, any IP between 192.168.0.1-192.168.255.254).
After completing this, ping one server from another using the private IP address to confirm that the servers are successfully connected via vRack.
Conclusion
Utilizing vRack is an excellent way to securely and efficiently connect OVHcloud services. After completing this article, you should know how to connect an Ubuntu 18.04 machine to vRack.