Pcornel
Browse topics
Options
Recent
Favorites
Networking · Technical reference

ESP

Direct answer

Encapsulating Security Payload (ESP, IP protocol 50) is the IPsec protocol that encrypts and authenticates the payload; it is used in almost all IPsec VPNs.

When to use this

Use it to understand what ESP protects, and when ESP is blocked by a firewall or NAT.

First 30 seconds

1. ESP (IP protocol 50) provides encryption and integrity.

2. NAT-T wraps ESP in UDP 4500.

3. Check encaps/decaps counters.

4. Firewalls must allow ESP or UDP 4500.

5. Use tunnel mode for site-to-site.

Operational verification

packet → ESP encrypt → peer decrypt

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 to understand what ESP protects, and when ESP is blocked by a firewall or NAT.
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

Generate a unique protected flow and compare outbound/inbound ESP packet counters, SPI/SA state and post-decrypt inner traffic on both peers. ESP packets on the wire show encapsulated transport only; they do not show successful decryption, inner routing or application response. Close with the same original workload.

Step 2 Observation → implication → next check Narrow the fault

Observation → implication → next check: IKE/child SA present with zero ESP counters points to traffic selectors or routing into the tunnel. Outbound ESP increasing without inbound response moves to peer path/firewall/NAT or remote policy. Inbound ESP with decrypt/replay errors moves to SA/key/replay state before application troubleshooting.

Step 3 Common mistakes Narrow the fault
  • ESP (IP 50) blocked when NAT-T is not in use.
  • Forgetting ESP overhead in MTU/MSS planning.
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 — ESP SPI and counters
ReferenceWhy it matters1 section · depth on demand

How it works in operation

ESP carries protected IPsec payloads and provides confidentiality and/or integrity according to the negotiated child SA. Security policy/selectors decide which traffic enters ESP; sequence numbers, SPI and replay state belong to the SA, while routing and NAT still decide whether encapsulated packets reach the peer.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

ESP: the protocol that carries protected IPsec traffic

RFC 4303 defines the Encapsulating Security Payload. ESP is IP protocol 50 and provides confidentiality, data origin authentication, connectionless integrity, anti-replay and limited traffic-flow confidentiality. Integrity-only ESP must be supported; confidentiality-only ESP is optional.

ESP packet format (RFC 4303)

FieldSizeProtected by
SPI32 bitsIntegrity
Sequence Number32 bitsIntegrity
Payload DataVariableEncryption and integrity
Padding0–255 bytesEncryption and integrity
Pad Length8 bitsEncryption and integrity
Next Header8 bitsEncryption and integrity
ICV (Integrity Check Value)Variable—

Modes (RFC 4303)

ModeLayoutUse
TransportIP header / ESP / original payloadHost-to-host, or GRE over IPsec between the tunnel endpoints
TunnelNew IP header / ESP / original IP packetGateway-to-gateway VPNs and VTIs
host$ sudo tcpdump -n -i eth0 'esp or udp port 4500'
IP 198.51.100.2 > 203.0.113.2: ESP(spi=0x4d02b7e3,seq=0x1cb8f2), length 152
IP 203.0.113.2 > 198.51.100.2: ESP(spi=0x8c1f22a1,seq=0x1b6a09), length 104
IP 192.0.2.77.4500 > 203.0.113.2.4500: UDP-encap: ESP(spi=0x2a91c6d0,seq=0x12), length 136

The first two lines are native ESP. The third is ESP in UDP 4500, used when NAT sits between the peers.

Algorithms (RFC 4303)

ESP can use separate encryption and integrity algorithms, or a combined-mode algorithm such as AES-GCM that provides both in one operation. With combined mode the integrity check is part of the algorithm's output.

Anti-replay (RFC 4303)

The receiver uses a sliding window to drop duplicates and packets older than the window. The minimum window is 32 and the recommended default 64. Anti-replay needs integrity to be enabled.

ESP versus AH

AH (protocol 51) authenticates the packet, including parts of the outer IP header, but doesn't encrypt and can't pass through NAT. ESP is used for practically all IPsec VPNs today.

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

ESP is the IPsec protocol that actually carries protected traffic. It encrypts the payload and adds integrity and replay protection. Because ESP is its own IP protocol rather than TCP or UDP, firewalls and NAT devices must handle it explicitly; when NAT is detected, IPsec wraps ESP inside UDP 4500 instead.

ESP (IP protocol 50) provides confidentiality, integrity and anti-replay for the payload. Tunnel mode encrypts the whole original packet behind a new IP header; transport mode (used under GRE) protects only the payload.

crypto ipsec transform-set TS esp-gcm 256
 mode tunnel
show crypto ipsec sa | include pkts|spi|current_peer

AH (protocol 51) authenticates without encryption and breaks with NAT — it is rarely used. Firewalls between peers must allow UDP 500/4500 and ESP (or only UDP 4500 when NAT-T is in use).

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 → ESP. 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?