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
| Protocol | Security | Speed | Ease of Setup | Best For |
|---|---|---|---|---|
| WireGuard | Excellent | Excellent | Easy | Modern deployments |
| OpenVPN | Excellent | Good | Moderate | Compatibility, enterprise |
| IPsec/IKEv2 | Excellent | Good | Complex | Mobile, site-to-site |
| L2TP/IPsec | Moderate | Moderate | Moderate | Deprecated — removed on modern platforms (e.g., Android 12+) |
| PPTP | Poor | Good | Easy | Avoid (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
| Aspect | OpenVPN | WireGuard |
|---|---|---|
| Config complexity | High | Low |
| Certificate management | Required | Keys only |
| Tunnel IP assignment (IPAM) | Built-in dynamic IP assignment | Static peer IPs (no built-in IPAM without a control plane; endpoint roaming is seamless) |
| Protocol | TCP or UDP | UDP only |
| Firewall traversal | Better (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
| Solution | Notes |
|---|---|
| wg-easy | Active Docker-friendly WireGuard server with web UI (replaces archived PiVPN, EOL April 2024) |
| Algo VPN | Ansible scripts for deploying WireGuard and IKEv2 VPNs on cloud |
| Tailscale | WireGuard-based mesh VPN, zero config |
| Headscale | Self-hosted Tailscale control server |
| Netbird | WireGuard-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