Guide
VPNs: IPsec, IKE and GRE tunnels (CCNA and CCNP)
This guide covers the VPN, IPsec, IKE, and GRE facts needed for the related CCNA and CCNP questions.
3 parts · video · 29 practice questions
VPN types and IPsec basics
A site-to-site VPN joins two networks through VPN gateways. The gateways protect traffic between the LANs, so computers behind them do not need VPN software. A remote-access VPN connects an individual user's device to a private network on demand, commonly using client software such as Cisco Secure Client. Remote access can use IPsec or TLS-based tunneling.
- ESP protocol number
- 50
- AH protocol number
- 51
- IKE port
- UDP 500
- NAT traversal port
- UDP 4500
IPsec is a network-layer framework that protects IP traffic between peers. Its Security Associations (SAs) are agreements about algorithms, keys, and lifetimes. An IPsec SA is unidirectional, so a two-way protected connection normally uses a pair. IKE first negotiates a protected control SA and then negotiates the IPsec SAs that protect data.
ESP, IP protocol number 50, can provide confidentiality through encryption, integrity, peer authentication, and anti-replay protection. AH, IP protocol number 51, provides integrity, origin authentication, and anti-replay protection, but no confidentiality because it does not encrypt. ESP is therefore used when packet contents must be private. IKE normally starts on UDP port 500; when NAT traversal is needed, IPsec data is encapsulated in UDP on port 4500.
In IPsec tunnel mode, the protected original IP packet, including its header, is wrapped and a new outer IP header addresses the VPN peers. In ESP transport mode, the original IP header remains visible and ESP protects the payload after that header. Transport mode suits traffic whose source and destination are the IPsec peers themselves, such as host-to-host or router management traffic. Cisco IOS XE crypto-map mode support depends on release: IOS XE 17.6 through 17.9 supports tunnel and transport modes, while 17.10 and later supports transport mode only. Other IOS XE products can have different IPsec restrictions.
GRE is an encapsulation method, not encryption. It can carry routed protocols and multicast traffic through an IP network, but plain GRE does not authenticate peers or encrypt packets. Apply IPsec to protect GRE traffic when confidentiality and integrity are required.
IKE negotiation, policy, and tunnel operation
IKE negotiates cryptographic parameters, authenticates peers, and derives keys. Diffie-Hellman (DH) lets peers establish shared secret key material over an untrusted channel; it is key agreement, not an encryption algorithm for user packets. In IKEv1 Phase 1, peers agree on an ISAKMP policy containing encryption, hash, authentication method, DH group, and lifetime, then establish the IKE management SA. Main Mode uses six messages. IKEv1 Quick Mode then negotiates the IPsec data SAs, including transforms and the traffic selectors, commonly called interesting traffic.
- IKEv1 Main Mode
- six messages
- Initial IKEv2 exchange
- four messages
- Periodic DPD example
- 10 seconds, 2 retry-seconds
- NAT traversal
- UDP 4500
On IOS and IOS XE, crypto isakmp policy <priority> enters IKEv1 Phase 1 policy configuration. The priority orders policies for selection. The IPsec transform set is separate: it defines protection for data-plane SAs, not the IKE control SA.
IKEv2 uses exchanges rather than IKEv1's Phase 1 and Phase 2 labels. IKE_SA_INIT negotiates the IKE algorithms and DH exchange. IKE_AUTH follows with encrypted identity and authentication data, mutually authenticates peers, and creates the first Child SA for IPsec data. Each request and response is a message, so this initial exchange can complete in four messages. CREATE_CHILD_SA creates additional Child SAs or rekeys a Child or IKE SA. An IKEv2 proposal defines the algorithms for the IKE SA; on IOS XE it is configured with crypto ikev2 proposal and associated with an IKEv2 policy. IOS XE IKEv2 profiles can configure different local and remote authentication methods, including RSA signature on one side and a pre-shared key on the other. IKEv2 also supports certificate authentication, and its key rings support asymmetric pre-shared keys. The latter means peers can use different local and remote pre-shared key values; it does not mean that a key ring supports asymmetric public-key keys.
Perfect Forward Secrecy (PFS) on a data SA rekey requires a fresh DH exchange rather than deriving the rekey only from earlier key material. On a crypto map, set pfs group14 is an example configuration; both peers must agree on the PFS setting and group. This limits the effect of a later key compromise on other session keys.
For a crypto-map, policy-based VPN, the extended ACL referenced by match address identifies interesting traffic. Its permitted source and destination flows trigger that entry's IPsec protection; nonmatching traffic is not protected by that entry. A route-based VPN presents a logical tunnel interface, such as GRE or a supported VTI, that routing can use like a link. Routing protocols can form adjacencies over that interface. A crypto-map policy does not provide such a routed tunnel interface.
Dead Peer Detection (DPD) uses IKE keepalive probes to discover an unreachable peer. In IOS XE Easy VPN, a DPD R-U-THERE message is a peer-liveness probe; a response indicates that the peer is reachable. IOS can configure DPD with crypto isakmp keepalive <seconds> <retry-seconds> periodic for periodic probes; without periodic, the documented behavior is on-demand. After the peer is declared dead, IOS can clear its IKE and IPsec SAs so traffic is not left directed into a dead tunnel and another configured path can take over. Permit IKE UDP 500 and IPsec ESP or AH, IP protocols 50 and 51, through relevant filters. NAT traversal uses UDP 4500.
crypto isakmp policy 10
crypto ikev2 proposal <name>
crypto isakmp keepalive 10 2 periodic
crypto map <name> <sequence> ipsec-isakmp
match address <extended-acl-number>
set pfs group14GRE and GRE over IPsec tunnels
A basic GRE header is 4 bytes. With the 20-byte outer IPv4 header, a standard cleartext IPv4 GRE tunnel adds 24 bytes before any other encapsulation. On a 1500-byte path, the corresponding GRE tunnel IP MTU is 1476 bytes. IPsec adds further, variable overhead according to its mode, transforms, and any NAT traversal, so the usable packet size is smaller still.
- Basic GRE header
- 4 bytes
- Standard cleartext GRE overhead
- 24 bytes
- GRE tunnel IP MTU on 1500-byte path
- 1476 bytes
- Common GRE over IPsec starting MTU
- 1400 bytes
A tunnel MTU of 1400 bytes is a common conservative starting point for GRE over IPsec on a 1500-byte WAN path, not a universal correct value. Calculate or test the actual end-to-end path MTU and account for the selected IPsec encapsulation. If TCP sessions need it, adjust the TCP MSS so TCP segments fit the tunnel without fragmentation. Check both MTU and path MTU discovery when large packets fail while small pings work.
Multipoint GRE (mGRE) lets one logical tunnel interface support multiple tunnel destinations. A hub can use mGRE with Next Hop Resolution Protocol (NHRP) to learn the mapping between a tunnel address and a spoke's transport address, enabling dynamic spoke paths in a DMVPN design. GRE or mGRE provides encapsulation and routing flexibility, while IPsec supplies encryption and authentication.
GRE keepalives are for point-to-point GRE tunnel interfaces, not mGRE. The keepalive <interval> <retries> interface command sends probes through the tunnel and waits for replies. Each request contains an inner GRE/IP packet addressed back to the sender; the remote endpoint decapsulates the outer packet and returns that inner packet toward the sender. If the configured retries are exceeded, IOS takes the tunnel line protocol down; an up/down tunnel stops forwarding data, and routes through it can be withdrawn by routing protocols. When diagnosing a tunnel, check the source and destination reachability, tunnel line protocol, keepalive counters, IPsec SA state, routes, and MTU.
interface Tunnel0
ip mtu 1400
keepalive 10 3
tunnel mode gre multipoint
show interfaces Tunnel0
show crypto isakmp sa
show crypto ipsec saCheck your understanding
VPNs: IPsec, IKE and GRE tunnels (CCNA and CCNP)
All 3 sections · no timer
Unlimited retries
Questions from every section are combined into one assessment. Answer them all correctly to complete the article.
Your completion saves in this browser. Sign in to sync it to your account.