VPN & Encryption Basics
Virtual Private Networks and encryption are the cornerstones of secure network communication. You will learn how symmetric and asymmetric encryption work, how VPN protocols like OpenVPN and WireGuard protect traffic, and what the limitations of VPNs are from a security perspective. This lesson demystifies the cryptographic concepts that underpin all secure communications.
Learning Objectives — Deep Dive
Each objective below is broken down into plain English so you know exactly what you are learning, why it matters, and what you will be able to do when you are done. Mark each one complete as you work through the lesson.
Install OpenVPN on Kali
Run 'sudo apt update && sudo apt install openvpn -y' to install the OpenVPN client on Kali Linux. OpenVPN is pre-installed on many Kali versions, so the install may complete quickly or confirm it is already present. You will also need a VPN configuration file (.ovpn) from a VPN provider — for lab use, ProtonVPN and Mullvad both offer free or trial accounts with downloadable config files. Verify the installation succeeded by running 'openvpn --version' and confirming a version number is displayed.
Connect to a VPN server
Download a .ovpn configuration file from your VPN provider and run 'sudo openvpn --config yourfile.ovpn' to initiate the connection. You will see a stream of log output; wait for the line 'Initialization Sequence Completed' which confirms the tunnel is established. If your provider requires username and password authentication, OpenVPN will prompt you interactively, or you can create an auth.txt file with credentials and reference it in the config. A common pitfall is using a config file for the wrong server region, which may result in higher latency than expected.
Verify the VPN is working
Open a new terminal tab (leave the OpenVPN process running in the first tab) and run 'curl ifconfig.me' to check your public IP address. The returned IP should be the VPN server's IP, not your real IP — if it matches your ISP's IP, the VPN tunnel is not routing traffic correctly. Also run 'ip route' to confirm a new tun0 interface exists and has a route through the VPN. Check for DNS leaks by running 'nslookup whoami.akamai.net' and verifying the resolver IP is the VPN provider's DNS server, not your ISP's.
Capture traffic before and after
Start a Wireshark capture on your main interface before connecting to the VPN, then browse to a plain HTTP site and observe the readable HTTP traffic in the capture. Stop the capture, connect to the VPN, start a new capture on the same interface, and repeat the same browsing activity. In the second capture, you should see only encrypted OpenVPN UDP or TCP packets — the HTTP content is no longer visible because it is encapsulated inside the VPN tunnel. This comparison visually demonstrates exactly what a VPN protects and what it does not protect.