Course contentsShow
← Security
Lesson 475 of 3,05211. Network Security - VPNs and TunnelingFree lesson

Security Associations (SA) and Security Policy Database

How IPsec maintains connection state through SAs and SPD entries for policy-based routing.

Security Associations (SA) and Security Policy Database

What you'll learn: How IPsec maintains connection state and enforces policy decisions through Security Associations and the Security Policy Database.

The Core Concept

When IPsec establishes a secure connection (like a VPN tunnel), it doesn't just send encrypted packets randomly. Instead, it creates a Security Association (SA) — a one-way agreement that defines exactly how to protect traffic between two endpoints. Think of an SA as a contract that specifies: "For traffic going from A to B, use AES-256 encryption, SHA-256 authentication, and here's the shared key."

Because communication is bidirectional, you actually need two SAs per connection: one for outbound traffic and one for inbound.

How the Security Policy Database (SPD) Works

Before an SA is created, IPsec consults the Security Policy Database (SPD) — a ruleset that determines what traffic needs protection and how to protect it. The SPD contains policy entries like:

  • "All traffic to 192.168.10.0/24 must be encrypted with ESP"
  • "Traffic on port 80 should bypass the VPN"
  • "Block traffic from untrusted subnet 10.5.5.0/24"

When a packet arrives or departs, IPsec checks the SPD first. Based on source/destination IP, port, and protocol, it decides: encrypt this, bypass that, or drop something else.

The Relationship

SPD → SA workflow:

  1. Packet arrives matching an SPD policy requiring encryption
  2. IPsec checks if an existing SA matches the policy
  3. If no SA exists, initiate key exchange (IKE) to create one
  4. Apply the SA's encryption/authentication parameters to the packet

Key Takeaway: Security Associations are the actual connection states containing cryptographic parameters, while the Security Policy Database acts as the decision-maker that determines which traffic needs protection and triggers SA creation for policy-based routing.