Connect Dedicated Servers (vSwitch)

Last change on 2020-11-03 • Created on 2020-11-03


Dedicated Servers can be attached to Cloud Private Networks. This will enable Cloud and Dedicated Servers to reach each other via their private Network links. For example if you run your Web Frontends on Cloud Servers and your Database on a Dedicated Server you can use the private link to connect both.

Rough overview:


It works by using the existing private network mechanisms for both systems:

  • Private Networking for Cloud is done by creating a "Network" and adding your Cloud Servers to it.
  • Private networking for Dedicated Servers is done by creating a "vSwitch" and attaching your Dedicated Servers to it.

Both systems are then coupled by creating a Cloud Network Subnet of type "vSwitch" which links the existing Cloud Network to the existing vSwitch. The network settings on the Cloud Servers are configured automatically. The Dedicated Servers require a special network configuration inside their Operating System for the coupling to work.


Example of a coupled configuration:


Assumptions in this document

For the rest of the document we will assume that:

  • Your Cloud Network is with subnets:

    • for Cloud Servers. is assigned to your Cloud Server
    • for your vSwitch Connection. IP is being used by your Dedicated Server
  • You have a vSwitch with vlan-id 4000
  • Your dedicated server has the network interface enp0s31f6 as its public network interface.

You might need to replace the values listed above with the actual values of your setup.

Attaching Dedicated Servers to Cloud Networks


On the cloud side

You must have an existing Cloud Network with attached Cloud Servers. The Cloud Servers must be able to ping each other using their private IP addresses.

A Cloud Server cloudserver01 attached to a Cloud Network looks like this:


On the dedicated side

A Dedicated Server vSwitch must already exist in Robot and the relevant servers must be attached to it. However no private network configuration should be done on the Dedicated Servers yet. Follow this tutorial to create your vSwitch but skip the part for configuring your server operating system.

A vSwitch with vlan-id 4000 and one Dedicated Server called ex41 attached will look like this:


Step 1: In Cloud: Create Subnet of type vSwitch

Go to Cloud Console. Networks, click your existing network and select the Subnets tab.


Click Add Subnet:


Check "Enable dedicated server vSwitch connection" and select the existing vSwitch you want to couple your private network with. You can also pick an IP range your Dedicated Servers will use or go with the default one.


Afterwards click "Add Subnet". You will receive instructions on how to configure the network on your Dedicated Servers:


You can either follow these instructions - making sure to replace the network interface name, the vSwitch vlan id as well as the Dedicated Server IP with the correct values - or you can manually execute them using Step 2 of this article.

Your Cloud Network and the vSwitch are now coupled.


Step 2: Configure networking on your Dedicated Servers

For Cloud Servers the network configuration inside your operating system ist automatically done. For Dedicated Servers you need to do this configuration yourself. The necessary steps for a non persistent configuration were detailed in the "Configuration of your dedicated Server" dialogue in Step 1. The reason for the configuration is explained in this step.

What we want to configure

  • Setup a network interface for the vSwitch vlan (tagged vlan packets) and configure an mtu of 1400.
  • On that interface: Configure an IP-Address from the IP range of the subnet of type vSwitch ( in example above) and set the first IP address of that subnet as gateway ( in example). Make sure that every Dedicated Server uses its own, unique private IP address.
  • Configure a route for the network IP range pointing to the gateway ( gw in example above)

Persistent example configurations

Interface enp0s31f6 (usually called eth0, enp6s0 or enp0s31f6), VLAN 4000
Cloud Network:
Cloud Server Subnet:
vSwitch Server Subnet: and for your Dedicated Server vSwitch vlan: 4000

Example Debian configuration
# /etc/network/interfaces
auto enp0s31f6.4000
iface enp0s31f6.4000 inet static
  vlan-raw-device enp0s31f6
  mtu 1400
  up ip route add via dev enp0s31f6.4000
  down ip route del via dev enp0s31f6.4000
Example configuration systemd and netplan (e.g.Ubuntu 18.04)

Newer instances of installimage create netplan-based network configurations on Ubuntu 18.04. The /etc/systemd/network/ directory will be empty. To set up the vlan, you need to change the netplan file:

### Hetzner Online GmbH installimage
  version: 2
  renderer: networkd
      id: 4000
      link: enp0s31f6
      mtu: 1400
        - to: ""
          via: ""

After that you have to execute the following commands and the network should be available:

sudo /lib/netplan/generate
sudo systemctl restart systemd-networkd
Example configuration for systemd

Create two new files for systemd-networkd:

Description="VLAN 4000"

In newer systemd versions (v242+) you have to use the Option (GatewayOnLink, upper case L) in the last line.

Add the following line into file:


Restart service:

sudo systemctl restart systemd-networkd

Step 3: Test

The example values in this section reflect those of chapter Assumptions above.

3.1: Ensure that network configuration looks right on your Cloud Server

Run the command to show your routes:

ip route show via dev ensXX dev ensXX scope link

3.2: Ensure that network configuration looks right on Dedicated Server

Run the command to show your routes:

ip route show

It should include the following lines. via dev enp0s31f6.4000 dev enp0s31f6.4000 proto kernel  scope link  src

The vSwitch gateway should be pingable:

$ ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=6.45 ms

3.3: Cloud Server should be pingable from Dedicated Server

From Dedicated Server ping the Cloud Server IP address:

$ ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=62 time=26.6 ms
Table of Contents