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 on CentOS 7.
Prerequisites
Topics
- Creating a Subinterface in CentOS 7
Note: Game Servers do not come with a private NIC and, therefore, cannot utilize vRack.
Creating a Subinterface in CentOS 7
In CentOS 7 the required 8021q module is installed by default, if for any reason you don't have the module you can install it using the following command:
# modprobe --first-time 8021q
If the module is already installed, you will see the following:
modprobe: ERROR: could not insert '8021q': Module already in kernel
Now, that we have confirmed the module is installed we will need to find the name of our private ethernet interface. We can 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: eth1
With the name of the private ethernet interface, let's configure the parent interface using the text editor of your choice.
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eth1
Enter the following to define the parent interface and save the file.
DEVICE=eth1 TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
Now, that our parent interface is created we are able to create our subinterface.
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.
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eth1.99
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.
DEVICE=eth1.99 BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.0.3
PREFIX=16
NETWORK=192.168.0.0
VLAN=yes
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).
Next, save the file and exit the editor. Then, use the ip
command to bring up the interface:
Now use the systemctl
command to restart the network:
$ sudo systemctl restart network
Lastly, use the ifconfig
command to confirm the configuration of the subinterface.
eth1.99 Link encap:Ethernet HWaddr ac:1f:6b:01:45:fb
inet 192.168.0.3 netmask 255.255.0.0 broadcast:192.168.255.255
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 CentOS 7 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 verify 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 a CentOS 7 machine to vRack.