Remote-Access VPN / L2TP-IPsec Series

🛡️ Understanding IPsec's AH (Authentication Header) from a "Top 1%" Perspective — How It Differs From ESP, and Why It's Almost Never Used in Practice

Introduction

This article is part of the Top 1% Series’ full article guide, a follow-on in the Remote-Access VPN / L2TP-IPsec Series. It assumes you understand ESP and NAT traversal from Understanding How L2TP/IPsec Works from a “Top 1%” Perspective.

Prerequisites

Getting the Big Picture

In a Nutshell

AH (Authentication Header) is a protocol that adds only “integrity” (proof that a packet hasn’t been tampered with) to an IP packet — unlike ESP, it has no confidentiality (encryption) functionality at all. This design choice of “not encrypting” is the very essence of what AH is, and it directly ties into both the historical background covered below and the reason it’s almost unused today.

graph LR
    subgraph AH["AH (Authentication Header)"]
        AhFeature["Integrity: yes<br/>Confidentiality: no (no encryption)"]
    end
    subgraph ESP["ESP (Encapsulating Security Payload)"]
        EspFeature["Integrity: yes<br/>Confidentiality: yes (encrypted)"]
    end
    AH -.what it can do is a subset of ESP.-> ESP

Fundamentals, Explained Thoroughly

What AH Protects: Even the IP Header Itself

The biggest difference between AH and ESP isn’t just whether encryption is present. AH includes not only the payload (the actual data) but also most of the IP header (including the source and destination IP addresses) within the scope of its integrity verification — this is the structural difference from ESP.

graph TB
    subgraph AHScope["Scope of AH's integrity verification"]
        IpHeaderA["IP header (including source/destination IP, excluding mutable fields)"]
        AhHeader["AH header"]
        PayloadA["Payload"]
        IpHeaderA --- AhHeader --- PayloadA
    end
    subgraph EspScope["Scope of ESP's integrity verification and encryption"]
        IpHeaderE["IP header"]
        EspHeader["ESP header"]
        PayloadE["Payload (encrypted)"]
        IpHeaderE --- EspHeader --- PayloadE
    end

When calculating the authentication data (ICV, Integrity Check Value), AH includes everything in the IP header except mutable fields that can be legitimately rewritten by routers along the path (such as TTL). This gives it a strength ESP doesn’t have: the ability to also guarantee that header information like the IP address itself hasn’t been tampered with in transit. But this very strength is the direct cause of the severe incompatibility with NAT covered later.

AH’s Header Structure

AH is a header inserted right after the IP header, with the following fields:

FieldContent
Next HeaderIndicates the protocol that follows AH (TCP, UDP, or the inner IP header in tunnel mode, and so on)
Payload LengthThe length of the AH header itself
SPI (Security Parameters Index)A value identifying which security association (SA — a set of encryption keys and settings) is in use
Sequence NumberA sequence number for detecting replay attacks (an attack that resends the same packet to force it to be processed illegitimately)
Authentication Data (ICV)A hash value for tamper detection, calculated over the scope of integrity verification described above

The replay attack countermeasure via the Sequence Number works exactly the same way as in ESP — AH and ESP fundamentally differ only in two respects: the scope covered by the authentication data calculation, and whether encryption is present.

The View From the Top 1% Perspective

Why AH Has No Encryption: A Historical Story About Export Restrictions

Behind AH’s deliberate design choice of having no encryption functionality lies a historical circumstance: various countries’ export and import restrictions on cryptographic technology back in the 1990s.

At the time, strong cryptographic technology was treated similarly to military technology, and was subject to export controls as “dual-use (military and civilian) technology” (under regulations such as the US Export Administration Regulations, and the multinational Wassenaar Arrangement). A product with encryption functionality could face restrictions on its import or use in certain destination countries, or require permit applications or strength limitations in the exporting country itself. This regulation is believed to have stemmed from concerns that governments’ ability to monitor communications could be undermined by the widespread adoption of strong cryptography.

Because AH only provides integrity (tamper detection) and has no confidentiality functionality to conceal the content of communications, it was less likely to be caught up by these cryptographic export controls. “Anyone can read the content of the communication, but its integrity in transit is guaranteed” was an easy argument to make that this didn’t undermine government surveillance capability, so AH held a certain value as a means of achieving at least integrity protection, even in countries or organizations where encryption (ESP) couldn’t be used, or was difficult to use.

This regulatory concern matters far less today

Around the year 2000, many countries substantially relaxed their cryptographic export restrictions (partly because commercially available, mass-market cryptographic technology increasingly became exempted from the Wassenaar Arrangement’s controls). So, the circumstance of “not having encryption functionality is advantageous for avoiding regulation” has largely lost its meaning today. This historical background is important for understanding the reason behind AH’s design choice at the time it was born, but it’s worth keeping in mind that it no longer holds up as a reason to choose AH today.

Why AH Is Almost Never Used Today: A Fundamental Incompatibility With NAT

Even now that the historical constraint of cryptographic export restrictions has relaxed, there’s a more direct, decisive reason AH is almost never used in practice: its incompatibility with NAT (Network Address Translation).

As covered in Understanding How NAT/NAPT Works from a “Top 1%” Perspective, NAT functions by rewriting the source (or destination) IP address in the IP header of packets passing through it. But as noted above, AH includes the IP header’s content (including the source and destination IP addresses) itself within the scope of its integrity verification. If a NAT device rewrites the IP header of an AH packet, the hash value the receiving side calculates for integrity verification no longer matches the hash value the sending side calculated and embedded, so the AH packet is judged to have been tampered with, and gets discarded.

sequenceDiagram
    participant Client as Client (private IP)
    participant Nat as NAT device
    participant Server as Server

    Client->>Nat: AH packet (source IP = private IP, ICV already calculated including this IP)
    Nat->>Server: NAT rewrites the source IP in the IP header and forwards it
    Note over Server: Recalculating integrity against the received IP header<br/>no longer matches the original ICV (judged as tampered)
    Server-xClient: The packet gets discarded

While ESP was able to solve this problem via NAT-T (NAT traversal), covered in Understanding How L2TP/IPsec Works from a “Top 1%” Perspective (by encapsulating in UDP and excluding the IP header itself from ESP’s integrity verification scope), the very design of AH — including the IP header itself in its integrity verification — is fundamentally incompatible with this kind of workaround. In today’s networking environment, where NAT is extremely widespread, this constraint is decisive.

Can ESP alone achieve the same integrity that AH used to provide?

You might worry, “without AH, won’t we lose the ability to protect integrity all the way through the IP header?” — but this rarely causes a real problem in practice. ESP can be configured with its encryption algorithm set to “NULL” (no encryption), while keeping only its integrity verification functionality enabled (referred to as ESP-NULL). This lets you address the same demand AH originally satisfied — “I don’t need confidentiality, but I do want integrity” — within ESP’s own framework. Unlike AH, ESP’s integrity verification doesn’t include the entire outer IP header, so it causes no problem in a NAT environment either. In other words, the functional value AH used to provide can be substituted by a configuration of ESP (ESP-NULL), leaving essentially no practical reason to actively choose AH, which retains only the drawback of being NAT-hostile.

Common Misconceptions and Pitfalls

The Troubleshooting Perspective

Since newly choosing AH itself is a rare case today, AH-related troubleshooting is best treated practically as understanding either “a configuration with historical roots that still lingers” or “something that shows up as study material or exam prep.”

  1. AH is used in an existing configuration, and a connection can’t be established in a NAT environment: As noted, AH and NAT are structurally incompatible, so consider migrating to ESP (ESP-NULL if needed) where possible.
  2. A requirement for integrity-only protection has come up: Rather than choosing AH, configuring ESP with the NULL encryption algorithm satisfies the requirement while also remaining compatible with a NAT environment.

Preventive Measures and Permanent Fixes

Summary

What to Keep in Mind From Today

  1. When you encounter the term AH in IPsec, remember two things together: “it provides only integrity, not confidentiality,” and “it’s structurally incompatible with NAT.”
  2. When you run into a requirement for integrity-only protection, consider ESP-NULL rather than AH.

References

Comments

Feel free to leave thoughts, questions, or corrections below (sign in with a GitHub account to comment or react).