Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

ESP · IPsec

Direct answer

ESP (Encapsulating Security Payload, IP protocol 50) encrypts and authenticates IPsec packets. In tunnel mode it protects the whole original packet, and over NAT it is carried in UDP 4500.

When to use this

Use this when ESP protects IPsec traffic.

First 30 seconds

1. ESP provides confidentiality, integrity and anti-replay.

2. AES-GCM (AEAD) recommended.

3. Sequence numbers / ESN for anti-replay.

4. Check both counters.

5. Replay errors = reordering or duplicate SAs.

Operational verification

payload → ESP encrypt/authenticate → peer decrypts

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • ESP (IP protocol 50) blocked by a firewall while UDP 500 is allowed — the tunnel comes up but no data passes.
  • Using ESP without integrity (encryption-only) — always use AEAD or an HMAC.
  • Fragmentation after encryption causing slow or broken large transfers.
  • Anti-replay window too small for networks with packet reordering (QoS).
Platform / version applicability
Network security
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.

PlatformNetwork security
Scope / prerequisiteUse this when ESP protects IPsec traffic.
What next?2 suggested next steps
Evidence1
On this pageJump to a specific section
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
Key points
  • ESP is IP protocol 50.
  • Tunnel mode protects the whole original packet.
  • Behind NAT, ESP is carried in UDP 4500.
Key checks
  • ip xfrm state | grep -E 'aead|enc|auth' — algorithms
  • show crypto ipsec sa | include encaps|decaps — counters
  • tcpdump -ni <if> esp or udp port 4500 — packets
ReferenceWhy it matters1 section · depth on demand

Tunnel vs transport mode

Tunnel modeTransport mode
ProtectsWhole original IP packetPayload only
New IP headerYes (gateway addresses)No (original addresses visible)
Typical useSite-to-site VPN, VTIHost-to-host, GRE over IPsec

ESP adds a header (SPI, sequence number), padding and an integrity check value. show crypto ipsec sa shows encaps/decaps counters per SA; counters increasing on only one side point to routing or a filter on the return path.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

ESP in the IPsec architecture provides confidentiality, data origin authentication, integrity and anti-replay for packets. With AEAD algorithms such as AES-GCM, one algorithm provides both encryption and integrity.

ESP packet structure (tunnel mode):

PartContents
New IP headerGateway addresses
ESP headerSPI, sequence number
IVPer-packet value
Encrypted payloadOriginal IP packet + padding + next header
ICVIntegrity check value

Anti-replay drops packets with sequence numbers outside the window; QoS reordering after encryption can cause replay drops, which are visible as replay errors in SA statistics.

ESP packet layout

[ New IP ][ ESP header: SPI, Seq ][ IV ][ Inner IP + payload (encrypted) ][ Padding, Next header ][ ICV ]

Overhead is roughly 50–60 bytes in tunnel mode with AES-GCM, more with CBC + HMAC. Lower the tunnel MTU or TCP MSS (e.g. ip tcp adjust-mss 1360) to avoid fragmentation.

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 docNetwork security current

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

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

Confirm action

Continue?