Security Fundamentals · Topic 5 of 10

IPsec Remote Access and Site-to-Site VPNs

Understand what a VPN does, how site-to-site and remote access VPNs differ, and how IPsec uses IKE, ESP and AH to protect traffic over untrusted networks.

  • 6 min
  • Exam objective 5.5
  • Includes a diagram
In a nutshell
  • A VPN protects traffic over an untrusted network, usually the internet.
  • IPsec offers confidentiality, integrity, authentication and anti-replay.
  • Site-to-site VPNs join two networks through gateways, and users run no software.

What it is

A virtual private network (VPN) protects traffic across a network you do not trust, and IPsec is the standard framework that does it.

Traffic is wrapped and encrypted, so it travels as though it were on a private line. Anyone who captures it on the way sees only scrambled data.

IPsec is a framework of open standards for protecting IP traffic. It provides four things:

  • Confidentiality: the data is encrypted so it cannot be read.
  • Integrity: the receiver can tell if the data was changed in transit.
  • Authentication: each side proves who it is.
  • Anti-replay: copies of old packets that an attacker replays are rejected.

How it works

Two peers agree on keys with IKE, then protect the data with ESP or AH in tunnel or transport mode.

Two types of VPN

Two sites with routers joined by an IPsec tunnel across the internet; the hosts behind them run no VPN software. A laptop with a VPN client reaches a server at headquarters through its own IPsec tunnel to the firewall. Both types build an encrypted tunnel, but they serve different users.

Site A LANGateway AVPN peerIPsec tunnel over internetGateway BVPN peerSite B LANRemote userVPN clientremote access VPNInternetGateway BVPN peer

Site-to-site VPN. Two gateways, such as routers or firewalls, build a tunnel between two networks. The users and servers behind each gateway do not run any VPN software.

Their traffic is encrypted by the gateway as it leaves and decrypted by the other gateway on arrival. The tunnel is usually permanent. It is the way to join a branch office to a head office without leasing a private line.

Remote access VPN. A single user connects to the network from outside, such as from home or a hotel. The user's computer runs a VPN client, and the tunnel is built between that computer and a gateway at the organisation.

It is created when needed and ended when finished. Remote access VPNs can use IPsec, or they can use SSL/TLS, which runs through a web browser or a client app and passes through most firewalls easily.

Exam tip

If the question says users run no VPN software, it is site to site. If one person connects with a client, it is remote access.

IPsec building blocks

IPsec has several components. They are easier to follow as a short story.

1. IKE sets up the keys. The Internet Key Exchange (IKE) protocol lets the two peers agree on how to protect traffic, and exchange keys safely.

It runs over UDP port 500 and happens in two stages:

  • Phase 1 builds a secure management channel between the peers. They authenticate each other, using a pre-shared key or digital certificates, and use a Diffie-Hellman exchange to create a shared secret without ever sending it.
  • Phase 2 builds the IPsec security associations, which are the agreed rules and keys for the actual data traffic.

This describes IKE version 1. IKE version 2 reaches the same result with different message exchanges.

Peer AIKE phase 1 secure channelPeer BPeer AIKE phase 2 security associationsPeer BPeer AESP protected dataPeer B

2. ESP and AH protect the data. These are the two IPsec protocols:

  • ESP (Encapsulating Security Payload) is IP protocol number 50. It provides encryption, integrity and authentication.
  • AH (Authentication Header) is IP protocol number 51. It provides integrity and authentication, but no encryption.

ESP is the one used in nearly all VPNs, since it encrypts. AH authenticates the packet but does not hide the contents, so it is rarely used alone.

3. Two modes decide how the packet is wrapped.

  • Tunnel mode encrypts the whole original IP packet and adds a new IP header. This is the normal mode for site-to-site VPNs, since the original private addresses stay hidden.
  • Transport mode protects only the payload and keeps the original IP header. It is used between two hosts.

4. Algorithms do the work. Encryption uses a cipher, such as AES. Integrity uses a hash, such as SHA.

Both ends must be set to compatible choices. A stronger Diffie-Hellman group gives a stronger key exchange.

NAT and IPsec

When a peer sits behind NAT, IPsec has a problem, because NAT changes addresses and ports. NAT traversal solves this by wrapping IPsec packets in UDP, using UDP port 4500.

Configuration

A full IPsec configuration on Cisco devices has many parts and is beyond the scope of this objective, which asks you only to describe the technology. Know what each element does and where it fits.

What to remember for the exam

Eight facts cover the VPN types and the IPsec parts.

  • A VPN protects traffic over an untrusted network, usually the internet.
  • IPsec offers confidentiality, integrity, authentication and anti-replay.
  • Site-to-site VPNs join two networks through gateways, and users run no software.
  • Remote access VPNs connect one user, with a VPN client, to the network.
  • IKE negotiates keys. Phase 1 builds the secure channel, and phase 2 builds the IPsec security associations.
  • ESP (protocol 50) encrypts. AH (protocol 51) does not.
  • Tunnel mode protects the whole original packet. Transport mode protects only the payload.
  • Diffie-Hellman creates a shared secret without sending it.
Watch out

AH authenticates but never encrypts. If a question needs confidentiality, the answer is ESP.

Common mistakes

Five errors are common here.

Saying AH encrypts. AH authenticates but does not encrypt. ESP encrypts.

Mixing up the two VPN types. Site-to-site joins networks. Remote access joins a person.

Thinking a VPN makes a device safe. A VPN protects data in transit. It does nothing if the device itself is infected.

Forgetting NAT. IPsec through NAT needs NAT traversal.

Treating the tunnel as a firewall. Traffic that arrives through a tunnel still needs to be filtered and checked.

Check yourself

Try these three prompts.

  • Who runs the VPN software in a site-to-site VPN compared with a remote access VPN?

    In a site-to-site VPN the users run no VPN software because the two gateways build the tunnel, while in a remote access VPN the user's computer runs a VPN client.

  • What do IKE phase 1 and phase 2 each create?

    Phase 1 builds a secure management channel between the peers, and phase 2 builds the IPsec security associations for the data traffic.

  • What is the difference between ESP and AH, and between tunnel mode and transport mode?

    ESP (protocol 50) encrypts, while AH (protocol 51) authenticates but does not encrypt. Tunnel mode protects the whole original IP packet and adds a new IP header, while transport mode protects only the payload and keeps the original IP header.

Topic 5 of 10 in Security Fundamentals

Test yourself on Security Fundamentals

The full Cisco CCNA 200-301 question bank has 1,206 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.