Pcornel
Security · IPsec

IPsec Troubleshooting

Cheat sheet · https://pcornel.dk/topic.php?topic=4666

Back to the Topic

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.

Remember

  • Most failures are proposal or selector mismatches.
  • NAT needs UDP 4500.
  • Routing must send traffic into the tunnel.

First checks

  • swanctl --log / debug crypto ikev2 — negotiation logs
  • show crypto ipsec sa — counters
  • ping -M do -s 1400 <remote> — MTU through tunnel

Commands

ip xfrm state
Inspect Linux IPsec/XFRM security associations. Focus fields: source/destination, SPI, protocol, mode, algorithms, key …

Verify in this order

IKE → auth → child SA → data path

Where it usually breaks

First mismatch in endpoint/identity → path/reachability → policy selection → enforcement/session → protected flow → telemetry/detection; preserve identity/policy/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4666

Confirmation

Confirm action

Continue?