Use it for site-to-site VPNs, route-based tunnels (VTI, DMVPN, FlexVPN) and remote access with IKEv2.
IPsec · VPN Security
IPsec protects IP packets with ESP (encryption and integrity) after IKE has authenticated the peers and agreed keys. It runs in tunnel mode (whole packet encapsulated) for VPNs, or transport mode between hosts.
1. show crypto session — tunnel UP-ACTIVE?
2. Down → IKE: show crypto ikev2 sa / show crypto isakmp sa; compare proposals and keys on both peers.
3. Up but no traffic → show crypto ipsec sa — encaps increasing, decaps not → the peer or return path.
4. Neither → routing or NAT sends traffic elsewhere.
5. debug crypto ikev2 briefly if negotiation fails.
peers reachable (UDP 500/4500, ESP) → IKE proposals match → peers authenticate → IKE SA up → IPsec SAs for the traffic → routing sends traffic into the tunnel → encrypt and decrypt counters increase
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Known-good closure and original test Verify boundary
Layered verification for IPsec: known test tuple → expected rule/binding → programmed policy/session → counter or capture delta → protected resource/application → reverse flow/regression Close only when the original source, destination, protocol, VRF/VLAN/policy context and return path are tested.
Step 2 Branching failure-boundary diagnosis Narrow the fault
Branch packet tuple/direction → prerequisite binding/state → matching rule/sequence → hardware/session programming → hit/drop counters for the test packet → downstream service/return path.
Step 3 Common mistakes Narrow the fault
- Weak algorithms left enabled.
- No monitoring of tunnel state.
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.
show crypto ikev2 sa— IKEv2 security associations and their state.show crypto isakmp sa— IKEv1 phase 1 state (QM_IDLE is up).show crypto ipsec sa— IPsec SAs, encrypt and decrypt counters.show crypto session— summary of tunnels and peers.show interfaces tunnel <n>— tunnel interface state for VTI/DMVPN.
ReferenceHow it works1 section · depth on demand
Mechanics and state boundaries
Separate packet classification inputs, rule/sequence ordering, state/binding dependencies, hardware programming and observed hit/drop counters. A configured permit or deny is only intent until the packet takes that path and the counter/evidence matches.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
IPsec
IPsec secures IP traffic at the network layer. RFC 4301 lists what it provides: access control, connectionless integrity, data origin authentication, replay detection, confidentiality and limited traffic-flow confidentiality, for IPv4 and IPv6. ESP is mandatory and AH optional; RFC 4301 doesn't recommend confidentiality without integrity.
Architecture (RFC 4301)
| Element | Role |
|---|---|
| Security Policy Database (SPD) | Ordered policy entries: PROTECT, BYPASS or DISCARD, matched on selectors (addresses, protocol, ports) |
| Security Association (SA) | Simplex: one direction, one protocol; two-way traffic needs a pair |
| SPI | Identifies the SA for unicast traffic |
| SA Database (SAD) | Parameters of established SAs |
| Peer Authorization Database (PAD) | Links IKE to the SPD |
| IKEv2 | Automated key management |
Modes (RFC 4301)
| Mode | Protects | Required when |
|---|---|---|
| Transport | The payload between two hosts | Host-to-host |
| Tunnel | A complete inner IP packet | Either end is a security gateway |
Recommended choices (NIST SP 800-77 Rev. 1)
| Area | Recommendation |
|---|---|
| Key exchange | IKEv2 |
| Protocol | ESP; AH no longer recommended |
| Encryption | AES (GCM, CTR, CBC or CCM) |
| Integrity | HMAC-SHA-2 or AES-GMAC |
| DH groups | 14–21 |
| Lifetimes | 24 h IKE SA, 8 h IPsec SA |
R1# show crypto ikev2 sa
IPv4 Crypto IKEv2 SA
Tunnel-id Local Remote fvrf/ivrf Status
1 198.51.100.2/500 203.0.113.10/500 none/none READY
Encr: AES-GCM, keysize: 256, PRF: SHA384, Hash: None, DH Grp:20, Auth sign: RSA, Auth verify: RSA
Life/Active Time: 86400/3611 sec
R1# show crypto ipsec sa | include spi|transform|pkts
current outbound spi: 0xA51C2D07(2770087175)
transform: esp-gcm 256 ,
#pkts encaps: 48211, #pkts encrypt: 48211, #pkts digest: 48211
Two SPIs (inbound and outbound) per tunnel reflect the RFC's simplex SAs.
Documented example, not captured output.
Quick reference
IPsec provides confidentiality, integrity and authentication at the IP layer: IKE (UDP 500/4500) negotiates keys and SAs; ESP (IP protocol 50) protects data.
crypto ikev2 proposal PROP
encryption aes-gcm-256
prf sha384
group 20
crypto ipsec transform-set TS esp-gcm 256
mode tunnel
show crypto ikev2 sa detail
show crypto ipsec sa | include pkts|spi|local|remote
NAT-T encapsulates ESP in UDP 4500 when NAT is detected. Rekey lifetimes and PFS settings must match on both peers.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Security → VPN Security → IPsec. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc4301.html · confidence 94%