Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

IPsec SA

Direct answer

An IPsec security association (SA) is a one-way agreement on keys, algorithms and SPI for protecting traffic; each tunnel has a pair, visible with show crypto ipsec sa.

When to use this

Use IPsec SA when IKE is up but traffic fails: inbound/outbound SAs, SPIs, proxy identities, counters and lifetimes.

First 30 seconds

1. IPsec SAs are unidirectional (one in, one out).

2. Rekey before lifetime expires.

3. Traffic selectors must match (proxy IDs).

4. Counters show traffic.

5. Mismatched selectors give one-way tunnels.

Operational verification

IKE → child SAs (in/out) → encrypt/decrypt → rekey

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Protocol standard + deployed implementation
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.

PlatformProtocol standard · Cisco IOS / IOS XE
Scope / prerequisiteUse IPsec SA when IKE is up but traffic fails: inbound/outbound SAs, SPIs, proxy identities, counters and lifetimes.
What next?3 suggested next steps
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.

4 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 Layered verification and original-test closure Verify boundary

IPsec SA — Send one selector-matching flow and correlate outbound encrypt plus peer inbound decrypt counters, SPI and lifetime; then verify return traffic on the reciprocal SA.

Step 2 Verification & troubleshooting Narrow the fault
SymptomCommandLook forNext check
Traffic one way onlyshow crypto ipsec sa#pkts encaps vs #pkts decaps on both peersRouting or ACL on the side that does not encapsulate
No SA for the trafficsamelocal/remote ident (proxy IDs)Crypto ACLs must be mirror images (crypto map designs)
Decrypt or verify failuressame#pkts decrypt failed, #recv errorsKeys out of sync after rekey; clear the SA and compare lifetimes
Replay dropssame / syslogReplay check failuresQoS reordering; crypto ipsec security-association replay window-size 1024
Step 3 Observation → implication → next check Narrow the fault

IPsec SA — If traffic is not protected, confirm selectors and route/NAT order, then check encrypt counters. If encrypt increments but decrypt does not on the peer, inspect path/firewall/SPI; if decrypt increments with errors, inspect integrity/replay.

Step 4 Common mistakes Narrow the fault
  • Assuming the IPsec SA is up because the IKE SA is up.
  • Lifetime mismatch causing rekey drops.
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
Command lookup Jump straight to Cisco syntax
Key points
  • IKE SA and IPsec child SA are separate evidence boundaries
  • Proxy identities/selectors must agree at both peers
  • ESP commonly carries protected data; NAT traversal can encapsulate it in UDP 4500
  • Encaps and decaps counters must be interpreted with generated interesting traffic and the return path.
Key checks
  • show crypto ipsec sa — SAs with SPIs, lifetimes, counters
  • show crypto session detail — session state
ReferenceWhat it is1 section · depth on demand

What it is

An IPsec SA is a one-way agreement between two peers: SPI, protocol (ESP), algorithms and keys, traffic selectors (proxy identities), mode (tunnel or transport) and lifetime in time and volume. A working tunnel has at least one inbound and one outbound ESP SA on each peer, each identified by its SPI. The IKE SA that negotiated them is a separate object.

SAs are rekeyed before the lifetime expires (IOS default 3,600 seconds or 4,608,000 KB). Anti-replay drops packets whose sequence number is outside the replay window.

ReferenceWhy it matters1 section · depth on demand

When to use it

Read the IPsec SA when IKE is up but traffic fails, counters increase on one side only, rekeys break traffic or replay errors appear.

ReferenceHow it works1 section · depth on demand

Operational mechanics and ownership

IPsec SA — An IPsec Security Association is unidirectional state describing SPI, algorithms, keys, lifetime and traffic selection for protected packets; bidirectional traffic normally requires paired inbound/outbound SAs. The IPsec data plane owns encapsulation/encryption and anti-replay state after IKE or manual keying created the SA. A present SA can be idle, mismatched to selectors or expiring.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

The IPsec SA: one direction of protected traffic

An IPsec security association (SA) holds everything needed to protect traffic in one direction: algorithms, keys, sequence counter and lifetime. RFC 4303 has the receiver find the SA by its SPI. A tunnel therefore uses at least one SA pair: one inbound and one outbound, each with its own SPI. RFC 7296 calls these Child SAs, created under the IKE SA, and states that deleting the IKE SA closes its Child SAs.

R1# show crypto ipsec sa interface Tunnel100
interface: Tunnel100
    Crypto map tag: Tunnel100-head-0, local addr 198.51.100.2
   protected vrf: (none)
   local  ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
   remote ident (addr/mask/prot/port): (0.0.0.0/0.0.0.0/0/0)
   current_peer 203.0.113.2 port 500
    #pkts encaps: 1882231, #pkts encrypt: 1882231, #pkts digest: 1882231
    #pkts decaps: 1794410, #pkts decrypt: 1794410, #pkts verify: 1794410
    #send errors 0, #recv errors 0
     inbound esp sas:
      spi: 0x8C1F22A1(2350850721)
        transform: esp-gcm 256 ,
        in use settings ={Tunnel, }
        sa timing: remaining key lifetime (k/sec): (4607612/2311)
        replay detection support: Y
     outbound esp sas:
      spi: 0x4D02B7E3(1292023779)

SA contents

FieldMeaning
SPI32-bit identifier carried in every ESP packet
TransformEncryption and integrity algorithms (here AES-GCM 256)
ModeTunnel or transport
KeysDerived by IKE
Sequence number32 bits on the wire; extended 64-bit sequence numbers (ESN) can be negotiated (RFC 4303)
LifetimeSeconds and/or kilobytes before rekeying
Traffic selectorsWhich traffic the SA covers; 0.0.0.0/0 both ways for a VTI

Sequence numbers and rekeying (RFC 4303)

The sender's counter starts at 0, so the first packet carries 1, and the sender must establish a new SA before the 32-bit counter would wrap. With ESN, only the low 32 bits are sent, and the high bits are included implicitly in the integrity check. On fast links, ESN avoids frequent forced rekeys.

Lifetimes

TriggerTypical Cisco default
Time3600 s
Volume4,608,000 KB

Rekeying starts before expiry, so a new SA pair is ready when the old one is deleted (RFC 7296: create the new SA first, then delete the old one).

Multiple SAs

A crypto map with several ACL lines creates one SA pair per line. A static VTI uses one pair for any/any traffic by default; Cisco's VTI guide notes multiple SAs with ACL traffic selectors from IOS XE 16.12.1.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Quick reference

An IPsec SA (security association) is a one-way agreement on how to protect traffic: protocol (ESP), algorithms, keys, SPI and lifetime. A tunnel always has a pair of SAs — inbound and outbound — per Child SA.

show crypto ipsec sa
! local ident: 10.10.0.0/16  remote ident: 10.60.0.0/16
! #pkts encaps: 1520, #pkts decaps: 1498
! inbound esp sas: spi: 0x1A2B3C4D ... outbound esp sas: spi: 0x5E6F7A8B

Documented example, not captured output.

SAs are rekeyed before their lifetime (time or volume) expires; mismatched lifetimes are negotiated to the lower value.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
ReferenceConfiguration & state1 section · depth on demand

Configuration example (Cisco IOS XE)

crypto ipsec transform-set TS esp-gcm 256
 mode tunnel
crypto ipsec profile IPSEC-B
 set transform-set TS
 set security-association lifetime seconds 3600
 set pfs group19

Documented example, not captured output.

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 docProtocol standard + deployed implementation RFC 4301

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

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

Confirm action

Continue?