Hybrid Environments and Migration

Border Gateway Protocol (BGP) – Key Concepts

Used by AWS Direct Connect (DX) and dynamic Site-to-Site VPNs

Simple Example of BGP Architecture

IPsec VPN Fundamentals

IPsec – Key Concepts

IPsec Architecture

IPsec Phases – Internet Key Exchange (IKE)

IKE Phase 1 – Peer Authentication & Key Exchange

  1. Peers authenticate using pre-shared keys or certificates.
  2. Keys are exchanged via asymmetric encryption (e.g., Diffie-Hellman, DH).
    1. Each peer generates a DH private key (used to sign and decrypt data).
    2. Each peer derives a DH public key (used to encrypt data for the other peer).
    3. Peers exchange public keys.
    4. Each peer combines its private key with the peer’s public key to generate a shared symmetric DH key.
      • Both peers end up with the same DH key, independently derived.
    5. DH key is used to exchange additional keying information and agreements.
  3. Phase 1 Security Association (SA) is established – the initial tunnel.
    • DH key secures all data transmitted through Phase 1 tunnel.

IKE Phase 2 – Establishing the IPsec VPN

  1. Peers negotiate encryption parameters for the VPN and use the DH key to exchange additional key material.
    • Includes supported cipher suites and VPN type.
  2. New symmetric IPsec keys are generated for efficient bulk data transfer.
    • IPsec keys are independent of DH key for added security.
      • If original keys are compromised, IPsec keys remain protected.
  3. Phase 2 Security Association (SA) is created – the VPN tunnel runs over the Phase 1 tunnel.
Types of IPsec VPNs
  1. Route-based VPNs – traffic is directed according to IP prefixes.
    • One Phase 2 tunnel → one SA pair → one IPsec key.
  2. Policy-based VPNs – traffic is matched according to defined rulesets.
    • Multiple rulesets can exist, each with its own SA pair and IPsec key.

Route- vs Policy-based VPNs Diagram:

AWS Site-to-Site VPN

Site-to-Site VPN – Key Concepts

VPN Advantages and Limitations

Site-to-Site VPN – Architecture

Basic / Partially Highly Available Implementation

Steps to establish VPN:

  1. Collect necessary information: VPC CIDR, on-premises network CIDR, and on-prem router’s public IP.
  2. Create a VGW and attach it to the VPC.
    • VGW includes two physical endpoints in separate AZs, each with a public IP → provides HA on the AWS side.
  3. Create the CGW logical object in AWS using the on-prem router’s public IP.
  4. Create the VPN connection linking the VGW and CGW.
    • IPsec tunnels are established between each VGW endpoint and the on-prem router.
    • Two encrypted tunnels provide redundancy: if one fails, the other remains active.
    • Additional tunnels or VGWs can be created if more redundancy is needed.

Fully Highly Available Implementation

Static vs Dynamic VPNs

Static VPN

Dynamic VPN

Route Propagation

LAB: Simple Site-to-Site VPN

GOAL: On-prem laptop connects to a private AWS web application through a VPN
STAGE 0: Initial Setup
STAGE 1: Configure AWS VPN

This setup uses a static VPN configuration (no BGP).

STAGE 2: Configure On-Premises pfSense Router

Configure Networking

The router now has both public (WAN) and private (LAN) connectivity

Configure IPsec Tunnels

Phase 1 (IKE)

Phase 2 (IPsec)

Define tunnel networks:

Repeat both phases for the second Availability Zone

Establish Tunnels

STAGE 3: Routing and Security Configuration

Even with tunnels active, communication will fail without routing and firewall updates

AWS VPC Routing

On-Prem Routing

AWS Security Groups

On-Prem Security Groups

At this point, bidirectional communication is no longer blocked

STAGE 4: Validation

Connectivity Test

Application Test

This confirms the VPN is functioning correctly

STAGE 5: Cleanup

This prevents further charges after completing the lab.