Can I connect a servers from Hetzner cloud to a vswitch
I have some dedicated root servers at Hetzner wich are connected via a VLAN using the vSwitch. Now I would like to know if you can connect servers from the Hetzner Cloud to the same vSwitch so they can communicate via the VLAN?
Solution 1:
Before it was not possible but as of today (Nov. 2020) it is possible:
Yes, you can connect your Robot vSwitch (dedicated servers) with your Hetzner Cloud Network. Create a new subnet in your Cloud Network and select the "Enable dedicated server vSwitch Connection" checkbox.
There is a tutorial referenced as well
Solution 2:
As of today you can, this feature have been implemented. You can read more about it here:
https://docs.hetzner.com/cloud/networks/connect-dedi-vswitch/
Solution 3:
the solution described in the accepted answer has a drawback:
As today there is no way to configure a shared VLAN to connect from your cloud network to your dedicated servers. traffic has to go thru an automatically generated gateway which you can't control (and which has to use a separate VLAN). This means you can't route networks except the network defined by the Hetzner work around.
If you want to transparently route networks from Hetzner cloud to the dedicated server networks you may configure a GRE tunnel between a router vm in the cloud with a router on the dedicated server via the cloud VLAN. GRE is not doing any encryption and is therefore faster than creating a IPSec tunnel and since the traffic is already going thru a secure VLAN there is no need for encrypting the traffic. Once you setup that virtual interface you can use it for routing as usual.
I found this hint in a Reddit article and I have a running pfsense in both networks. Please check pfsense documentation how to configure a GRE interface.
Hetzner has also a guide how to setup pfsense as a router in the Hetzner cloud