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.
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
- Open VPN
Go to Networking and open VPN, then start a new site-to-site connection.
Screenshot — The VPN list with the Create connection buttonThe VPN list with the Create connection button - 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 selectorsThe create form showing the router and local-subnet selectors - 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 subnetsThe remote endpoint fields for peer address and remote subnets - 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 selectorsThe IKE and IPsec settings with the encryption and PFS selectors - 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.
- 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 tableThe remote-gateway mapping table - 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 subnetsThe VPN topology diagram showing local and remote subnets
Examples
# 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
# 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>
patrii vpn connection list patrii vpn connection show <connection-id>
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:
| Setting | Available values |
|---|---|
IKE version | v1, v2 (prefer v2). |
Encryption algorithm | aes-256, aes-192, aes-128, 3des. |
PFS group | group14, group15, group16, group19, group20, group5, group2. |
Authentication | SHA-256 hashing on both ends. |
Pre-shared key | Entered 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?
I forgot the pre-shared key. Can I see it again?
Do I need floating IPs for hosts to talk across the VPN?
Which firewalls are documented for the remote side?
Learn more
Everything you can do here in the console is also available through the Patrii Cloud API for automation and scripting.