Skip to Content
Open Beta — managed Kubernetes, DNS & more are live.
🔒

Site-to-site VPN

Updated 2026-11-20
On this page

Site-to-site VPN

A site-to-site VPN builds an encrypted IPsec tunnel between your Patrii Cloud network and a remote network, such as your office or another data centre, so the two can communicate privately.

A site-to-site VPN joins two private networks over the public internet as if they were on the same wire. Traffic is encrypted end to end with IPsec, so hosts on your Patrii Cloud subnets and hosts on the remote network reach each other by their private addresses, no floating IPs or exposed ports required.

The tunnel is anchored on a router with an external gateway. You describe your side (the router and the local subnets to expose) and the remote side (its public address and the subnets behind it), agree on encryption settings and a pre-shared key, and Patrii Cloud provisions the connection. Because both ends must match exactly, the console shows a mapping you can follow when configuring the remote firewall.

A topology view summarizes the connection so you can see, at a glance, which local and remote subnets the tunnel carries and whether it is up.

The remote firewall must be configured with settings that match your Patrii side exactly. The create form shows a field-by-field mapping for strongSwan-based firewalls such as pfSense and OpnSense.
"Local" and "remote" are mirrored between the two ends: your local subnets are the remote firewall's remote network, and vice versa.

Key concepts

IPsec tunnel — The encrypted connection carrying traffic between the two networks.

Peer address — The public IP of the remote gateway your tunnel connects to.

Local subnets — The Patrii Cloud subnets you expose through the tunnel.

Remote subnets (peer CIDRs) — The address ranges behind the remote gateway that you want to reach.

Pre-shared key (PSK) — The shared secret both ends use to authenticate the tunnel.

IKE version — The key-exchange protocol version, v1 or v2.

PFS — Perfect forward secrecy: the Diffie-Hellman group that keeps past traffic safe if a key is later exposed.

Before you start

  • A router with an external gateway on the network you want to connect.
  • The remote gateway's public IP address and the list of subnets behind it.
  • Agreement with the remote side on IKE version, encryption algorithm and PFS group.
  • A strong pre-shared key, or let Patrii Cloud generate one for you.
  • Local and remote subnet ranges that do not overlap.

Step by step

  1. Open VPN

    Go to Networking and open VPN, then start a new site-to-site connection.

    Screenshot — The VPN list with the Create connection button
    The VPN list with the Create connection button
  2. Pick the router and local subnets

    Choose the router that faces your network and select the local subnets to expose through the tunnel.

    Screenshot — The create form showing the router and local-subnet selectors
    The create form showing the router and local-subnet selectors
  3. Describe the remote side
    • Enter the remote gateway's public address (the peer address).
    • List the remote subnets (peer CIDRs) you want to reach.
    Screenshot — The remote endpoint fields for peer address and remote subnets
    The remote endpoint fields for peer address and remote subnets
  4. Set the security parameters
    • Enter a pre-shared key, or let Patrii generate one.
    • Choose the IKE version, encryption algorithm and PFS group to match the remote end.
    Screenshot — The IKE and IPsec settings with the encryption and PFS selectors
    The IKE and IPsec settings with the encryption and PFS selectors
  5. Create the connection

    Create the connection. After it is provisioned, note the Patrii gateway public IP shown for the connection, the remote firewall will point at it.

  6. Configure the remote firewall

    Mirror the same settings on the remote side. The console shows a mapping table for strongSwan-based firewalls (pfSense, OpnSense) to line up Phase 1 and Phase 2.

    Screenshot — The remote-gateway mapping table
    The remote-gateway mapping table
  7. Confirm the tunnel is up

    Check the connection status and the topology view, then test connectivity between a host on each side.

    Screenshot — The VPN topology diagram showing local and remote subnets
    The VPN topology diagram showing local and remote subnets

Examples

Create a site-to-site connection
# IKEv2, AES-256 and PFS group14 by default; the PSK is generated if omitted
patrii vpn site-to-site --name hq-tunnel \
  --router <router-id> \
  --local-subnet <subnet-id> \
  --peer-address 198.51.100.10 \
  --peer-cidr 192.168.10.0/24
Choose your own IKE and IPsec policies
# Custom IKE and IPsec settings: build the tunnel from its parts
patrii vpn ike-policy create --name hq-ike --ike-version v2 \
  --encryption-algorithm aes-256 --pfs group14
patrii vpn ipsec-policy create --name hq-ipsec \
  --encryption-algorithm aes-256 --pfs group14
patrii vpn service create --name hq-vpn --router <router-id>
patrii vpn endpoint-group create --name hq-local --type subnet --endpoint <subnet-id>
patrii vpn endpoint-group create --name hq-peer --type cidr --endpoint 192.168.10.0/24
patrii vpn connection create --name hq-tunnel --service <service-id> \
  --ike-policy <ike-policy-id> --ipsec-policy <ipsec-policy-id> \
  --peer-address 198.51.100.10 --peer-id 198.51.100.10 \
  --local-ep-group <local-group-id> --peer-ep-group <peer-group-id>
List connections and check status
patrii vpn connection list
patrii vpn connection show <connection-id>
Create a site-to-site tunnel with Terraform
resource "patrii_vpn_site_to_site" "hq" {
  name                 = "hq-tunnel"
  router_id            = patrii_router.edge.id
  local_subnet_ids     = [patrii_subnet.app.id]
  peer_address         = "198.51.100.10"
  peer_cidrs           = ["192.168.10.0/24"]
  ike_version          = "v2"
  encryption_algorithm = "aes-256"
  pfs                  = "group14"
}

output "vpn_psk" {
  value     = patrii_vpn_site_to_site.hq.generated_psk
  sensitive = true
}

Limits & specifications

Encryption settings you can select:

SettingAvailable values
IKE versionv1, v2 (prefer v2).
Encryption algorithmaes-256, aes-192, aes-128, 3des.
PFS groupgroup14, group15, group16, group19, group20, group5, group2.
AuthenticationSHA-256 hashing on both ends.
Pre-shared keyEntered by you or auto-generated; revealable later from the connection.

Best practices

  • Prefer IKEv2 with AES-256 and a modern PFS group (14 or higher) unless the remote end forces older settings.
  • Use a long, random pre-shared key and store it in a secret manager, not in a document.
  • Make sure encryption, hash and PFS match exactly on both ends, a single mismatch prevents the tunnel from establishing.
  • Keep local and remote subnet ranges non-overlapping so routing stays unambiguous.
  • Only expose the subnets that truly need to reach across the tunnel.

FAQ

The tunnel won't come up. Where do I start?
The most common cause is a settings mismatch. Confirm the IKE version, encryption algorithm, hash and PFS group are identical on both ends, that the pre-shared key matches, and that the peer address and mirrored local/remote subnets are correct.
I forgot the pre-shared key. Can I see it again?
Yes. You can reveal the stored pre-shared key from the connection's detail page if one was saved for it.
Do I need floating IPs for hosts to talk across the VPN?
No. The tunnel carries private traffic between subnets, so hosts reach each other by their private addresses without floating IPs or open inbound ports.
Which firewalls are documented for the remote side?
The console includes a field-by-field mapping for strongSwan-based firewalls such as pfSense and OpnSense, where settings line up almost one to one.

Learn more

Everything you can do here in the console is also available through the Patrii Cloud API for automation and scripting.

Was this article helpful?
Thank you for your feedback. Still stuck? Contact us