CCNA explainer C03: IPsec VPNs, remote access and site-to-site
Exam topic 4.5 asks you to describe IPsec VPNs rather than configure them, so this is an explainer. It covers the protocols IPsec uses, its two modes, and the two kinds of VPN built with it.
What IPsec provides
IPsec protects IP packets travelling across an untrusted network such as the internet. It can provide:
- Confidentiality: the payload is encrypted, for example with AES.
- Integrity: a hash (HMAC with SHA-256 or similar) shows the packet wasn’t changed in transit.
- Authentication: each end proves who it is, with a pre-shared key or certificates.
- Anti-replay: sequence numbers stop an attacker resending captured packets.
The protocols
| Protocol | Job | Port or protocol number |
|---|---|---|
| IKE (IKEv1 or IKEv2) | Authenticates the peers and negotiates the keys and algorithms | UDP 500, or UDP 4500 through NAT |
| ESP (Encapsulating Security Payload) | Encrypts and authenticates the data | IP protocol 50 |
| AH (Authentication Header) | Authenticates the data but doesn’t encrypt it | IP protocol 51 |
ESP is what almost every VPN uses. AH also authenticates parts of the outer IP header, so it breaks when NAT changes that header. IKEv2 is the current version: it needs fewer messages than IKEv1 and handles NAT traversal and remote clients better.
Tunnel mode and transport mode
| Tunnel mode | Transport mode | |
|---|---|---|
| What is protected | The whole original packet, wrapped in a new IP header | Only the payload; the original IP header stays |
| Outer addresses | The two VPN gateways | The two end hosts |
| Typical use | Site-to-site and remote access VPNs | Host-to-host traffic, or inside another tunnel such as GRE |
In tunnel mode, someone watching the internet link sees only traffic between the two gateways. The real source and destination addresses are hidden inside the encrypted packet.
Site-to-site VPNs
A site-to-site VPN joins two networks permanently, for example a branch office to headquarters.
- The routers or firewalls at each site build the tunnel. Users and hosts don’t need any VPN software.
- The tunnel is usually up all the time, or comes up when traffic needs it.
- It typically uses ESP in tunnel mode. GRE over IPsec, or a virtual tunnel interface, lets routing protocols such as OSPF run across it.
In this lab series, the branch router BR1 would build a site-to-site tunnel to the edge router at headquarters.
Remote access VPNs
A remote access VPN connects one user’s device to the company network, for example from home or a hotel.
- The user runs VPN client software, such as Cisco Secure Client (formerly AnyConnect), and signs in.
- The tunnel lasts only as long as the user’s session.
- It is built with IPsec (usually IKEv2) or with TLS/SSL. The head end is often a firewall.
- The VPN gateway gives the client an address from a pool and decides whether all traffic or only company traffic goes through the tunnel (full or split tunnelling).
What to remember for the exam
- IKE negotiates the keys. ESP encrypts and authenticates. AH authenticates only and doesn’t work through NAT.
- Tunnel mode protects the whole packet and adds a new header; transport mode protects only the payload.
- Site-to-site VPNs connect networks through gateways. Remote access VPNs connect individual users through client software.