Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

IPsec

Direct answer

IPsec secures IP traffic with authentication and encryption, commonly for site-to-site and remote-access VPNs. IKE negotiates keys and security associations, and ESP protects the packets.

When to use this

Use this when building or troubleshooting IPsec VPNs.

First 30 seconds

1. IPsec architecture: IKE (keys), SAs, SPD (policies), ESP/AH.

2. Configure consistent proposals and selectors.

3. Strong algorithms.

4. Monitor SAs.

5. Plan MTU.

Operational verification

SPD policy → IKE → SA → ESP

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Network security
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformNetwork security
Key commandshow crypto ikev2 sa
Scope / prerequisiteUse this when building or troubleshooting IPsec VPNs.
What next?3 suggested next steps
Child topics (this level)13
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Checks Verify boundary
show crypto ikev2 sa
show crypto ipsec sa
swanctl --list-sas          # strongSwan

Encaps and decaps counters should both increase.

Step 2 Common mistakes Narrow the fault
  • Proposal mismatch (encryption, DH group, lifetime) between peers.
  • NAT between peers without NAT-T (UDP 4500).
  • Overlapping traffic selectors / proxy IDs.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Drill down

Subtopics

Go one level deeper into this subject.

Subtopic IPsec Architecture

IPsec architecture combines IKE for authentication and key exchange, ESP or AH for packet protection, security associations stored per direction, and transport or tunnel mode depending on what is protected.

Subtopic IKE Phase 1

IKE Phase 1 (IKEv1) authenticates the peers with pre-shared keys or certificates and builds a secure IKE SA using Diffie-Hellman, which protects the Phase 2 negotiation.

Subtopic IKE Phase 2

IKE Phase 2 (quick mode) negotiates the IPsec SAs that protect actual traffic — encryption, integrity, lifetimes, PFS and the traffic selectors or proxy IDs that must match on both ends.

Subtopic IKEv2

IKEv2 is the modern IPsec key exchange: fewer messages, built-in NAT traversal, dead peer detection, EAP for remote access and MOBIKE for roaming clients.

Subtopic ESP

ESP (Encapsulating Security Payload, IP protocol 50) encrypts and authenticates IPsec packets.

Subtopic Authentication Header

AH (Authentication Header, IP protocol 51) gives IPsec packets integrity and origin authentication but no encryption.

Subtopic Security Associations

A security association (SA) is a one-way agreement on keys, algorithms and lifetime between IPsec peers, identified by an SPI.

Subtopic Encryption Algorithms

IPsec encryption algorithms protect the data: use AES-GCM (128 or 256) or AES-CBC with a separate integrity algorithm.

Subtopic Integrity Algorithms

IPsec integrity algorithms detect tampering, such as HMAC-SHA-256 or SHA-384.

Subtopic Diffie-Hellman Groups

Diffie-Hellman groups set the strength of IPsec key exchange.

Subtopic Perfect Forward Secrecy

Perfect forward secrecy (PFS) in IPsec runs a fresh Diffie-Hellman exchange for each Phase 2 SA, so a compromised long-term key cannot decrypt past traffic.

Subtopic NAT Traversal

NAT traversal (NAT-T) detects NAT between IPsec peers and wraps ESP in UDP port 4500, because NAT devices cannot translate raw ESP packets.

Subtopic IPsec Troubleshooting

Troubleshoot IPsec by checking IKE and IPsec SA status, matching proposals (encryption, hash, DH group, lifetimes), pre-shared key or certificates, traffic selectors, UDP 500 and 4500 and ESP reachability, NAT and routing.

Key points
  • IKE negotiates; ESP protects packets.
  • Both ends must match proposals and traffic selectors.
  • NAT requires NAT-T over UDP 4500.
Key checks
  • ip xfrm state; ip xfrm policy — Linux IPsec
  • show crypto ipsec sa — Cisco
  • swanctl --list-sas — strongSwan
ReferenceWhy it matters1 section · depth on demand

What IPsec provides

IPsec protects IP packets with ESP (encryption and integrity) or AH (integrity only). IKE (UDP 500, and 4500 with NAT-T) authenticates peers and negotiates keys. It is used for site-to-site VPNs, remote access and host-to-host encryption.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

IPsec protects IP traffic with encryption, integrity and authentication at the network layer, transparently to applications. It is the standard for site-to-site VPNs and still widely used for remote access and cloud connectivity.

Components:

ComponentRole
IKE (v2)Authenticates peers, negotiates algorithms, derives keys
ESPEncrypts and authenticates packets
AHAuthentication only, rarely used
Security AssociationsAgreed parameters per direction
Tunnel / transport modeWhole packet vs payload protection

The topics in this group cover IKE phases, algorithm choices (encryption, integrity, DH groups, PFS) and the trade-offs that decide whether a tunnel is both secure and interoperable.

Building blocks

PartRole
IKEv2Peer authentication and key exchange
ESP (protocol 50)Encrypted, authenticated payload
SAOne-way agreement on keys and algorithms
Tunnel / transport modeNew outer IP header or original header kept
NAT-TESP inside UDP 4500 through NAT
Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docNetwork security current

Authoritative/upstream documentation reviewed for bounded claims in IPsec. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://www.rfc-editor.org/rfc/rfc4301 · confidence 94%
Confirmation

Confirm action

Continue?