The primary purpose of a VPN is not to make you anonymous, but to make your network traffic indistinguishable from legitimate traffic originating from the VPN server itself.

Imagine you’re at a coffee shop, and you want to access your company’s internal file server. Normally, your laptop would send requests directly to the file server, and those requests would pass through your ISP and potentially several other networks. Anyone snooping on these networks could see where your requests are going and what data you’re accessing.

A VPN changes this. When you connect to your company’s VPN, your laptop establishes a secure, encrypted "tunnel" to a VPN server managed by your company. All your internet traffic, including requests to the file server, is first wrapped inside this tunnel.

Here’s what that looks like in practice:

Let’s say your laptop has an IP address 192.168.1.10 and the company file server is at 10.0.0.5.

  1. Without VPN:

    • Your laptop sends a packet: Source: 192.168.1.10, Destination: 10.0.0.5.
    • This packet travels across the internet, visible to your ISP and others.
  2. With VPN:

    • Your laptop encrypts the original packet (Source: 192.168.1.10, Destination: 10.0.0.5).
    • It then wraps this encrypted packet inside a new packet.
    • The new packet has: Source: Your Public IP (e.g., 203.0.113.5), Destination: VPN Server IP (e.g., 198.51.100.10).
    • This new, outer packet travels across the internet. Your ISP only sees traffic going to 198.51.100.10.
    • The VPN server receives the outer packet, decrypts it, and extracts your original packet.
    • The VPN server then forwards your original packet (Source: 192.168.1.10, Destination: 10.0.0.5) to the file server. To the file server, it looks like the request came from the VPN server’s IP address (e.g., 198.51.100.10).

The "tunneling" refers to this process of encapsulating your original network traffic within another set of packets. The "encryption" is what makes the contents of that tunnel unreadable to anyone who intercepts the outer packets. Common VPN protocols like OpenVPN, IPsec (often used in L2TP/IPsec), and WireGuard all achieve this encapsulation and encryption, but they use different mechanisms and algorithms.

For instance, OpenVPN commonly uses TLS/SSL for encryption, similar to how HTTPS secures your web browsing. IPsec, on the other hand, is a suite of protocols that can operate at different network layers and offers both encryption (ESP - Encapsulating Security Payload) and authentication (AH - Authentication Header). WireGuard is a newer, simpler protocol designed for speed and ease of use, often employing the ChaCha20 cipher for encryption.

The key takeaway is that the VPN server acts as a proxy. Your traffic exits the internet from the VPN server’s IP address, not your own. This masks your origin IP and makes your traffic appear to originate from the VPN server’s location, which is crucial for accessing geo-restricted content or for maintaining privacy on public Wi-Fi.

When you configure a VPN client, you’re essentially telling it:

  • The IP address or hostname of the VPN server.
  • The VPN protocol to use (e.g., OpenVPN, IKEv2, L2TP/IPsec, WireGuard).
  • Authentication credentials (username/password, pre-shared key, or digital certificates).
  • Potentially, specific encryption algorithms and key exchange methods.

The client and server then perform a handshake. For example, with OpenVPN, the client might connect to the server on UDP port 1194 (a common default) and initiate a TLS handshake. During this handshake, they negotiate encryption algorithms, exchange cryptographic keys that will be used for the duration of the session, and authenticate each other. Once the secure tunnel is established, all subsequent network packets are encrypted and sent through this tunnel.

The security of a VPN relies heavily on the strength of its encryption algorithms and the integrity of the key exchange process. A weak cipher or a compromised key exchange can render the encryption useless. Similarly, if the VPN server itself is compromised, it can see all your decrypted traffic.

Many VPNs also employ a feature called "split tunneling." By default, all your internet traffic goes through the VPN. With split tunneling, you can configure certain applications or destinations to bypass the VPN and connect directly to the internet. For example, you might want your streaming service to use your regular internet connection for better speeds, while your work-related traffic goes through the VPN.

The most surprising aspect of VPNs is how their effectiveness for privacy is directly tied to the trustworthiness of the VPN provider. If a VPN provider logs your activity, the encryption and tunneling become irrelevant for true privacy, as they hold the decrypted data.

Understanding the interplay between tunneling protocols and encryption ciphers is key to appreciating why one VPN might perform differently or offer a different security posture than another.

The next step in securing your network traffic often involves exploring proxy servers and their differences from VPNs.

Want structured learning?

Take the full Computer Networking course →