Courseiva
VPNNetwork SecurityIntermediate24 min read

What Is ESP? Security Definition

Reviewed byJohnson Ajibi· Senior Network & Security Engineer · MSc IT Security
On This Page

Quick Definition

ESP is a security protocol used in VPNs to keep your data private and safe while it travels across the internet. It works by encrypting the information you send so that only the intended receiver can read it. ESP also checks that the data hasn't been tampered with during transmission.

Common Commands & Configuration

crypto ipsec transform-set MYSET esp-aes 256 esp-sha-hmac

Creates an IPsec transform set called MYSET that uses ESP with AES 256-bit encryption and SHA-256 HMAC for authentication.

crypto map MYMAP 10 ipsec-isakmp

Creates a crypto map named MYMAP with sequence number 10, using IPsec with IKE (isakmp) for key negotiation.

set transform-set MYSET

Associates the previously defined transform set MYSET with the crypto map entry.

set peer 203.0.113.20

Sets the IP address of the remote VPN gateway peer for the crypto map.

match address 101

Specifies the access list number that defines the traffic to be encrypted by the crypto map.

interface GigabitEthernet0/1

Selects the interface that will apply the crypto map.

crypto map MYMAP

Applies the crypto map to the interface, enabling IPsec encryption on outgoing traffic.

show crypto ipsec sa

Displays the current state of IPsec Security Associations, including packet encryption and decryption counts.

ip tcp adjust-mss 1360

Sets the TCP maximum segment size to 1360 bytes to avoid fragmentation caused by ESP overhead.

Must Know for Exams

ESP is a core concept for the CCNA exam, and understanding it is essential for answering questions about VPNs, IPsec, and network security. In the CCNA 200-301 exam, IPsec and ESP appear under the topic of 'Virtual Private Networks (VPNs)' which is part of the wider security section. While the exam does not require deep cryptographic knowledge, you must know the basic functions of ESP — confidentiality, integrity, and authentication — and how it differs from Authentication Header (AH).

Expect questions that ask you to identify which IPsec protocol provides encryption (ESP) and which provides only authentication (AH). You may also be asked about ESP modes: transport mode encrypts only the payload, while tunnel mode encrypts the entire original packet. A typical exam question might present a scenario where a company needs to secure traffic between two branch offices across the internet, and you must choose between transport mode and tunnel mode.

The correct answer is usually tunnel mode, because it hides the internal IP addresses and is better suited for site-to-site VPNs. Another common question involves the ESP packet structure: you might be asked to identify the fields that provide integrity (the ICV) or anti-replay protection (the sequence number). The exam also expects you to understand that ESP uses Security Associations (SAs) negotiated via IKE.

A possible question could describe a VPN connection that fails to establish, and you need to identify that the encryption algorithms in the transform sets do not match. Additionally, the CCNA covers the concept of overlay vs. underlay networks in VPNs, and ESP is the mechanism that creates the encrypted overlay.

You might see a question asking which component of IPsec provides data encryption, with answer choices like ESP, AH, IKE, or ISAKMP. ESP is the correct choice. The exam may also test your knowledge of anti-replay protection, which uses the sequence number in the ESP header.

In summary, while ESP is not the most heavily weighted topic on the CCNA, it is a reliable source of straightforward questions that can earn you easy points if you understand the fundamentals. Make sure you can distinguish ESP from AH, know the two modes, and recall that ESP provides confidentiality, integrity, and authentication.

Simple Meaning

Imagine you are sending a secret letter through the mail. You put your letter inside a locked box that only you and the recipient have the key to open. This locked box is like ESP in a VPN.

Even if someone intercepts the box, they cannot read your letter because it is encrypted. ESP also adds a special tamper-proof seal to the box. If someone tries to open the box or change the letter, the seal breaks, and the recipient knows the message has been altered.

ESP works at the internet protocol (IP) level, meaning it protects the data inside each packet that travels across the network. It can encrypt the entire packet or just the payload, depending on how it is configured. ESP also provides authentication, which means the recipient can verify that the data actually came from you and not an imposter.

In a VPN, ESP is like a secure tunnel for your data. Without ESP, your information would travel in plain text, like a postcard that anyone can read along the way. With ESP, everything is sealed and locked, so your online activity remains private and secure.

This is why ESP is a fundamental building block for secure communications over the internet, especially for remote workers accessing company networks or for protecting sensitive data as it crosses public networks.

Full Technical Definition

Encapsulating Security Payload (ESP) is a transport layer security protocol within the IPsec suite, defined in RFC 4303. It provides origin authentication, connectionless integrity, anti-replay protection, and optional confidentiality through encryption. ESP operates in two modes: transport mode and tunnel mode.

In transport mode, ESP only encrypts the payload of the original IP packet, leaving the original IP header intact. In tunnel mode, ESP encrypts the entire original IP packet and then encapsulates it within a new IP header. This is commonly used in VPNs where the entire internal packet must be hidden from external networks.

ESP uses a Security Association (SA), which is a set of parameters negotiated between two communicating peers, including encryption algorithms (like AES, 3DES), authentication algorithms (like HMAC-SHA1, HMAC-MD5), and keys. The SA is established through IKE (Internet Key Exchange) or manual keying. The ESP packet format begins with a Security Parameters Index (SPI), which identifies the SA, followed by a sequence number for anti-replay protection.

Next comes the payload data, which is encrypted. After the payload, padding is added to align the data to block cipher boundaries, followed by the Pad Length and Next Header fields. The Next Header indicates the type of data in the payload (e.

g., TCP, UDP, or IP in tunnel mode). Finally, an Integrity Check Value (ICV) is appended, which is a cryptographic checksum that validates the packet's integrity and authenticity. ESP uses symmetric encryption, meaning the same key is used for both encrypting and decrypting.

The encryption algorithms commonly used include AES (Advanced Encryption Standard) in Cipher Block Chaining (CBC) mode or Galois/Counter Mode (GCM), which can also provide authentication. When GCM is used, the ICV is computed as part of the encryption process, combining confidentiality and integrity in a single operation. ESP does not protect the outer IP header, which means that while the payload is secure, the source and destination addresses can still be seen by an eavesdropper.

For full network-layer security, ESP is often used with Authentication Header (AH), which provides integrity for the entire packet including the outer header. In practice, many IT professionals implement ESP in tunnel mode for site-to-site VPNs, where entire subnets communicate through a secure gateway. Typical configuration on Cisco devices involves creating a crypto map, defining transform sets that specify the encryption and authentication algorithms, and applying the map to the outgoing interface.

Real-Life Example

Think of ESP like a secure courier service for your most private documents. You have a sensitive contract that needs to get from your office to a lawyer's office across town. Instead of sending it by regular mail, you hire a bonded courier.

First, you put the contract inside a tamper-proof briefcase. This is like encrypting the data. The briefcase is locked with a special combination that only you and the lawyer know.

If anyone tries to pry it open, the lock will jam and the contents will be scrambled. That is the confidentiality part of ESP. Next, the courier attaches a unique seal to the briefcase that shows the time it left your office.

When the lawyer receives the briefcase, they check the seal to make sure it hasn't been broken. This is the integrity check. The seal also proves that the briefcase came from you, not a stranger.

That is the authentication part. Now, the courier drives through the busy streets, but the briefcase itself is secure even if someone gets a look at it. In this analogy, the courier's truck is like the outer IP header — it can be seen by everyone, but the briefcase inside is locked.

If you wanted even more secrecy, you could put the contract inside a bigger box that hides the destination address, which is like ESP in tunnel mode. The lawyer eventually opens the briefcase using the combination, decrypting the contract. The entire process ensures that your contract is delivered privately, unchanged, and without anyone intercepting it along the way.

This is exactly how ESP protects your data as it travels across the internet: it locks it in a secure tunnel, verifies its origin, and ensures it arrives exactly as it was sent.

Why This Term Matters

ESP matters because it is the mechanism that makes VPNs secure enough for real-world business use. Without ESP, any data sent across a VPN would be vulnerable to eavesdropping, tampering, and impersonation attacks. For IT professionals, understanding ESP is critical for configuring, troubleshooting, and optimizing VPN connections.

When a remote employee connects to the corporate network, ESP ensures that their login credentials, file transfers, and internal communications are encrypted, preventing attackers from stealing sensitive information over public Wi-Fi or the open internet. ESP also provides anti-replay protection, meaning that even if an attacker captures a packet and tries to resend it later, the receiver will detect it as a duplicate and discard it. This is important for preventing replay attacks where an attacker might try to authenticate as a legitimate user by replaying a captured login packet.

In practice, IT administrators need to choose the right encryption algorithm and key strength for ESP, balancing security with performance. For example, using AES-256 provides stronger security than AES-128 but may be slower on older hardware. ESP also affects network design because it adds overhead to each packet — typically 36 to 56 bytes depending on the algorithms used — which can reduce the maximum transmission unit (MTU) and cause fragmentation if not properly configured.

Understanding ESP helps professionals troubleshoot issues like packet drops or slow connections that often stem from MTU mismatches. Additionally, when setting up site-to-site VPNs between branch offices, ESP configuration must match on both ends, including the same encryption and authentication parameters. A mismatch can cause the VPN to fail entirely.

ESP is also relevant for compliance with regulations like GDPR or HIPAA, which require encryption of data in transit. Without ESP, an organization cannot claim that its VPN traffic is genuinely encrypted. In summary, ESP is the workhorse of IPsec VPNs, and any network engineer who deals with security must have a solid grasp of how it works, how to configure it, and how to fix it when things go wrong.

How It Appears in Exam Questions

ESP appears in CCNA exam questions in several distinct patterns. One common pattern is the 'definition and purpose' style, where you are asked to identify the role of ESP. For example, a question might state: 'Which IPsec protocol provides data encryption and optional authentication for VPN traffic?'

The correct answer is ESP, while distractors might include AH, IKE, or SSL. Another pattern is the 'mode comparison' question. You might see: 'A company wants to connect two branch offices using IPsec VPN.

They need to encrypt the entire original IP packet including the internal IP header. Which ESP mode should be used?' The answer is tunnel mode. Transport mode would only encrypt the payload, leaving the original IP header visible, which is inadequate for hiding internal network topology.

Scenario-based questions are also common. For instance: 'A network administrator configures an IPsec VPN between two sites. After configuration, the VPN tunnel establishes but traffic is not encrypted.

What is the most likely cause?' One possible answer could be that the transform set does not include an encryption algorithm, or that ESP is misconfigured as AH. Another common scenario involves SA mismatches: 'An administrator creates a crypto map and sets the transform set to ESP-AES and ESP-SHA-HMAC.

The peer uses ESP-3DES and ESP-MD5. What will happen?' The answer is that the IPsec tunnel will fail to establish because the transform sets do not match. Troubleshooting questions may ask about packet drops or MTU issues: 'After enabling IPsec with ESP, users report that large file transfers fail.

What is the likely cause?' The answer could be that the ESP header adds overhead, causing packets to exceed the path MTU, leading to fragmentation or drop. You might also get a configuration-related question: 'Which command configures ESP encryption with AES on a Cisco router?'

The correct command is 'crypto ipsec transform-set MYSET esp-aes' followed by 'esp-sha-hmac' for authentication. Another question pattern involves the anti-replay feature: 'A security analyst notices that packets with duplicate sequence numbers are being received. Which IPsec feature prevents this?'

The answer is anti-replay protection, provided by the ESP sequence number. Finally, the exam might ask you to identify the correct packet format. For example: 'Which field in the ESP header is used for anti-replay?'

The answer is the sequence number. These question patterns are manageable if you study the core concepts, but you must be careful not to confuse ESP with AH, or transport mode with tunnel mode.

Practise ESP Questions

Test your understanding with exam-style practice questions.

Practise

Example Scenario

A small company with headquarters in London and a sales office in Berlin needs to connect the two networks securely over the internet. The network engineer decides to use IPsec VPN with ESP in tunnel mode. In the London office, there is a Cisco router with a public IP address of 203.

0.113.10, and the internal subnet is 192.168.1.0/24. In Berlin, the router has a public IP of 203.0.113.20, with an internal subnet of 192.168.2.0/24. The engineer configures an IKE policy to authenticate using pre-shared keys and then sets up a transform set that uses ESP with AES256 encryption and SHA-256 for integrity.

A crypto map is created and applied to the WAN interfaces. When a user in Berlin sends an email to the London server, their PC creates an IP packet with source IP 192.168.2.10 and destination IP 192.

168.1.50. The Berlin router sees that this packet should be encrypted because it matches an access control list tied to the crypto map. It then builds an ESP packet: the original IP packet is encrypted, becoming the payload.

A new IP header is added with the Berlin router's public IP as source and the London router's public IP as destination. The ESP header includes an SPI number to identify the SA, a sequence number for anti-replay, and then the encrypted payload with padding and next header info. At the end, an ICV is appended.

The packet traverses the internet, and an attacker captures it, but they cannot read the contents because the payload is encrypted. They also cannot modify the packet because the ICV will not match. When the London router receives the packet, it uses the SPI to find the correct SA, verifies the ICV, and then decrypts the payload to recover the original IP packet.

It then forwards the decrypted packet to the internal server at 192.168.1.50. This scenario demonstrates how ESP ensures that even though the packet travels over an insecure public network, the data remains confidential, intact, and authenticated.

Common Mistakes

Thinking ESP only provides encryption and not authentication.

ESP provides both confidentiality (encryption) and authentication (via the Integrity Check Value). It is a common mistake to believe that AH is the only protocol that provides authentication.

Remember that ESP includes an ICV that authenticates the payload and the ESP header. Authentication is built into ESP, although it is optional in some implementations.

Confusing ESP transport mode with ESP tunnel mode.

Transport mode encrypts only the payload, while tunnel mode encrypts the entire original IP packet. Using transport mode in a site-to-site VPN would expose internal IP addresses, which is often insecure.

Use tunnel mode for site-to-site VPNs and remote access VPNs where the entire internal packet needs to be hidden. Use transport mode only when encrypting traffic between two hosts on the same network.

Assuming ESP protects the outer IP header.

ESP does not encrypt or authenticate the outer IP header. Only the payload and the ESP header are protected. An attacker can see the source and destination IP addresses of the tunnel endpoints.

For full packet obfuscation, consider using AH in addition to ESP, or use a protocol like GRE over IPsec to hide the inner packet.

Mismatching transform sets on both ends of the IPsec tunnel.

Both peers must agree on the exact encryption algorithm, authentication algorithm, and key sizes. A mismatch can cause the SA negotiation to fail, and the tunnel will not come up.

Always verify that the transform sets on both routers are identical. Use the same encryption and authentication algorithms in the crypto ipsec transform-set command.

Forgetting to include the anti-replay sequence number check.

ESP uses a sequence number to prevent replay attacks. If the packet order is disrupted or if duplicate packets are sent, the receiver may drop legitimate traffic if the anti-replay window is too small or misconfigured.

Enable anti-replay by default and ensure the anti-replay window size matches the expected traffic patterns. You can adjust it with the crypto ipsec security-association replay window-size command.

Exam Trap — Don't Get Fooled

{"trap":"The exam asks which IPsec protocol provides both encryption and authentication, and the answer choices include both ESP and AH. Learners might choose AH because they think authentication is only provided by AH, but they forget that ESP also provides authentication.","why_learners_choose_it":"Many study materials emphasize that AH provides authentication for the entire packet, which leads learners to believe that ESP only encrypts.

They overlook that ESP also includes an Integrity Check Value that authenticates the payload.","how_to_avoid_it":"Remember that ESP provides confidentiality (encryption) and authentication (via ICV). AH provides only authentication and no encryption.

The key distinction is that ESP encrypts, but AH does not. If the question asks for both encryption and authentication, ESP is the correct answer."

Commonly Confused With

ESPvsAuthentication Header (AH)

AH provides integrity and authentication for the entire IP packet, including the outer header, but it does not provide encryption. In contrast, ESP provides encryption and optional authentication for the payload only. AH is often used when confidentiality is not required but data integrity is critical.

A company needs to ensure that routing updates are not tampered with but the content is not sensitive. They might use AH. For encrypting sensitive financial data, they would use ESP.

ESPvsIKE (Internet Key Exchange)

IKE is a protocol used to establish Security Associations (SAs) that define how ESP and AH will operate. It handles key exchange and negotiation of parameters. ESP is the protocol that actually encrypts and authenticates the data. IKE is the setup phase, and ESP is the data protection phase.

IKE is like a couple agreeing on a secret handshake and password before meeting. ESP is the actual secure communication that happens afterward using that handshake.

ESPvsSSL/TLS

SSL/TLS provides encryption at the application layer (Layer 4 and above) and is commonly used for securing web traffic (HTTPS). ESP operates at the network layer (Layer 3) and encrypts IP packets. ESP is used for VPNs that protect all traffic between two networks, while TLS protects individual applications like web browsers.

When you visit a secure website, TLS protects that specific web session. When you connect to a company VPN, ESP protects all your network traffic, including email, file sharing, and web browsing.

Step-by-Step Breakdown

1

SA Establishment via IKE

Before ESP can protect any data, the two VPN peers must agree on a common security policy. This is done through Internet Key Exchange (IKE) which negotiates the encryption algorithms, authentication methods, and keys. The result is a Security Association (SA) stored on both peers.

2

Packet Processing at Sender

When the sender's router receives a packet that matches the VPN access control list, it identifies that this packet needs IPsec protection. The router looks up the SA for the destination and retrieves the encryption and authentication parameters.

3

ESP Encapsulation

The original IP packet becomes the payload. The router appends the ESP header, which includes the Security Parameters Index (SPI) to identify the SA and a sequence number for anti-replay. The payload is then encrypted using the algorithm specified in the SA.

4

Integrity Calculation

After encryption, the router computes an Integrity Check Value (ICV) over the ESP header and the encrypted payload. This ICV is a cryptographic hash that will be verified by the receiver. The ICV is appended at the end of the packet.

5

New IP Header and Transmission

In tunnel mode, a new IP header is added with the source and destination IP addresses of the VPN gateways. The entire ESP packet (new IP header, ESP header, encrypted payload, ICV) is then sent over the internet to the peer.

6

Reception and Verification

The receiver examines the SPI in the ESP header to find the correct SA. It then verifies the ICV to ensure the packet has not been tampered with and that it came from the legitimate sender. If the ICV is valid, the receiver proceeds to decryption.

7

Decryption and Forwarding

The receiver decrypts the payload using the algorithm and key from the SA. The original IP packet is extracted. The decrypted packet is then forwarded to the internal network based on the destination IP address in the inner header.

Practical Mini-Lesson

In real-world IT practice, configuring ESP on a Cisco router involves several key steps that are directly applicable to the CCNA exam. First, you need to define an IKE policy, often called a phase 1 policy. This includes selecting an encryption algorithm (e.

g., aes 256), a hash algorithm (e.g., sha-256), a Diffie-Hellman group, and an authentication method (pre-share is common). Then you set a pre-shared key for the peer. Next, you create an IPsec transform set for phase 2, which specifies the ESP protocols: for example, esp-aes and esp-sha-hmac.

The transform set defines how the data will be encrypted and authenticated. After that, you create a crypto access control list (ACL) that defines which traffic should be encrypted. This ACL is critical — it should mirror the interesting traffic that will trigger the VPN.

For a site-to-site VPN, the ACL typically permits traffic from the local subnet to the remote subnet. Then you build a crypto map that ties together the peer IP, the transform set, the ACL, and the IKE key. Finally, apply the crypto map to the outgoing interface.

One common practical issue is MTU fragmentation. ESP adds overhead, typically 50-60 bytes per packet. If the underlying network has an MTU of 1500 bytes, and you have a full-sized packet plus the ESP overhead, the packet may need to be fragmented.

This can cause performance issues. Many professionals set the TCP MSS (Maximum Segment Size) value on the router or use IP MTU commands to ensure packets do not exceed the path MTU. For example, on a Cisco router, you can apply the command ip tcp adjust-mss 1360 under the interface to tell TCP to use a smaller segment size, thus avoiding fragmentation.

Another real-world consideration is the use of dead peer detection (DPD) to detect when the remote VPN gateway goes offline. Without DPD, the SA might remain active, and traffic will blackhole. Also, log monitoring is important: using show crypto isakmp sa and show crypto ipsec sa to verify the tunnel state and packet counts.

If you see packets being encapsulated and decapsulated, the tunnel is working. If you see drops, check the ICV errors or sequence number errors, which indicate misconfiguration or replay attacks. Professionals also need to understand the importance of time synchronization via NTP, because certificate-based authentication relies on accurate timestamps.

In summary, ESP configuration is a hands-on skill that requires attention to detail, especially matching algorithms and keys, and understanding how overhead affects network performance.

Troubleshooting Clues

Symptom:

Symptom:

Symptom:

Symptom:

Symptom:

Memory Tip

ESP — 'Extra Security Protection': it provides Encryption, Sequence numbers, and Payload authentication.

Covered in These Exams

Current Exam Context

Current exam versions that test this topic — use these objectives when studying.

Related Glossary Terms

Quick Knowledge Check

1.Which IPsec protocol provides encryption, integrity, and authentication?

2.In which ESP mode is the entire original IP packet encapsulated in a new IP header?

3.What field in the ESP header provides anti-replay protection?

Frequently Asked Questions

What is the difference between ESP and AH?

ESP provides encryption and optional authentication for the payload, while AH provides authentication for the entire packet but no encryption. Use ESP when you need confidentiality; use AH when only data integrity is required.

Can ESP be used without encryption?

Yes, ESP can be configured to provide only authentication and integrity without encryption, but this is rare. Usually ESP is used with encryption to ensure confidentiality.

What does ESP stand for?

ESP stands for Encapsulating Security Payload. It is a protocol within the IPsec suite used to secure IP packets.

What is the difference between transport mode and tunnel mode in ESP?

Transport mode encrypts only the payload of the IP packet, leaving the original IP header unchanged. Tunnel mode encrypts the entire original IP packet and adds a new IP header, which is ideal for VPNs between networks.

Does ESP protect the IP header?

No, ESP does not protect the outer IP header. Only the payload and the ESP header are encrypted and authenticated. The outer IP header remains visible for routing.

What is an Integrity Check Value (ICV) in ESP?

The ICV is a cryptographic checksum that is appended to the ESP packet. It allows the receiver to verify that the packet has not been tampered with and that it originated from the correct sender.

What encryption algorithms are commonly used with ESP?

Common algorithms include AES with 128, 192, or 256-bit keys, and 3DES. AES is preferred for its strength and performance.

Summary

ESP, or Encapsulating Security Payload, is a vital component of IPsec that provides the core security functions for VPNs: encryption for confidentiality, integrity checks for tamper detection, and authentication to verify the source of the data. It operates in two modes — transport mode for host-to-host connections and tunnel mode for network-to-network VPNs — with tunnel mode being the standard for site-to-site communications. In the CCNA exam, you will be expected to know that ESP encrypts data, while AH does not, and that ESP uses Security Associations (SAs) established via IKE.

You must also be able to explain the difference between transport and tunnel mode, identify the fields in an ESP packet (such as SPI and sequence number), and troubleshoot common issues like transform set mismatches or fragmentation. Understanding ESP is not just about passing the exam — it is a fundamental skill for any network professional managing secure communications. In practice, configuring ESP on Cisco routers requires careful attention to algorithm selection, ACLs, crypto maps, and MTU handling.

By mastering ESP, you build a strong foundation in network security that will serve you throughout your career. Remember the memory hook 'ESP — Extra Security Protection' to keep its key functions straight.