Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

IPsec Troubleshooting

Direct answer

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.

When to use this

Use this when an IPsec tunnel does not come up or pass traffic.

First 30 seconds

1. Common errors: proposal mismatch, auth failure, selector mismatch, NAT/firewall blocking, MTU.

2. Compare configs side by side.

3. Check time (certificates).

4. DPD and rekey problems.

5. Clear SAs after fixes.

Operational verification

IKE → auth → child SA → data path

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 · Linux / iproute2
Key commandip xfrm state
Scope / prerequisiteUse this when an IPsec tunnel does not come up or pass traffic.
Reference · 1
What next?3 suggested next steps
Catalog command links1
Evidence0
On this pageJump to a specific section
Security command reference

Primary Commands

Configuration and operational commands for this Topic.

Operational workflow

Verification & Troubleshooting

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

3 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 Verify IPsec with IKE/child-SA identity and bidirectional protected-packet counters Verify boundary

Verify IPsec by capturing IKE state Established and the expected child-SA local/remote selectors with active SPIs. Send one bounded protected flow and expect encrypt and decrypt packet counters to increase from their recorded baseline with replay/authentication errors at 0, then repeat the original application request through the tunnel. An established IKE SA shows peer authentication and key negotiation, but it does not show the correct child selector, routing choice or remote application path.

Step 2 Branch IPsec troubleshooting at IKE reachability, authentication, child-SA creation and encrypted traffic Narrow the fault

If IPsec has no IKE exchange, verify peer routing and UDP 500/4500 reachability. If IKE starts but authentication fails, inspect peer identity, PSK or certificate chain and clock state. If IKE is Established but no child SA appears, compare encryption/integrity proposals and traffic selectors. If child SAs exist but encrypt counters remain 0, inspect routing and interesting-traffic match. If encrypt rises but decrypt stays 0, capture the return path, NAT-T and remote selector state before clearing SAs.

Step 3 Common mistakes Narrow the fault
  • Debugging IPsec before checking IKE.
Key points
  • Most failures are proposal or selector mismatches.
  • NAT needs UDP 4500.
  • Routing must send traffic into the tunnel.
Key checks
  • swanctl --log / debug crypto ikev2 — negotiation logs
  • show crypto ipsec sa — counters
  • ping -M do -s 1400 <remote> — MTU through tunnel
ReferenceWhy it matters1 section · depth on demand

IPsec separates IKE peer state from child SA selectors, keys and encrypted packet counters

IPsec troubleshooting should treat IKE and ESP/AH data security associations as separate state machines. IKE authenticates peers and negotiates key material, while child SAs own traffic selectors, transforms, lifetimes and packet protection. A healthy IKE SA can coexist with no child SA because selectors or proposals differ, and a child SA can exist while routing sends traffic elsewhere. Record peer IDs, IKE version, proposal, child selectors, SPI values and encrypt/decrypt counters before clearing IPsec state.

ReferenceImportant terms & boundaries1 section · depth on demand

In depth

IPsec troubleshooting proceeds layer by layer: reachability, IKE negotiation, IPsec SA creation, then traffic flow.

StageSymptomCheck
ReachabilityNo IKE packets answeredUDP 500/4500 and ESP allowed; NAT in path
IKENo IKE SAProposals, PSK/certificates, identities, clock (certificates)
Child SAIKE up, no IPsec SATraffic selectors, PFS group, transform sets
TrafficSA up, no trafficRouting into tunnel, NAT exemption, firewall policy, MTU
StabilityDrops at rekeyLifetime/PFS mismatch, DPD settings
show crypto ikev2 sa
show crypto ipsec sa | include pkts|errors
show crypto session detail
swanctl --list-sas
journalctl -u strongswan --since "10 min ago"
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 → IPsec Troubleshooting. 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?