Why Site-to-Site Connectivity Needs Encryption
Connecting two office sites across the public internet, rather than a dedicated private circuit like the MPLS connectivity discussed earlier in this series, means traffic travels across infrastructure controlled by third parties and potentially observable by anyone along that path. IPsec (IP Security) provides a standard framework for encrypting and authenticating this traffic, making a public internet connection safe to carry sensitive site-to-site communication.
The Two-Phase IKE Negotiation Process
Before any actual data can be encrypted and sent, two VPN endpoints must first securely negotiate the cryptographic parameters they will use -- this negotiation is handled by IKE (Internet Key Exchange), occurring in two distinct phases.
IKE Phase 1: establishes a secure, authenticated
management channel between the two VPN peers
themselves -- this channel is used only to
protect the negotiation process itself, not
yet the actual data traffic
IKE Phase 2: uses the secure channel established
in Phase 1 to negotiate the actual parameters
that will protect real data traffic --
establishing what is called an IPsec Security
Association (SA) for the actual trafficConfiguring IKE Phase 1
Router(config)# crypto isakmp policy 10
Router(config-isakmp)# encryption aes 256
Router(config-isakmp)# hash sha256
Router(config-isakmp)# authentication pre-share
Router(config-isakmp)# group 14
Router(config-isakmp)# lifetime 86400
Router(config)# crypto isakmp key MySharedSecret address 203.0.113.2
-- ISAKMP (Internet Security Association and
-- Key Management Protocol) is the framework IKE
-- operates within -- Phase 1 policy parameters
-- must match exactly on both VPN peers, similar
-- in principle to the neighbor requirement
-- matching discussed earlier in this series
-- regarding OSPF and EIGRP neighbor formationThe group 14 setting specifies the Diffie-Hellman group used for the initial key exchange -- a higher group number generally provides stronger security at the cost of additional computational overhead during the negotiation itself, though this cost is paid only once per tunnel establishment, not per packet.
Configuring IKE Phase 2 (IPsec Transform Set)
Router(config)# crypto ipsec transform-set MY-TRANSFORM esp-aes 256 esp-sha256-hmac
Router(config)# crypto map VPN-MAP 10 ipsec-isakmp
Router(config-crypto-map)# set peer 203.0.113.2
Router(config-crypto-map)# set transform-set MY-TRANSFORM
Router(config-crypto-map)# match address VPN-TRAFFIC
Router(config)# interface gigabitethernet 0/0
Router(config-if)# crypto map VPN-MAPThe match address VPN-TRAFFIC line references an access list, discussed earlier in this series, that defines exactly which traffic should be sent through the encrypted tunnel -- traffic matching this ACL gets encrypted and sent through the VPN, while traffic not matching it is forwarded normally in the clear, based on the standard routing table.
AH Versus ESP: The Two IPsec Protocols
AH (Authentication Header):
Provides authentication and integrity checking
(confirming data has not been tampered with
and genuinely came from the claimed sender)
Does NOT provide encryption -- data remains
readable to anyone intercepting it
Rarely used alone in modern deployments
ESP (Encapsulating Security Payload):
Provides both authentication/integrity AND
encryption (confirming both that data is
unmodified and keeping its contents
confidential from interception)
The dominant protocol used in virtually all
modern IPsec VPN deployments, since
confidentiality is almost always requiredSince ESP alone already provides both the integrity checking and confidentiality most deployments actually need, AH is rarely configured independently in practice -- the transform-set configuration shown above uses esp-aes and esp-sha256-hmac, both explicitly ESP-based, reflecting this near-universal preference.
Tunnel Mode Versus Transport Mode
Tunnel Mode: the ENTIRE original IP packet
(including its original header) is encrypted
and encapsulated within a new IP packet --
used for site-to-site VPNs, where an entire
private network's traffic needs to be
protected as it crosses the public internet
Transport Mode: only the payload of the original
packet is encrypted, while the original IP
header remains visible -- used for host-to-host
communication where both endpoints already
have public, routable addresses and only the
data itself needs protectionSite-to-site VPNs, the most common enterprise IPsec use case, virtually always use tunnel mode, since private internal addresses, discussed earlier in this series regarding IPv4 addressing, need to be completely hidden and protected as traffic crosses the public internet between sites.
Verifying IKE Phase 1 and Phase 2 Status
Router# show crypto isakmp sa
dst src state conn-id
203.0.113.2 203.0.113.1 QM_IDLE 1001
-- "QM_IDLE" confirms Phase 1 completed
-- successfully and the management channel
-- is stable and idle, ready to support
-- Phase 2 negotiations as needed
Router# show crypto ipsec sa
local ident (addr/mask/prot/port): (192.168.1.0/255.255.255.0/0/0)
remote ident (addr/mask/prot/port): (192.168.2.0/255.255.255.0/0/0)
#pkts encaps: 1204, #pkts encrypt: 1204
#pkts decaps: 1198, #pkts decrypt: 1198The packet counters in show crypto ipsec sa confirm traffic is actually flowing through the tunnel in both directions -- a common troubleshooting pattern is a Phase 1 SA in the correct idle state but zero packet counts in Phase 2, indicating traffic matching the configured interesting traffic ACL has simply never actually been sent, rather than a cryptographic negotiation failure.
Diagnosing a Common Failure: Phase 1 Never Establishing
Common causes when Phase 1 fails to establish:
- Mismatched ISAKMP policy parameters between
peers (encryption, hash, DH group, or
authentication method must all match exactly)
- Mismatched pre-shared key
- A firewall or NAT device blocking UDP port 500
(used by IKE) somewhere along the path between
the two peersWhy IPsec VPNs Remain a Foundational Enterprise Technology
Even as SD-WAN, discussed earlier in this series, increasingly automates and abstracts away much of this manual configuration complexity, IPsec's underlying cryptographic framework remains the actual security mechanism operating beneath most modern site-to-site connectivity solutions, including SD-WAN implementations themselves. Understanding the two-phase IKE negotiation process, the distinction between AH and ESP, and how to read Phase 1 and Phase 2 security association status is essential foundational knowledge for troubleshooting any VPN technology built on top of this widely deployed standard.