Mastering IPsec: Protocols and Security
Mastering IPsec: Protocols and Security
Learning Objective
At the end of the lesson you will be able to confidently describe IPsec, its protocols (AH, ESP, IKE), their modes, the role of security associations and policies, and the concept of Perfect Forward Secrecy.
What is IPsec?
IPsec is a suite of protocols that secures communications at the IP layer by providing data confidentiality, integrity, authentication, and key management.
Why IP Needs Security
IP and TCP lack native security. IPsec enhances security by addressing vulnerabilities like packet interception, address spoofing, and data manipulation.
Where is IPsec Used?
IPsec operates between the IP and TCP layers, integrating into the OS. It works with both IPv4 and IPv6 without modifying applications. Common in VPNs and secure network connections.
IPsec in Network Architecture
IPsec can be deployed at firewalls, routers, or directly on end-hosts, protecting data as it crosses risky network segments.
IPsec's Core Services
IPsec guarantees authentication, integrity, access control, confidentiality, and anti-replay protection according to configuration. Not meant for user-level authentication.
Applications of IPsec
Secures VPNs, remote access, inter-branch connections, extranets, and enhances business e-commerce by encrypting and authenticating IP traffic.
Benefits of Using IPsec
Transparent to users and applications, offers strong perimeter security, and can secure communications without training end-users or modifying upper-layer software.
IPsec Services Comparison
Encrypts data for confidentiality, can also authenticate and provide integrity. Can be configured for either or both.
Encapsulating Security Payload (ESP)
Provides access control, integrity, data origin authentication, anti-replay. No confidentiality.
Authentication Header (AH)
Datagram Security with IPsec
IPsec secures entire datagrams by appending protocol-specific headers, enabling encrypted and authenticated delivery across insecure networks.
IPsec Protocols Overview
Three main protocols: Authentication Header (AH), Encapsulating Security Payload (ESP), and Internet Key Exchange (IKE) for key management.
Authentication Header (AH) Modes
Tunnel Mode
Transport Mode
AH inserted after IP header. Provides integrity and authentication for the packet (except mutable fields). End-to-end security.
Authenticates the entire original packet. A new IP header is used, suitable for gateway-to-gateway protection.
Understanding AH Structure
Includes SPI, sequence number, authentication data (MAC). Key elements protect against replay and verify packet source.
Encapsulating Security Payload (ESP) Modes
Encrypts payload (TCP segment), not IP header. Provides end-to-end confidentiality and optional authentication.
Encrypts and optionally authenticates the entire datagram. New IP header used. Enables secure gateway-to-gateway or host-to-gateway tunnels.
Transport Mode
Tunnel Mode
ESP Packet Structure
Contains SPI, opaque transform data, encrypted payload, authentication. Flexible to support various algorithms.
Security Associations (SA) in IPsec
A Security Association defines how data is protected for a specific connection, including protocols, algorithms, keys, and lifetime.
Key Databases: SAD & SPD
Stores SA details (SPI, algorithms, keys, endpoint, mode). Unique for each protected session.
Security Policy Database (SPD)
Defines filtering rules, mapping traffic to relevant SAs, and enforcing organisational security policies.
Security Association Database (SAD)
Role of Security Associations
SAs are negotiated per flow of traffic. Each is uniquely identified by SPI, IP destination, and security protocol identifier (AH or ESP).
Internet Key Exchange (IKE)
IKE protocol automates SA negotiation and key exchange, ensuring keys are established securely before communication begins.
Perfect Forward Secrecy in IKE
PFS ensures that compromise of a single key doesn’t compromise past session keys. Achieved using ephemeral keys and Diffie–Hellman.
Summary
You can now describe IPsec protocols, their modes, security associations, policies, and the role of IKE in providing secure, trustworthy networking.