IPsec (Internet Protocol Security) is a suite of IETF standards (core specification RFC 4301) that adds cryptographic security to IP packets at the network layer, transparently to applications running above it. Where TLS secures a specific connection between two application endpoints, IPsec secures all IP traffic between two hosts or networks — including traffic from applications that have no TLS support, protocols that predate encryption (routing protocols, SNMP, ICMP), and layer-3 metadata that TLS cannot protect. IPsec provides two protocol headers: AH (Authentication Header, IP protocol 51) signs the IP packet including immutable header fields, providing integrity and source authentication without confidentiality — rarely used in modern deployments because NAT rewrites fields that AH covers. ESP (Encapsulating Security Payload, IP protocol 50) encrypts the payload and provides authenticated encryption with AES-GCM or ChaCha20-Poly1305, optionally protecting the inner IP header as well; ESP is the universally deployed choice. Both operate in two modes: transport mode protects only the payload of an existing IP packet (used for host-to-host encryption between endpoints that share routing), and tunnel mode encapsulates the entire original IP packet inside a new one with new source and destination addresses — the basis of VPN gateways where traffic from one network is tunnelled to another through the public internet.
The session management layer is IKEv2 (Internet Key Exchange version 2, RFC 7296), which runs over UDP port 500 (and 4500 for NAT traversal with UDP encapsulation of ESP). IKEv2 negotiates the cipher suite, performs mutual authentication (via X.509 certificates, raw public keys, or pre-shared keys), and establishes Security Associations (SAs): unidirectional agreements that specify the cryptographic parameters — algorithm, key, lifetime, and SPI (Security Parameter Index) — for a single direction of traffic. The two parties maintain a Security Association Database (SAD), which maps incoming SPI values to their decryption parameters, and a Security Policy Database (SPD), which maps traffic selectors (source/destination IP prefixes, port ranges, protocols) to the action to take — encrypt (and which SA to use), bypass (send cleartext), or discard. On Linux, both databases live in the kernel’s XFRM subsystem (inspectable and configurable via ip xfrm state and ip xfrm policy), and IKEv2 is managed by a user-space daemon — strongSwan and libreswan are the two most common — which communicates with the kernel via the NETLINK_XFRM socket. Hardware offload of IPsec crypto is available on NICs that support xfrm offload, enabling line-rate encryption without CPU overhead.
IPsec occupies a distinct position relative to the other security layers in this glossary. It operates below the transport layer, so it protects all traffic including mTLS handshakes and the application layer on top — the two can be layered. MACsec operates one layer below IPsec, at layer 2, and can protect the Ethernet frames that carry IPsec packets; the two are complementary. In Kubernetes, IPsec is the transparency-preserving pod-to-pod encryption choice: Cilium supports an IPsec mode where it installs XFRM policies on every node so that all pod traffic crossing node boundaries is ESP-encrypted without any application or container change, using PSK or certificate-based keys rotated automatically. This makes IPsec-based pod encryption a practical alternative to mTLS service mesh overlay encryption for environments where mTLS sidecar injection is undesirable or where the workload is not able to participate in a SPIFFE identity scheme. The PQC transition affects IPsec at the IKEv2 layer: RFC 9370 specifies ML-KEM for use in IKEv2 key exchange, and RFC 9242 defines the ML-DSA signature algorithms for IKEv2 authentication, with strongSwan and libreswan adding support as the standards finalise.
