Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

IPsec Integrity

Direct answer

IPsec integrity (HMAC-SHA or AES-GCM) detects any change to protected packets and, with sequence numbers, rejects replayed packets.

When to use this

Use it when choosing integrity algorithms, or when packets are dropped as failing integrity checks.

First 30 seconds

1. Integrity (HMAC SHA-2 or GCM) detects tampering.

2. Replay protection drops old packets.

3. Replay errors can follow QoS reordering.

4. Use SHA-256+.

5. Watch verify failure counters.

Operational verification

packet → integrity check → accept/drop

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 it when choosing integrity algorithms, or when packets are dropped as failing integrity checks.
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.

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 Verification and what it shows Verify boundary

Record the integrity algorithm negotiated in the live SA and compare inbound authentication/replay/decrypt counters before and after a controlled protected flow. A configured integrity algorithm is not evidence of negotiation; clean ESP integrity counters show packet validation at that SA only, not application delivery or response.

Step 2 Observation → implication → next check Narrow the fault

Observation → implication → next check: IKE success with child-SA integrity mismatch moves to proposal negotiation and peer policy. ESP received with authentication failures moves to SA/key synchronization; replay errors move to sequence/replay-window state. Clean decapsulation with application failure moves to inner routing/firewall/service.

Step 3 Common mistakes Narrow the fault
  • MD5 or SHA-1 still in proposals.
  • Adding a separate integrity algorithm with AES-GCM (not needed).
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 — #pkts verify, integrity failures
  • show crypto ipsec sa detail — auth algorithm
ReferenceWhy it matters1 section · depth on demand

How it works in operation

IPsec integrity authenticates protected packet content according to the active SA and is distinct from encryption. Integrity/authentication failures occur after packets reach the peer and can coexist with healthy routing and IKE control state. Replay protection is related state but should be separated from cryptographic integrity mismatch.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

Integrity in IPsec: detecting tampering and spoofing

Integrity protection lets the receiver verify that a packet came from the peer and wasn't changed. RFC 4303 lists data origin authentication and connectionless integrity among ESP's services, and states that integrity-only ESP must be supported. The integrity check value (ICV) covers the ESP header, payload and trailer.

How integrity is provided

ApproachExampleICV
Separate HMACAES-CBC + HMAC-SHA-256Appended after the trailer
Combined-mode algorithmAES-GCMProduced by the algorithm itself (RFC 4303 notes the ICV may be handled inside the combined algorithm)

Anti-replay depends on integrity

RFC 4303 states that anti-replay can only be enabled when integrity is enabled. Without integrity, an attacker could change sequence numbers freely, so the replay window would protect nothing.

Extended sequence numbers

With ESN, the high 32 bits of the 64-bit sequence number aren't sent but are included in the ICV calculation (RFC 4303). A receiver that guesses the high bits wrong gets an integrity failure, which is how the two sides stay in step.

R1(config)# crypto ipsec transform-set TS-CBC esp-aes 256 esp-sha256-hmac
R1(config)# crypto ipsec transform-set TS-GCM esp-gcm 256
R1(config)# crypto ikev2 proposal PROP
R1(config-ikev2-proposal)# encryption aes-gcm-256
R1(config-ikev2-proposal)# prf sha384
R1# show crypto ipsec sa | include verify|failed|replay
    #pkts decaps: 1794410, #pkts decrypt: 1794410, #pkts verify: 1794410
    #pkts invalid sa (rcv): 0, #pkts invalid prot (recv): 0
    #pkts verify failed: 0
    #pkts replay rollover (send): 0, #pkts replay rollover (rcv): 0
    #pkts replay failed (rcv): 0

Integrity in IKE

IKE has its own integrity protection. With AES-GCM in IKEv2, integrity is part of the encryption algorithm, and a PRF (such as SHA-384) is still configured for key derivation. With AES-CBC, an integrity algorithm (integrity sha256) is set explicitly.

Algorithm status

AlgorithmStatus
HMAC-SHA-256/384/512Recommended
AES-GCM (combined)Recommended
HMAC-SHA-1Legacy
HMAC-MD5Don't use

Counters to watch

verify failed means packets failed the integrity check: corruption, a key mismatch, or an attack. replay failed means packets fell outside the anti-replay window, often from reordering in QoS queues.

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

Integrity protection shows that each packet came from the peer and was not altered on the way. IPsec adds a cryptographic checksum to every packet and a sequence number that rejects replayed copies. These checks occasionally reject legitimate traffic when packets are reordered after encryption, which shows up as replay errors in the logs.

Integrity protection (HMAC or the GCM authentication tag) ensures packets were not modified and come from the peer holding the keys; anti-replay sequence numbers reject duplicated packets.

show crypto ipsec sa | include replay|auth
%CRYPTO-4-PKT_REPLAY_ERR

Replay errors often come from QoS reordering packets after encryption; enlarging the window (crypto ipsec security-association replay window-size 1024) helps. Use SHA-256 or stronger; MD5 and SHA-1 are deprecated for IPsec integrity.

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

Authoritative/upstream documentation reviewed for bounded claims in Virtualization & Overlays → IPsec → Integrity. 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?