Reference notes.

VPNs (Virtual Private Networks) create encrypted tunnels over public networks, enabling secure remote access and site-to-site connectivity.

Use Cases

  • Remote access - Securely connect to office/home network
  • Site-to-site - Connect multiple office locations
  • Privacy - Mask traffic from ISPs
  • Bypass geo-restrictions - Access region-locked content
  • Secure public WiFi - Encrypt traffic on untrusted networks

VPN Protocols Comparison

ProtocolSecuritySpeedEase of SetupBest For
WireGuardExcellentExcellentEasyModern deployments
OpenVPNExcellentGoodModerateCompatibility, enterprise
IPsec/IKEv2ExcellentGoodComplexMobile, site-to-site
L2TP/IPsecModerateModerateModerateDeprecated — removed on modern platforms (e.g., Android 12+)
PPTPPoorGoodEasyAvoid (broken crypto)

WireGuard

Modern, fast, and simple VPN protocol. Recommended for most use cases.

Why WireGuard?

  • ~4,000 lines of code (vs ~100,000 for OpenVPN)
  • Built into Linux (5.6+), FreeBSD (13.2+), and OpenBSD kernels; Windows, macOS, iOS, and Android require installing the WireGuard client app
  • Faster connection establishment (1-RTT handshake)
  • Better performance using modern cryptography (ChaCha20-Poly1305, Curve25519, BLAKE2s), plus an optional 256-bit pre-shared key (PSK) for post-quantum resistance
  • Simpler configuration
  • Roaming support — seamlessly handles dynamic client endpoint IP changes (e.g., switching from WiFi to cellular)

OpenVPN

Mature, widely supported, highly configurable.

Key Differences from WireGuard

AspectOpenVPNWireGuard
Config complexityHighLow
Certificate managementRequiredKeys only
Tunnel IP assignment (IPAM)Built-in dynamic IP assignmentStatic peer IPs (no built-in IPAM without a control plane; endpoint roaming is seamless)
ProtocolTCP or UDPUDP only
Firewall traversalBetter (TCP 443)UDP only

IPsec / IKEv2

Strong security, native support in most operating systems.

Split Tunnelling

Route only specific traffic through VPN, not all traffic.

Self-Hosted VPN Solutions

SolutionNotes
wg-easyActive Docker-friendly WireGuard server with web UI (replaces archived PiVPN, EOL April 2024)
Algo VPNAnsible scripts for deploying WireGuard and IKEv2 VPNs on cloud
TailscaleWireGuard-based mesh VPN, zero config
HeadscaleSelf-hosted Tailscale control server
NetbirdWireGuard-based, self-hostable

Security Considerations

  • Key rotation - WireGuard automatically rotates ephemeral session keys every 2 minutes; periodically rotate long-term static peer keys and certificates
  • Kill switch - Block traffic if VPN drops
  • DNS leaks - Ensure DNS queries go through VPN
  • IPv6 leaks - Disable IPv6 or route through VPN
  • Logging policy - For privacy, use providers with no-logs policy

See Also

  • TLS — OpenVPN uses TLS; mTLS provides comparable per-application encryption
  • Routing — Site-to-site VPNs interact with routing tables and BGP
  • Firewalls — VPN endpoints typically terminate behind a firewall
  • DNS — DNS leaks bypass the tunnel and reveal browsing activity

References