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/IPsecGoodModerateModerateLegacy compatibility
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 kernel (5.6+)
  • Faster connection establishment
  • Better performance (uses modern cryptography)
  • Simpler configuration

OpenVPN

Mature, widely supported, highly configurable.

Key Differences from WireGuard

AspectOpenVPNWireGuard
Config complexityHighLow
Certificate managementRequiredKeys only
Dynamic IPsEasierRequires extra config
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
PiVPNEasy WireGuard/OpenVPN installer for Raspberry Pi
Algo VPNAnsible scripts for IKEv2 VPN on cloud
TailscaleWireGuard-based mesh VPN, zero config
HeadscaleSelf-hosted Tailscale control server
NetbirdWireGuard-based, self-hostable

Security Considerations

  • Key rotation - Periodically regenerate keys
  • 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

References