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?
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
Unfortunately it's a separate VLAN and you have to use a Hetzner generated gateway which does not support (custom) routing. So traffic is limited to the specific cloud subnet only. Jan 12, 2022 at 7:00
@HeikoRobert I'm trying to setup a vm on cloud, to use it as default gateway for my dedicated. No I come to the same conclusion: Its not possible, is it???– WulfFeb 13, 2022 at 10:34
@Wulf Please check my new answer serverfault.com/a/1093591/226918 describing my work around I'm using with pfsense and GRE to have a default gateway running in the cloud. Feb 14, 2022 at 8:54
As of today you can, this feature have been implemented. You can read more about it here:
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
The other limitation not mentioned in the above answers is that the region of the cloud server must match the region of the cloud subnet or they can't talk. Also, the cloud subnet must match the region of the dedicated servers vSwitch or they can't talk.
So, in short, all resources: dedicated servers, cloud servers, subnet, and vSwitch, must be in the same region to do this.