Site-to-site VPN
IPsec or WireGuard from a network to an office or another cloud, static routes or BGP.
What it is
A gateway that joins one of your networks to another network — your office, another cloud (AWS, Azure, an on-premises data centre) or another Deutsche Cloud network — over IPsec (IKEv2) or WireGuard. Machines on both sides reach each other by their private addresses, in both directions, as one routed network. Find it under VPN → Site-to-site gateways in the console.
Every gateway is two machines in two zones (de1a and de1b when the size is in stock), active and standby behind one public IPv4 address. When the active machine stops answering, the standby takes the address over within about 30 seconds and brings the tunnels up again on its own. You configure your device once, against that one address.
It is opt-in. No gateway exists until someone creates one, and a gateway is two small machines billed by the hour (the create button shows the price).
Concepts
| Term | Meaning |
|---|---|
| Gateway | The two machines in one network, one public address, one BGP ASN (default 64600). One gateway per network. ewvgw-… |
| Connection | One tunnel to one remote device: IPsec or WireGuard, its routing, its keys. Up to 32 per gateway. ewvcn-… |
| Static routing | You list the networks behind the remote device (192.168.1.0/24). The network routes them into the tunnel. |
| BGP | The remote device announces its networks; Deutsche Cloud announces the network's range. Needs the remote's ASN, which must differ from the gateway's. At most 100 prefixes per session; a session that sends more is restarted. |
| Inside addresses | A /30 from 169.254.0.0/16 per connection, one address each side of the tunnel; BGP speaks over them. Deutsche Cloud takes the second address, the remote the first (AWS's convention). |
| Pre-shared key | IPsec authentication. Deutsche Cloud generates 40 random characters unless you give your own, and files it in Secrets. Reading it (in a device configuration) is audited. |
| NAT | Per connection, off by default: traffic from the tunnel into the network appears to come from the gateway. Turn it on when something in the network has no route back (see below). |
| Transit | Per gateway, off by default: whether two connections may reach each other through Deutsche Cloud (office A ↔ office B). Off, each connection reaches the network only. |
How to
Create a gateway
VPN → Site-to-site gateways → Create, choose the network and confirm the price on the button. Or:
dcloud vpn gateways create --name office-gw # the default VPC; --vpc-id for anotherPOST /vpn/api/gateways
{ "name": "office-gw" }The gateway is creating until its active machine has synced, usually within three minutes. publicAddress is what your device dials; wireguardPublicKey is the gateway's key for WireGuard connections.
Connect an office router (IPsec, static routes)
dcloud vpn connections create --id ewvgw-… --name office --type ipsec \
--remote-address 203.0.113.10 --static-routes 192.168.1.0/24
dcloud vpn connections device-config --id ewvcn-… --format unifi # or pfsense, opnsense, fortinet, strongswan, genericThe device configuration is written from your device's point of view: the address to dial, the pre-shared key, IKE and ESP proposals (AES-256 with SHA-256 and DH group 14 is the widely supported choice; AES-GCM and ECP groups are accepted too), lifetimes (8 h / 1 h), DPD (10 s), the inside addresses and the route to the network. In the console: the connection's Device configuration menu.
Deutsche Cloud always carries ESP inside UDP 4500 (NAT traversal), so your firewall needs UDP 500 and 4500 open towards the gateway, nothing else.
Connect with WireGuard
Give the remote's public key; the gateway's key is on the gateway.
dcloud vpn connections create --id ewvgw-… --name branch --type wireguard \
--remote-public-key 'k1Y…=' --remote-address 198.51.100.7 --remote-port 51820 \
--static-routes 10.20.0.0/16
dcloud vpn connections device-config --id ewvcn-… --format wireguardEach WireGuard connection listens on its own port (51820 + n, shown as endpoint). Without a remote address only the remote dials.
Use BGP
dcloud vpn connections create --id ewvgw-… --name dc --type ipsec --routing bgp \
--remote-address 203.0.113.10 --remote-asn 65010The gateway announces the network's range and accepts the remote's prefixes, except the network's own range, 169.254.0.0/16 and anything broader than /8. What it learned is on the connection (learnedPrefixes) and in the network's routes. Two connections to the same site with BGP give you redundant tunnels: when one stops, its routes are withdrawn after the hold time (30 s) and traffic takes the other.
Connect to AWS
Create an IPsec connection with BGP (or static) and download --format aws-vgw: Terraform for the AWS side (aws_customer_gateway at the gateway's address with its ASN, aws_vpn_connection with tunnel 1's inside range and pre-shared key set to this connection's). After terraform apply, put AWS's tunnel 1 address on the connection:
dcloud vpn connections modify --id ewvcn-… --remote-address <tunnel1_address>AWS's default ASN is 64512 and Deutsche Cloud's 64600, so they already differ. AWS's second tunnel can be a second Deutsche Cloud connection.
Connect two Deutsche Cloud networks
Create a gateway in each network. On the first, create the connection to the second gateway's publicAddress, then download --format ews: the exact request for the second gateway (the same key and inside range, the far side of the /30). For BGP give one of the two gateways another ASN.
Make the network's machines reach the office
The gateway puts a route for every remote prefix into the network, pointing at the active machine (and moves it on a failover). A machine sends to such a prefix only if it routes private ranges through the network: every EC2 machine launched since site-to-site VPN exists does (10/8, 172.16/12 and 192.168/16 through the network gateway, a unit in its user data). A machine launched earlier needs it once; the gateway's page shows the command (machineRouteCommand in the API):
IF=$(ip -o route get 10.0.0.1 | awk '{…}'); ip route replace 10.0.0.0/8 via 10.0.0.1 dev "$IF" onlink; …Managed databases, caches and app machines do not carry that route yet. To reach them from the office, turn NAT on for the connection: their answers then go back to the gateway's own address in the network. A remote prefix outside the private ranges (100.64.0.0/10, public space) also needs NAT, or a route on each machine.
Watch a tunnel
- State:
up,connecting,downorpending(not reported yet), with the time it changed, BGP state and the prefixes learned. While a tunnel is not up the connection carries strongSwan's last lines about it (lastLog): authentication failures, proposal mismatches and timeouts read as they happened on the machine. - Metrics (Monitoring, resource type
vpn_connection):tunnel_up(1 or 0 each minute),tunnel_in_bps,tunnel_out_bps,bgp_prefixes. Alarm ontunnel_upminimum< 1for two minutes to be told when a tunnel drops. - Activity (the gateway's events): provisioning, every tunnel up and down, BGP sessions, routes added and removed, failovers.
Change or delete
dcloud vpn connections modify changes the remote address, routes, ASN, NAT, selectors, the pre-shared key or the remote's WireGuard key; the gateway restarts that tunnel on its next sync (within 15 seconds). dcloud vpn connections delete closes the tunnel and removes its routes; dcloud vpn gateways delete does that for every connection and deletes both machines and the public address.
Run outside Germany (Helsinki, fi1)
Gateways are in Germany (de1) unless your organization decides otherwise. After an administrator turns on Allow EU locations outside Germany (Settings → Data location), create the gateway with "regionId": "fi1" (CLI --region fi1): both machines and the public address are in Helsinki, Finland, on separate hosts in its one zone, and it serves a network in fi1. Without the setting the create answers 403.
Limits and behaviour
- One gateway per network; up to 32 connections; one prefix belongs to one connection (redundant tunnels use BGP).
- Route-based tunnels by default (selectors
0.0.0.0/0both ways). For a device that only does policy-based IPsec, settrafficSelectors: "policy"(static routing): the selectors are then the network's range and the remote prefixes. - IPv4 only. IKEv2 only. Pre-shared keys only (no certificates yet).
- A failover breaks connections that were open through the old machine; IPsec is renegotiated by the new active machine at once, WireGuard on the next handshake. Measured with a machine powered off: traffic between two networks stopped for 40–49 seconds and came back by itself. The dead machine is replaced by a new one after five minutes.
- Traffic is not billed; the two machines are.
API, CLI, Terraform
- API:
/vpn/api/gateways,/vpn/api/gateways/{id}/connections,/vpn/api/connections/{id},/vpn/api/connections/{id}/device-config?format=…. IAM actionsvpn:DescribeVpnGateways,CreateVpnGateway,ModifyVpnGateway,DeleteVpnGateway,DescribeVpnConnections,CreateVpnConnection,ModifyVpnConnection,DeleteVpnConnection,GetVpnConnectionDeviceConfiguration(sensitive) onrn:ews:de1:<org>:vpn:gateway/ewvgw-…and…:vpn:connection/ewvcn-…. - CLI and MCP:
dcloud vpn gateways …,dcloud vpn connections …. - Terraform:
dcloud_vpn_gateway,dcloud_vpn_connection(pskis write-only).