Pcornel
Networking · Security › VPN Security

IPsec

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

Back to the Topic

Answer

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.

Remember

IKE uses UDP 500, and UDP 4500 when NAT is detected; ESP is IP protocol 50. Phase 1 (IKE SA) and phase 2 (IPsec SA) parameters must match. Route-based VPNs (VTI) are easier to operate than crypto-map policy VPNs.

First checks

  • 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.

Verify in this order

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

Where it usually breaks

underlay IP/transport → control/session registration → route/endpoint distribution → policy/segment → encapsulation/tunnel state → decapsulation/egress → return path

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

Confirmation

Confirm action

Continue?