Webmail Website Panel VPS Panel Client Panel
Client Services
Guides

Configuring vSwitch for Dedicated Servers: A Comprehensive Guide

Learn how to connect your CLOUD HIVE DC dedicated root servers using virtual layer 2 networks with the vSwitch feature. A complete networking guide for Linux.

Configuring vSwitch for Dedicated Servers: A Comprehensive Guide

Introduction

With the vSwitch feature, CLOUD HIVE DC has created a tool for your dedicated root servers that lets you connect your servers in multiple locations to each other using virtual layer 2 networks. On your account on the Management interface, you can create and configure vSwitches using the "vSwitch" icon.

The vSwitch uses the uplink of your server. An additional NIC is therefore not necessary.

How do I setup a vSwitch?

You can create a vSwitch on the Management interface by going to the vSwitch section and clicking "+ New vSwitch". Then assign a name and a VLAN ID to your vSwitch. The VLAN ID can range from 4000 to 4091.

After you have created the vSwitch, you can then assign your dedicated root servers to the vSwitch using the Add server button. Then the servers that you have added can communicate with each other using the VLAN ID that you have set.

  • The server's main IP address and the additional IP addresses +/or subnets can still be reached without doing VLAN tagging.

  • There is a limit of 32 MAC addresses per physical switch port.

  • You can assign up to 100 servers to a vSwitch.

  • You can assign up to 5 vSwitches to a server.

IP addresses

You can use any private IP addresses for free within the VLAN. Plus, you can order additional public subnets (IPv4 and IPv6) by going to the IPs menu tab. You can use these subnets on all servers that you assign to your vSwitch.

Traffic

Internal traffic (across locations) is free of charge. For the public subnets, vSwitches have an included traffic limit of 1TB per month. Each additional TB costs € 1.00 ($ 1.20) per month (excl. VAT). We at CLOUD HIVE DC only count outgoing traffic for this price; incoming and internal traffic is free.

Important note: The main NIC is used for vSwitch traffic. An additional NIC for the vSwitch function is not necessary.

Firewall

The servers' firewall is also applied to the packets of the vSwitches. Important note: If you have activated a firewall, you must also enable internal IP addresses in the firewall.

Important: Terms of Support

Packages for our dedicated root servers and Cloud servers do not include software support. The packages also do not include support for configuring these servers. For dedicated root and Cloud servers, we only provide the hardware, network access and necessary infrastructure; and of course, we support our customers if there are any faults or disruptions. Since you are a customer of one of our dedicated root servers or Cloud servers, you are responsible for the configuration and administration of your server and for the software which runs on it.

Server configuration (Linux)

For the vSwitch, you need to configure an interface with the VLAN ID that you have entered on the Management panel. You should limit the MTU of the interface to 1400.

Example configuration for the network card enp0s31f6, with the VLAN ID 4000

Create a VLAN device:

ip link add link enp0s31f6 name enp0s31f6.4000 type vlan id 4000
ip link set enp0s31f6.4000 mtu 1400
ip link set dev enp0s31f6.4000 up

Configure IP address 192.168.100.1 from the private subnet 192.168.100.0/24:

ip addr add 192.168.100.1/24 brd 192.168.100.255 dev enp0s31f6.4000

Public subnet: You need to create an additional routing table for the public subnet so you can configure another default gateway.

Example configuration for IP 213.239.252.50 from the public subnet 213.239.252.48/29, Interface enp0s31f6.4000:

echo "1 vswitch" >> /etc/iproute2/rt_tables
ip addr add 213.239.252.50/29 dev enp0s31f6.4000
ip rule add from 213.239.252.50 lookup vswitch
ip rule add to 213.239.252.50 lookup vswitch
ip route add default via 213.239.252.49 dev enp0s31f6.4000 table vswitch

Example Debian configuration (Interface enp0s31f6, VLAN 4000, private network):

# /etc/network/interfaces
auto enp0s31f6.4000
iface enp0s31f6.4000 inet static
  address 192.168.100.1
  netmask 255.255.255.0
  vlan-raw-device enp0s31f6
  mtu 1400

Example configuration for systemd:

Create two new files for systemd-networkd:

#/etc/systemd/network/10-enp0s31f6.4000.netdev
[NetDev]
Name=enp0s31f6.4000
Kind=vlan
MTUBytes=1400

[VLAN]
Id=4000
#/etc/systemd/network/10-enp0s31f6.4000.network
[Match]
Name=enp0s31f6.4000

[Network]
Description="VLAN 4000"
Address=192.168.100.2/24

Add the following line into file:

#/etc/systemd/network/10-enp0s31f6.network
....
[Network]
...
VLAN=enp0s31f6.4000

Restart service:

sudo systemctl restart systemd-networkd

Example configuration systemd and netplan (e.g. Ubuntu 18.04):

#/etc/netplan/01-netcfg.yaml
### CLOUD HIVE DC installimage
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s31f6:
      addresses:
...
  vlans:
    enp0s31f6.4000:
      id: 4000
      link: enp0s31f6
      mtu: 1400
      addresses:
        - 192.168.100.2/24

After that, you need to execute the following commands. Then the network should be available:

sudo /lib/netplan/generate
sudo systemctl restart systemd-networkd

There appears to be a glitch with netplan and the MTUs. (See https://askubuntu.com/questions/1191365/netplan-not-applying-correct-mtu-to-vlan). You need to set these manually using ip command:

sudo /sbin/ip link set mtu 1400 dev enp0s31f6.4000

If you want to persist this configuration across a reboot, it helps to make an entry in crontab (for example, in the one from root, so run sudo crontab -e):

@reboot sleep 10 && /sbin/ip link set mtu 1400 dev enp0s31f6.4000
AI
AI
CLOUD HIVE DC AI
Welcome aboard!
Ask me anything about CLOUD HIVE DC services. 🚀
I'm still learning, so please be patient with me 😊😋
👨‍💻 An operator has joined the chat