Set up WireGuard and OpenVPN, configure iptables kill switches, and reason clearly about when to use a VPN versus Tor — all in a simulated Linux environment.
Click each protocol card to see its details:
What a VPN tunnel looks like on the wire:
A VPN encrypts traffic between your device and the VPN server, preventing your ISP from reading content or logging destination IPs. It also hides your real IP from websites you visit — they see the VPN server's IP instead.
The VPN provider sees all your decrypted traffic (if you visit HTTP sites) and knows your real IP. You are shifting trust from your ISP to your VPN provider. A VPN also does not protect against browser fingerprinting, cookies, or malware on your own machine.
Run each command in order. The terminal accepts partial matches — focus on the key tokens of each command.
sudo apt install wireguardwg genkey | tee privatekey | wg pubkey > publickeysudo wg-quick up wg0sudo wg show
The /etc/wireguard/wg0.conf you create:
WireGuard has a 4,000-line kernel module vs OpenVPN's 600,000+ lines of userspace code. Fewer lines means fewer bugs, faster security audits, and a smaller attack surface. WireGuard also uses a fixed, modern cryptographic suite (ChaCha20-Poly1305, Curve25519, BLAKE2) — no cipher negotiation means no downgrade attacks.
WireGuard's default design logs peer IP addresses in kernel memory until the interface is brought down. If privacy against the VPN server is a concern, ensure your provider implements IP assignment rotation or uses an obfuscated front-end (like Mullvad's implementation).
client.ovpn config file and need to connect and
verify the tunnel interface came up.
Install OpenVPN, connect, and verify the tunnel interface:
sudo apt install openvpnsudo openvpn --config client.ovpnip addr show tun0
When OpenVPN connects, it logs every step of the TLS handshake: certificate
exchange, cipher negotiation (you will see something like
AES-256-GCM), and finally "Initialization Sequence Completed" which
signals the tunnel is live. The tun0 interface appearing in
ip addr output is the virtual tunnel device — all traffic routed
through it exits from the VPN server's IP.
OpenVPN over TCP (port 443) is firewall-friendly — it looks like HTTPS and passes through most corporate/hotel firewalls. However, TCP-over-TCP creates "TCP meltdown" under packet loss because both the inner and outer protocol do retransmission. For performance-sensitive work, prefer UDP (port 1194) whenever the network allows it.
Current VPN & kill switch state:
Apply the kill switch rules, then simulate a VPN disconnect:
iptables -A OUTPUT -o wg0 -j ACCEPTiptables -A OUTPUT -o eth0 -p udp --dport 51820 -j ACCEPTiptables -A OUTPUT -o eth0 -j DROPsimulate vpn drop — test what happens if wg0 goes down
The three rules explained:
VPN software can crash. Network interfaces can flap. Without a kill switch, your
OS will happily route traffic through your real interface the moment the VPN goes
down — often for minutes before you notice. The iptables rules above ensure that
only WireGuard-encapsulated packets (via wg0) and the WireGuard
handshake itself can leave the machine.
iptables rules are flushed on reboot by default. Use
iptables-save > /etc/iptables/rules.v4 and
install iptables-persistent to restore them at boot. For WireGuard
specifically, add the iptables commands as PostUp and
PreDown hooks in wg0.conf.
Click each scenario to see the recommended tool and reasoning:
VPN = you trust your VPN provider not to log or betray you. You get speed
(WireGuard adds ~5 ms latency), stable connections, and real IP masking from sites.
Tor = you trust no single entity. Traffic is layered through three independent
relays — even if one is compromised, your identity is not. The trade-off: 200–500 ms
added latency and no persistent connections (breaks streaming, VoIP).
Running Tor over VPN hides Tor usage from your ISP (useful in countries where Tor is blocked) but does NOT improve anonymity — the VPN provider still knows your real IP. Running VPN over Tor (Tor first, then VPN) is almost never recommended: it breaks Tor's anonymity model and adds the VPN as a single point of trust inside the Tor circuit.
Complete all five exercises to unlock lab completion credit.