VPNs and Tunneling

VPNs extend a private network across an untrusted public medium by wrapping traffic in an encrypted tunnel — understanding the two deployment models, the tunneling protocols, and the trade-offs between them is essential for the Security+ exam and for real-world network design.

An organization's employees are never all in one place. Remote workers, branch offices, and traveling staff all need access to internal resources that should never be exposed to the public internet without protection. A VPN (Virtual Private Network) solves this by creating an encrypted channel — a tunnel — over the public internet, so data in transit remains confidential and unmodified even as it crosses infrastructure the organization does not control.


The Core Problem: Data in Transit Over Untrusted Networks

When data travels from a remote worker's laptop to the corporate data center, it crosses ISP infrastructure, public routers, and potentially hostile network segments. Without a VPN, this traffic is potentially visible to anyone on the path.

text
  WITHOUT VPN
  ┌───────────┐   plaintext    ┌──────────────────┐   plaintext    ┌──────────┐
  │  Remote   │───────────────▶│  Public Internet │───────────────▶│Corporate │
  │  Worker   │                │  (untrusted)     │                │ Network  │
  └───────────┘                └──────────────────┘                └──────────┘
                                  Anyone on path
                                  can read traffic

  WITH VPN
  ┌───────────┐   encrypted    ┌──────────────────┐   encrypted    ┌──────────┐
  │  Remote   │═══════════════▶│  Public Internet │═══════════════▶│Corporate │
  │  Worker   │                │  (untrusted)     │                │ Network  │
  └───────────┘                └──────────────────┘                └──────────┘
                                  Observers see
                                  only ciphertext

The VPN creates a tunnel — an encrypted encapsulation of the original packets — that renders the payload unreadable to anyone who intercepts it.


The Two VPN Deployment Models

Remote Access VPN

A remote access VPN connects an individual device (a laptop, phone, or workstation) to a central network. The user authenticates to the VPN gateway using credentials — username and password, certificate, multifactor authentication, or a combination. Once authenticated, the device receives a virtual IP address on the internal network and behaves as if it were physically on-site.

text
  REMOTE ACCESS VPN
  ┌──────────────┐                              ┌──────────────────┐
  │  Remote      │                              │  VPN Gateway /   │
  │  Worker's    │──── encrypted tunnel ───────▶│  Concentrator    │
  │  Device      │  (user authenticates)        │                  │
  └──────────────┘                              └────────┬─────────┘
                                                         │
                                                ┌────────▼─────────┐
                                                │  Corporate        │
                                                │  Internal Network │
                                                └──────────────────┘

Key characteristic: the user is responsible for establishing the tunnel. They launch a VPN client, authenticate, and the tunnel is created on demand.

Use cases: remote workers, traveling employees, contractors accessing internal systems.

Site-to-Site VPN

A site-to-site VPN permanently connects two networks — typically two office locations. The VPN tunnel is established between the gateway devices at each end (routers or firewalls), not between individual user devices. Users at either location communicate across the tunnel transparently; they do not install a VPN client or authenticate separately.

text
  SITE-TO-SITE VPN
  ┌────────────────────────┐                    ┌────────────────────────┐
  │  Office A              │                    │  Office B              │
  │                        │                    │                        │
  │  Users → Switch → Rtr  │═══ encrypted ══════│  Rtr → Switch → Users  │
  │                   (GW) │       tunnel        │  (GW)                  │
  └────────────────────────┘                    └────────────────────────┘

  Tunnel maintained by the gateways — users are unaware of it.
  Authentication uses pre-shared keys or certificates at the gateway level.

Key characteristic: the tunnel is always on; users never authenticate to it. Authentication happens between the gateway devices using pre-shared keys (PSK) or digital certificates, configured by administrators.

Use cases: connecting branch offices to HQ, linking data centers, joining cloud environments to on-premises infrastructure.

Comparison

text
  ┌──────────────────┬───────────────────────────┬────────────────────────┐
  │                  │  Remote Access            │  Site-to-Site          │
  ├──────────────────┼───────────────────────────┼────────────────────────┤
  │  Who sets it up  │  User (per session)        │  Admin (permanent)     │
  │  Authentication  │  User credentials / MFA    │  PSK or certificates   │
  │  Tunnel lifetime │  On-demand                 │  Always on             │
  │  Client software │  Required on user device   │  Not needed for users  │
  │  Typical use     │  Remote workers            │  Branch offices        │
  └──────────────────┴───────────────────────────┴────────────────────────┘


Tunneling

Tunneling is the mechanism that makes VPNs work. The original network packet is wrapped inside another packet — encapsulated — before being sent across the untrusted network. The outer packet carries it to the destination VPN endpoint, which unwraps it and delivers the original packet to its intended recipient.

text
  TUNNELING: ENCAPSULATION MODEL
  ┌──────────────────────────────────────────────────────────┐
  │  OUTER PACKET (travels the public internet)              │
  │  ┌─────────────────────────────────────────────────────┐ │
  │  │  ENCRYPTED PAYLOAD                                  │ │
  │  │  ┌────────────────────────────────────────────────┐ │ │
  │  │  │  ORIGINAL INNER PACKET (private IP addresses,  │ │ │
  │  │  │  original headers, application data)           │ │ │
  │  │  └────────────────────────────────────────────────┘ │ │
  │  └─────────────────────────────────────────────────────┘ │
  └──────────────────────────────────────────────────────────┘

The public internet sees only the outer packet's headers — the source and destination VPN endpoints. Everything inside is opaque.


IPSec: Internet Protocol Security

IPSec is a suite of protocols that operates at Layer 3 (Network layer), making it transparent to applications. It can encrypt and authenticate all IP traffic between two endpoints.

IPSec is the most common protocol used for site-to-site VPNs and is also used by many remote access VPN clients.

IPSec Components

IPSec has two sub-protocols that can be used independently or together:

Authentication Header (AH)

AH provides integrity and authentication — it proves the data was not modified in transit and confirms the sender's identity. It does not provide confidentiality: the payload is still visible to any observer.

text
  WITH AH ONLY:
  ┌────────────────────────────────────────────────────────┐
  │  IP Header │  AH Header   │  PLAINTEXT PAYLOAD         │
  │            │  (integrity  │  (visible to anyone,       │
  │            │   checksum)  │   cannot be altered)       │
  └────────────────────────────────────────────────────────┘

  Anyone can read the payload — but any modification is detected.

Think of AH like wrapping a postcard in clear tape: the message is still readable, but any tampering is detectable.

Encapsulating Security Payload (ESP)

ESP provides confidentiality, integrity, and authentication. The payload is encrypted — no observer can read the contents. ESP also includes an integrity check, so tampering is detected.

text
  WITH ESP:
  ┌──────────────────────────────────────────────────────────┐
  │  IP Header │  ESP Header │  ENCRYPTED PAYLOAD  │ ESP Auth │
  │            │             │  (unreadable to any │ (integrity│
  │            │             │   observer)         │  check)  │
  └──────────────────────────────────────────────────────────┘

  Observer can see endpoints communicate — cannot read or alter payload.

ESP is the standard choice in practice. AH alone is rarely used since it provides no confidentiality.

text
  ┌─────────────┬─────────────────┬──────────────────┐
  │             │  AH             │  ESP             │
  ├─────────────┼─────────────────┼──────────────────┤
  │ Confidential│ No              │ Yes              │
  │ Integrity   │ Yes             │ Yes              │
  │ Auth        │ Yes             │ Yes              │
  │ Common?     │ Rarely          │ Standard choice  │
  └─────────────┴─────────────────┴──────────────────┘

IPSec Modes: Transport vs Tunnel

IPSec operates in one of two modes, which determine how much of the original packet is protected:

Transport Mode — encrypts only the payload of the original packet. The original IP header remains in plaintext. Used for host-to-host communication (e.g., two servers communicating directly).

Tunnel Mode — encrypts the entire original packet (including its IP header) and wraps it in a new outer IP header. Used for gateway-to-gateway VPNs (site-to-site). This is the mode used in most VPN deployments.

text
  TRANSPORT MODE (host-to-host)
  ┌─────────────────┬────────────────────────────────┐
  │  Original IP Hdr│  Encrypted Payload              │
  │  (plaintext)    │  (protected by AH or ESP)       │
  └─────────────────┴────────────────────────────────┘

  TUNNEL MODE (gateway-to-gateway)
  ┌─────────────────┬─────────────────────────────────────────┐
  │  New Outer IP   │  Encrypted Original Packet              │
  │  Header         │  ┌─────────────────┬─────────────────┐  │
  │  (plaintext,    │  │  Original IP Hdr│  Payload        │  │
  │   VPN endpoints)│  │  (encrypted)    │  (encrypted)    │  │
  └─────────────────┴─────────────────────────────────────────┘

IKE: Internet Key Exchange

Before IPSec can encrypt traffic, the two endpoints must agree on encryption algorithms and exchange keys. This negotiation is handled by IKE (Internet Key Exchange), which runs on UDP port 500 (and UDP port 4500 for NAT traversal).

IKE operates in two phases:

Phase 1 — establishes a secure, authenticated channel between the two endpoints (the IKE SA). The two sides authenticate each other (via PSK or certificates) and negotiate the encryption and integrity algorithms.

Phase 2 — uses the secure channel from Phase 1 to negotiate the actual IPSec parameters (the IPSec SA) — which algorithms to use for AH/ESP, key material, and lifetime.

text
  IKE NEGOTIATION
  ┌──────────────┐                              ┌──────────────┐
  │  Endpoint A  │                              │  Endpoint B  │
  │              │──── Phase 1: IKE SA ────────▶│              │
  │              │  (secure channel established) │              │
  │              │──── Phase 2: IPSec SA ───────▶│              │
  │              │  (traffic encryption params)  │              │
  │              │                              │              │
  │              │════ Encrypted IPSec tunnel ══│              │
  └──────────────┘                              └──────────────┘

IKEv2 is the current version — more efficient and more resilient to interruptions than IKEv1.


TLS: Transport Layer Security

TLS (Transport Layer Security) is a cryptographic protocol that secures communications at the application layer. It is the successor to SSL (Secure Sockets Layer), which was found to be cryptographically broken and is no longer used.

text
  SSL → TLS evolution
  ┌────────────────────────────────────────────────────────┐
  │  SSLv2 (1995) → SSLv3 (1996) → TLS 1.0 → TLS 1.1     │
  │  → TLS 1.2 (still in wide use) → TLS 1.3 (current)    │
  │                                                        │
  │  SSLv2, SSLv3, TLS 1.0, TLS 1.1: all deprecated       │
  │  TLS 1.2 and TLS 1.3: acceptable                       │
  └────────────────────────────────────────────────────────┘

Although people often say "SSL" colloquially (as in "SSL certificate"), the protocol in use is always TLS. On the Security+ exam, know that SSL is broken and should not be used. When you see "SSL VPN," it means a VPN that operates over TLS — not the old SSL protocol.

TLS VPN (SSL VPN)

A TLS VPN (commonly marketed as an SSL VPN) uses TLS to establish the VPN tunnel rather than IPSec. TLS runs over TCP port 443 — the same port used for HTTPS web traffic. This means TLS VPN traffic can cross almost any firewall or proxy without being blocked, since port 443 is almost universally permitted.

TLS VPNs come in two forms:

Full tunnel — a VPN client is installed, all traffic from the device is routed through the tunnel. Functionally similar to an IPSec VPN from the user's perspective.

Clientless (web-based) — the user accesses corporate resources through a standard web browser with no installed software. The VPN portal provides access to specific applications (web apps, email, file shares exposed as web pages). This is especially useful for contractors, personal devices, or kiosks where installing client software is not practical.

text
  CLIENTLESS TLS VPN
  ┌────────────────┐   HTTPS (port 443)  ┌──────────────────────┐
  │  Browser only  │────────────────────▶│  VPN Portal / Proxy  │
  │  No client     │                     │                      │
  │  software      │◀─── web interface ──│  Proxies access to   │
  └────────────────┘                     │  internal apps       │
                                         └──────────────────────┘


VPN Protocols Compared

Several distinct protocols implement VPN tunneling. The Security+ exam expects familiarity with the major ones:

text
  ┌────────────────┬────────────┬────────────────────────────────────────┐
  │  Protocol      │  Port(s)   │  Notes                                 │
  ├────────────────┼────────────┼────────────────────────────────────────┤
  │  IPSec / IKEv2 │  UDP 500   │  Standard for site-to-site; strong     │
  │                │  UDP 4500  │  security; used in many client VPNs    │
  │  TLS VPN       │  TCP 443   │  Traverses firewalls easily; clientless│
  │  (SSL VPN)     │            │  option available                      │
  │  L2TP/IPSec    │  UDP 1701  │  L2TP tunnels inside IPSec; common on  │
  │                │  UDP 500   │  older Windows/mobile clients          │
  │  OpenVPN       │  UDP 1194  │  Open-source; uses TLS; highly         │
  │                │  (custom)  │  configurable                          │
  │  WireGuard     │  UDP 51820 │  Modern, minimal codebase; very fast   │
  │  PPTP          │  TCP 1723  │  Obsolete — BROKEN; never use          │
  └────────────────┴────────────┴────────────────────────────────────────┘

PPTP (Point-to-Point Tunneling Protocol) deserves special mention as something to avoid. Developed in the 1990s, it has multiple known cryptographic vulnerabilities and must never be used in any security-conscious environment.

L2TP (Layer 2 Tunneling Protocol) provides no encryption on its own. It is always paired with IPSec to provide security — hence "L2TP/IPSec." L2TP defines the tunnel structure; IPSec provides the encryption and authentication.


Split Tunneling vs Full Tunneling

Once a VPN tunnel is established, a policy decision must be made: does all traffic from the remote device go through the tunnel, or only traffic destined for the corporate network?

Full Tunnel

All traffic — corporate and personal — is routed through the VPN. The remote device's internet traffic goes to the corporate network first, then out to the internet.

text
  FULL TUNNEL
  ┌────────────────┐  ALL traffic  ┌───────────────┐  Corporate traffic
  │  Remote Device │──────────────▶│  VPN Gateway  │──────────────────▶ Internal
  └────────────────┘               └───────┬───────┘
                                           │ Internet traffic
                                           ▼
                                      Corporate internet egress

Advantages: all traffic is inspected by corporate security controls; consistent policy enforcement.

Disadvantages: increases load on VPN infrastructure; potentially slower for the user.

Split Tunneling

Only traffic destined for the corporate network goes through the VPN. Internet-bound traffic goes directly to the internet from the user's device, bypassing the tunnel.

text
  SPLIT TUNNELING
  ┌────────────────┐  Corporate traffic  ┌───────────────┐
  │  Remote Device │────────────────────▶│  VPN Gateway  │──▶ Internal
  │                │
  │                │  Internet traffic   ┌───────────────┐
  │                │────────────────────▶│  Internet     │
  └────────────────┘                     └───────────────┘

Advantages: lower VPN infrastructure load; better performance for the user; frees corporate bandwidth.

Disadvantages: internet traffic bypasses corporate security controls; a compromised device can act as a bridge between the internet and the corporate network.

From a security standpoint, full tunneling is safer. Many compliance frameworks require it. Split tunneling is a convenience trade-off.


Always-On VPN

An always-on VPN automatically establishes and maintains the VPN connection whenever the device has network access — without any user interaction. The user never needs to launch a VPN client or enter credentials (the device authenticates using a machine certificate).

This ensures that corporate devices are always protected by the VPN policy, prevents users from accidentally using an unprotected connection, and enables device management from the corporate network even when the user is remote.

Microsoft's DirectAccess and its successor Always On VPN are examples of this model.


VPN Concentrator

A VPN concentrator is dedicated hardware (or a virtual appliance) whose primary function is to terminate a large number of VPN connections. Rather than terminating VPN tunnels on a general-purpose firewall or router (which adds processing overhead), the concentrator handles cryptographic operations for hundreds or thousands of simultaneous remote access connections efficiently.

text
  ┌──────────┐  ┌──────────┐  ┌──────────┐
  │ Remote 1 │  │ Remote 2 │  │ Remote N │
  └────┬─────┘  └────┬─────┘  └────┬─────┘
       │              │              │
       └──────────────┼──────────────┘
                      │ (many tunnels)
               ┌──────▼──────┐
               │    VPN      │
               │ Concentrator│
               └──────┬──────┘
                      │
               ┌──────▼──────┐
               │  Internal   │
               │  Network    │
               └─────────────┘


GRE Tunneling

GRE (Generic Routing Encapsulation) is a tunneling protocol that encapsulates packets of one protocol inside packets of another. GRE itself provides no encryption — it is a pure encapsulation mechanism. When encryption is needed, GRE is run inside an IPSec tunnel:

text
  GRE over IPSec
  ┌──────────────────────────────────────────────────┐
  │  IPSec (encryption + integrity)                  │
  │  ┌────────────────────────────────────────────┐  │
  │  │  GRE Header   │  Original Packet           │  │
  │  └────────────────────────────────────────────┘  │
  └──────────────────────────────────────────────────┘

GRE supports multicast and routing protocol traffic that native IPSec does not carry. This makes GRE over IPSec useful for site-to-site VPNs that need to run dynamic routing protocols (like OSPF or BGP) between sites.


Key Ports Reference

text
  ┌──────────────────────────────────────────────────────────┐
  │  VPN AND TUNNELING PORTS                                 │
  ├─────────────────────────┬────────────────────────────────┤
  │  IKE (IPSec key exchange)│  UDP 500                      │
  │  IPSec NAT traversal    │  UDP 4500                      │
  │  TLS VPN (SSL VPN)      │  TCP 443                       │
  │  OpenVPN (default)      │  UDP 1194                      │
  │  WireGuard (default)    │  UDP 51820                     │
  │  L2TP                   │  UDP 1701                      │
  │  PPTP (broken)          │  TCP 1723                      │
  └─────────────────────────┴────────────────────────────────┘


Exam Quick Reference

text
  ┌─────────────────────────────────────────────────────────────────────┐
  │                     VPN AND TUNNELING SUMMARY                        │
  ├─────────────────────────────────────────────────────────────────────┤
  │  Remote access VPN  │ Individual device → corporate; user auth       │
  │  Site-to-site VPN   │ Network → network; gateway auth; always-on     │
  ├─────────────────────────────────────────────────────────────────────┤
  │  IPSec AH           │ Integrity + auth; NO confidentiality           │
  │  IPSec ESP          │ Confidentiality + integrity + auth (standard)  │
  │  IPSec transport    │ Host-to-host; encrypts payload only            │
  │  IPSec tunnel       │ Gateway-to-gateway; encrypts full packet       │
  ├─────────────────────────────────────────────────────────────────────┤
  │  TLS VPN            │ Port 443; firewall-friendly; clientless option │
  │  SSL                │ Broken — never use; "SSL VPN" actually uses TLS│
  │  PPTP               │ Broken — never use                             │
  │  L2TP               │ No encryption alone; always paired with IPSec  │
  ├─────────────────────────────────────────────────────────────────────┤
  │  Split tunneling    │ Only corp traffic through VPN; security risk   │
  │  Full tunneling     │ All traffic through VPN; safer; more load      │
  │  Always-on VPN      │ Auto-connects; machine cert auth; no user step │
  └─────────────────────────────────────────────────────────────────────┘