nodemethod
HybridIntermediate

Redundant site-to-site VPN with BGP

Two tunnels per connection and two customer gateways, with BGP choosing a healthy path automatically.

An IPsec VPN is the fastest way to connect an office or data centre to the cloud. Cloud VPN connections come with two tunnels that terminate on different provider endpoints. Adding a second customer device and running BGP over every tunnel means a failed tunnel, device or provider endpoint is routed around in seconds, with no manual change.

DATA CENTRECLOUD REGIONtunnels 1+2tunnels 3+4DCCore network172.16.0.0/12SECFirewall 1ASN 65010SECFirewall 2ASN 65010HUBVPN gatewayASN 64512NETVPCs10.16.0.0/12WWWInternetIPsec / IKEv2
traffictunnel / replicationblocked

When to use it

  • Connecting offices or data centres to the cloud
  • Backup path for a dedicated interconnect
  • Partner connectivity with modest bandwidth

When to avoid it

  • Sustained multi-gigabit traffic: each tunnel has a throughput limit
  • Latency-sensitive traffic where internet jitter matters

How traffic flows

  1. Create two VPN connections, one per customer firewall. Each has two tunnels to different provider endpoints: four tunnels in total.
  2. Run a BGP session over every tunnel. The data centre advertises its ranges; the cloud side advertises VPC ranges.
  3. Use AS-path prepending or MED to prefer one firewall, so traffic is symmetric under normal conditions.
  4. Tune dead peer detection and BGP timers so a failed tunnel is withdrawn quickly.

Configuration examples

resource "aws_customer_gateway" "fw1" {
  bgp_asn    = 65010
  ip_address = "203.0.113.10"
  type       = "ipsec.1"
}

resource "aws_vpn_connection" "dc_fw1" {
  customer_gateway_id = aws_customer_gateway.fw1.id
  transit_gateway_id  = aws_ec2_transit_gateway.hub.id
  type                = "ipsec.1"
  tunnel1_ike_versions       = ["ikev2"]
  tunnel1_phase1_encryption_algorithms = ["AES256-GCM-16"]
  tunnel1_dpd_timeout_action = "restart"
  tunnel2_ike_versions       = ["ikev2"]
  tunnel2_phase1_encryption_algorithms = ["AES256-GCM-16"]
  tunnel2_dpd_timeout_action = "restart"
}
# repeat for fw2 with its own customer gateway

Examples are starting points. Review provider limits, names and versions for your environment before applying.

What to monitor

SignalWhy it matters
Tunnel state and BGP session stateFour tunnels should be up; two down means you have lost redundancy, not service.
Routes received per sessionA session that is up but receives no routes carries no traffic.
Tunnel throughput against its limitSaturation shows up as packet loss well before an outage.
Rekey and DPD eventsFrequent rekeys point at mismatched lifetimes.

Common failure modes

Running on one tunnel for weeks

Redundancy was lost long ago and nobody noticed.

Pulse alerts the moment tunnel count drops below the expected number.

Asymmetric routing through two firewalls

Stateful firewalls drop return traffic.

Lens correlates firewall drops with BGP path preference changes.

Checklist

0 of 5 done
Was this pattern useful?

Run this pattern with NodeMethod watching it.

NodeMethod is onboarding early-access teams now. Tell us about your environment and we will be in touch.

esc
↑↓ to move↵ to open