vSwitch for Windows servers

Last change on 2023-10-12 • Created on 2020-05-18 • ID: RO-93219

General information

With the vSwitch feature, Hetzner Online 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 Robot administration interface, you can create and configure vSwitches using the "vSwitches" button in the server overview. You can find more details in this article vSwitch.

Server configuration (Windows)

On the host system

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

NIC teaming

To send VLAN traffic via the same interface as the host's main IP address, you need to include the physical adapter in a team. You also need to assign a virtual interface for each VLAN ID to the team and its corresponding team adapter.

In Window's Server Manager, go to "Local Server" and then to "NIC teaming".

Windows vlan nic teaming

You will now see a new window for NIC teaming. Create a new team by going to Teams, then click on Tasks, and then on New team.

Windows vlan team

Windows vlan team dialog

Add a new interface to the team by going to Adapters and interfaces. Then click on Team Interfaces and select the correct adapter. Then go to Tasks, and then click on Add interface. Enter the VLAN ID you chose for your vSwitch on Robot.

Windows vlan interface

Windows vlan interface dialog.png

Interface configuration

You can now manage the VLAN interface that you created using NIC teaming. Go to the control panel and then to Adapter configuration.

Important note: Windows does not support multiple default gateways. Depending on your individual configuration, you may therefore have to set additional static routes according to your requirements.

Add IPs

You can configure an IP as usual by going to the interface properties.

Windows vlan private ip

More than one IP on the interface

You can add additional IPs by going to the TCP/IP dialog and then clicking on the Advanced... button.

Windows vlan additional ip

MTU

Reduce the MTU to 1400 for VLAN interfaces. You can configure this via command prompt.

Retrieve the interface names and IDs:

\:> netsh interface ip show interface

Set the MTU for the individual VLAN interfaces:

\:> netsh interface ipv4 set subinterface <id> mtu=1400 store=persistent

Do the same for IPv6:

\:> netsh interface ipv6 set subinterface <id> mtu=1400 store=persistent

Hyper-V

It is not necessary to do a configuration with NIC teaming so that you can use VLANs in connections with virtual servers.

All you need to do is configure a VLAN ID for each virtual machine's network adapter by going to Settings.

But you still need to change the MTU for each virtual server.

Connecting Windows to the Cloud-Network

If you have followed the steps above, you should also be able to connect your Windows Server to the Hetzner Cloud Network by simply setting a static route. For the sake of this example, lets assume that you have already setup your cloud network and have added the vSwitch with the following configuration:

  • 192.168.0.0/16 - Your cloud network (parent network)
  • 192.168.0.0/24 - Cloud server subnet
  • 192.168.1.0.0/24 - vSwitch (#12345)

The configuration should look something like this:

Windows Cloud setup overview

In order for the servers to be able to communicate with each other, you will have to set a static route. You can use the following command in Power shell to set a persistent static route:

route -P add 192.168.0.0 mask 255.255.0.0 192.168.1.1 METRIC 1

We are adding the subnet of the parent cloud network via the vSwitch. Now you should be able to ping your cloud server from your Windows machine and also log in via SSH for example:

Proof of working SSH

To ensure that everything has been set up correctly, you can also check the routes for the cloud network with the following command:

Get-NetRoute -DestinationPrefix 192.168.0.0/16 | Format-Table

The output of the command should be the following:

Route table in Windows

Table of Contents