What Is a Site-to-Site VPN? Designing IPsec Tunnels, Routes, and Failover
A site-to-site VPN connects two networks, such as an office and a cloud virtual network, by creating an encrypted IPsec tunnel between their gateways. Unlike a remote-access VPN for individual laptops, it connects traffic between subnets. An established tunnel does not make communication work by itself: security negotiation, routes, and firewall rules on both sides must also agree.
A site-to-site VPN connects two networks, such as an office and a cloud virtual network, by creating an encrypted IPsec tunnel between their gateways. Unlike a remote-access VPN for individual laptops, it connects traffic between subnets. An established tunnel does not make communication work by itself: security negotiation, routes, and firewall rules on both sides must also agree.
How does the tunnel work?
A typical path is on-premises network → customer VPN gateway → IPsec tunnel over the internet → cloud VPN gateway → cloud subnet. IPsec is a security architecture for protecting IP traffic. IKEv2 is a protocol that lets the two gateways authenticate each other and negotiate and maintain security associations (SAs), which define the parameters used to protect traffic. Once negotiation succeeds, the original packet is carried inside an outer tunnel packet; the gateway at the other end verifies and decrypts it, then forwards it to the destination network.
For example, suppose an office network 10.20.0.0/16 needs to reach an application in cloud network 10.80.0.0/16. The office device sends traffic for 10.80.0.0/16 through the VPN, and the cloud route table sends return traffic for 10.20.0.0/16 to the VPN gateway. If the address ranges overlap or either route is missing, the tunnel can appear healthy while sessions fail or traffic works in only one direction.
How is it different from a user VPN or a dedicated cloud connection?
A site-to-site VPN connects networks to networks. A remote-access VPN connects an individual device to a VPN gateway. A dedicated cloud connection provides a private path through a carrier or interconnection location, but the private transport path itself does not mean IPsec encryption is in place. A site-to-site VPN commonly traverses the public internet and protects the traffic with IPsec. Internet bandwidth, latency, and quality are not guaranteed, so compare it with a dedicated connection when you need stable, high-capacity connectivity.
| Option | Endpoints and path | Main design concerns |
|---|---|---|
| Site-to-site VPN | IPsec tunnel between network gateways, usually over the internet | IKE/IPsec compatibility, routes, internet quality, redundancy |
| Remote-access VPN | Individual user device to a company network | User authentication, device policy, per-user access control |
| Dedicated cloud connection | Carrier private path between on-premises and cloud | Provisioning time, circuits and access locations, routing, whether separate encryption is needed |
Should you use static routes or BGP?
With static routing, you manually enter the other network’s CIDR range on each side. It is straightforward for a small, stable network or a device that does not support BGP. When a subnet is added or a failure requires a route change, however, an operator must update the routes; missing an update is a common source of one-way or failed connectivity.
BGP is a routing protocol through which the gateways dynamically advertise and learn reachable network prefixes. It can help connect multiple subnets and automate failover across multiple tunnels, but you must filter which prefixes you advertise and accept. An accidental default route or overly broad corporate prefix could send unintended traffic into the tunnel or override another path. Cloud services also differ: Google Cloud HA VPN uses dynamic routing with BGP, while Classic VPN uses static routing. AWS Site-to-Site VPN supports static or dynamic routing depending on the selected gateway type and peer-device capability.
How many tunnels are enough for redundancy?
Creating multiple tunnels alone does not guarantee high availability. If the devices, public IPs, power, internet circuit, and physical route share a failure domain, one event can take them all down. Provider designs differ. An AWS Site-to-Site VPN connection provides two tunnels that can be used at the same time. Google Cloud HA VPN requires tunnels arranged to match its gateway interfaces and peer-side topology. Azure VPN Gateway supports active-standby and active-active configurations; for active-active site-to-site connections, a tunnel is established from each gateway instance. Check whether the devices and circuits on the far side are independent too, rather than counting tunnel endpoints alone.
The failover plan should define route preference, how BGP withdrawal or static-route changes take effect, acceptable interruption, and whether the alternate path has enough capacity. Test whether traffic uses one tunnel or both and whether provider route selection behaves as intended. A cloud gateway SLA is not the same as an end-to-end availability guarantee that includes the application and on-premises equipment.
What should you check when connecting a new site?
First, confirm that the CIDR ranges on both sides do not overlap, the peer gateway has a reachable public IP address, and both devices support compatible IKE/IPsec proposals and authentication methods. If you use a pre-shared key, transfer and store it securely. If you use certificates, manage the trust chain and expiration. The IKE version, encryption and integrity algorithms, Diffie–Hellman group, and SA lifetimes must be compatible. Supported combinations vary by cloud and VPN appliance, so start with the provider’s current configuration template.
Next, create the cloud-side gateway and connection, apply the configuration to the on-premises device, and set up routing. With static routing, enter the remote CIDR and VPN next hop on both sides. With BGP, match the ASNs and peer IPs, then advertise only the prefixes that are needed. The cloud subnet route table and on-premises route table must both contain a path to the opposite network. Finally, allow only required protocols and ports in cloud security groups, firewalls, and on-premises ACLs.
The tunnel is up, but traffic fails. What should you check first?
Diagnose in layers—tunnel, routing, then security policy—to narrow the cause.
**IPsec status:** Confirm that IKE negotiation and the tunnel are healthy on both ends. If the tunnel is down, check the public IPs, pre-shared key or certificates, matching IKE/IPsec proposals, and whether the firewall allows the VPN traffic required by the service.
**Routes:** Check that static routes point to the correct next hop, or that the BGP session and prefix advertisements are healthy. Some platforms require the IPsec tunnel to be established before BGP peering can start.
**Policy and return path:** Confirm that cloud security rules and the on-premises firewall allow traffic in both directions, and that replies have a valid route back through the tunnel or another intended path. One-way connectivity can indicate a missing route or asymmetric routing.
**A specific flow:** Start with a small test host and an allowed port. Reviewing gateway and firewall flow logs together with route tables helps show where packets stop. Change only the setting tied to the observed fault, then recheck the tunnel and application traffic in both directions.
After launch, monitor tunnel state, BGP sessions, received and advertised routes, latency, and loss. During a planned test window, verify an actual tunnel failure and route transition. When changing cipher suites or gateway settings, review both sides together and prepare a rollback procedure.
References
[AWS Site-to-Site VPN concepts and limitations](https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html)
[AWS Site-to-Site VPN static and dynamic routing](https://docs.aws.amazon.com/vpn/latest/s2svpn/vpn-static-dynamic.html)
[Azure VPN Gateway topologies and design](https://learn.microsoft.com/en-us/azure/vpn-gateway/design)
[Troubleshoot BGP issues for Azure VPN Gateway](https://learn.microsoft.com/en-us/troubleshoot/azure/vpn-gateway/vpn-gateway-troubleshoot-bgp)
[Google Cloud VPN overview](https://docs.cloud.google.com/network-connectivity/docs/vpn/concepts/overview)
[Google Cloud VPN best practices](https://docs.cloud.google.com/network-connectivity/docs/vpn/concepts/best-practices)
[IETF RFC 4301: Security Architecture for the Internet Protocol](https://www.rfc-editor.org/rfc/rfc4301.html)
[IETF RFC 7296: Internet Key Exchange Protocol Version 2](https://www.rfc-editor.org/rfc/rfc7296.html)