Articles & BlogBy 8 min read

For anyone who has seen a VPN advert and wondered what the product does. By the end you will know what a VPN hides, who it hides it from, and whether you need one.

VPN adverts promise a lot: privacy, security, anonymity, protection from hackers. Some of that is true in a narrow sense, and some of it is not true at all. The technology underneath is simple and useful, and once you can picture it, you can judge the claims yourself.

A virtual private network (VPN) is an encrypted tunnel between your device and another network. Everything your device sends goes into the tunnel, comes out at the far end, and carries on from there as if you were sitting at that far end.

Three cars on a highway drive toward the mouth of a road tunnel cut into a steep hillside that is covered from top to bottom in small brightly painted housesTraffic in a tunnel is hidden from the hillside, but it still comes out somewhere, and whoever runs the tunnel sees every car. Photo by Wilfredor, CC0, via Wikimedia Commons.

What is the tunnel, exactly?

Your device runs a small program called a VPN client. The client takes each packet of data you send (a packet is one small chunk of network traffic), encrypts the whole thing, and wraps it inside a new packet addressed to a VPN server. The server unwraps it, decrypts it, and sends the original on its way. Replies come back by the same route in reverse.

Two things follow from that. Anyone between you and the VPN server sees only scrambled packets going to one address. And anyone beyond the VPN server sees your traffic arriving from the server's address, not from yours.

Two very different uses

The same technology is sold for two jobs that have little to do with each other.

QuestionReaching a private networkA commercial privacy VPN
Far end of the tunnelYour workplace, or your own homeA server owned by a VPN company
What you gainAccess to things that are not on the public internetA different address, and privacy from the local network
Who runs the serverYour employer, or youA company you pay
Who you must trustYour employer, or yourselfThat company

The first kind is the original. A hospital lets its staff reach the records system from home, and nobody else can reach it at all. You can build a small version yourself: a VPN server at home lets you get to your own files, cameras or game server from anywhere, without opening any of them to the internet.

The second kind is what the adverts sell. There is no private network at the far end, only an exit onto the ordinary internet from somewhere else.

Who sees what?

This is the question that decides whether a VPN helps you. Take one request, to a website over HTTPS, and follow it both ways.

A diagram of the same web request without a VPN and with one. Without a VPN, the request goes from you through the Wi-Fi and your internet provider to the website. The Wi-Fi and provider see your IP address, which sites you visit, when and how much, but not the pages, because HTTPS hides those. The website sees your real IP address. With a VPN, an encrypted tunnel runs from you through the Wi-Fi and provider to the VPN server, and the request goes on from there to the website. The Wi-Fi and provider see only that you use a VPN, when and how much, not which sites. The VPN server sees your real IP and which sites you visit. The website sees the VPN's IP address, not yours. The trust moves from your provider to the VPN company. It does not go away.A VPN does not remove the party who can see where you go. It replaces one with another.

WhoWithout a VPNWith a VPN
The Wi-Fi owner and your internet providerYour address, the names of the sites you visit, when, and how much dataThat you are connected to a VPN server, when, and how much data
The VPN providerNothing, there is noneYour real address, the names of the sites you visit, when, and how much data
The websiteYour real IP addressThe VPN server's IP address
Anyone, of the page contentsNothing, if the site uses HTTPSNothing, if the site uses HTTPS

Look at the second row. Everything your internet provider used to see, the VPN provider now sees instead. You have not removed the watcher. You have chosen a different one. That is a good trade if you trust the VPN company more than the network you are on, and a bad trade if you do not.

Look at the last row too. HTTPS already hides the contents of pages, with or without a VPN. A VPN hides which sites you talk to, not what you say to them.

What does a VPN not do?

  • It does not make you anonymous. The VPN provider knows your real address and usually your payment details. Sites also recognize you by cookies and by the make-up of your browser, and neither changes when your address does.
  • Sites still know you when you log in. Sign in to your email or a shop through a VPN and that company knows exactly who you are. The address you arrived from is a detail.
  • It does not stop malware. A bad download arrives through the tunnel as easily as a good one. The tunnel protects traffic in transit and has no opinion on what the traffic is.
  • It does not stop phishing. A fake login page works the same through a VPN. If you type your password into it, the tunnel delivers it safely to the criminal.

Watch out

The mistake that hurts beginners is feeling protected. A VPN changes who can see where your traffic goes. It does not make a risky click safe, and it is not a replacement for updates, good passwords or thinking before you log in.

When does one help, and how do you choose?

A VPN earns its place in three situations:

  1. Untrusted Wi-Fi. In a hotel, airport or cafe, the tunnel keeps the network's owner, and anyone else on it, from seeing which sites you use or meddling with your connection.
  2. Reaching home or work. This is the original use, and still the best one.
  3. Hiding your browsing from the local network. That might be a shared house, a campus or your internet provider.

If you decide to pay for one, you are choosing whom to trust with the list of everywhere you go. I would not start with a ranking site, since the site may earn a commission on each sign-up. I would ask these questions instead:

  • Who owns the company, and in which country? If you cannot find out, stop there.
  • How does it make money? A free VPN has to pay for its servers somehow.
  • Has an outside firm audited it, and is the report public and recent?
  • What does its policy say it logs, in plain words?
  • Does it use an open, well-studied protocol, or a secret one of its own?
  • Does the client have a kill switch, which blocks all traffic if the tunnel drops, and does it send your DNS lookups through the tunnel too?
  • Does it promise things no VPN can deliver, such as "total anonymity"? Treat that as a mark against it.

Tip

The most useful VPN for many people costs nothing: one into your own home. Some home routers can act as a VPN server, so check the admin page of yours. You become the provider, and the only party you have to trust is yourself.

WireGuard and OpenVPN

A VPN protocol is the set of rules the client and server use to build the tunnel. Two open ones cover most of what you will meet.

PointWireGuardOpenVPN
What its makers sayA simple, fast and modern VPNAn open-source VPN program, tightly tied to the OpenSSL library
Carried overUDP onlyUDP by default, TCP as an option
PortNone fixed, 51820 in its own examples1194 by default
EncryptionOne fixed modern set, with no menu to choose fromNegotiated with TLS, the same family that protects HTTPS
Good to knowBuilt into the Linux kernel, with apps for Windows, macOS, iOS and AndroidThe TCP option can get through networks that block UDP

WireGuard identifies each side by a key pair, the same idea a web server's certificate rests on. Setting it up starts with making your own.

wg genkey | tee privatekey | wg pubkey > publickey

This creates a private key, saves it to a file named privatekey, works out the matching public key and saves that to publickey. You keep the first one secret and give the second to the other end.

The heart of a laptop's configuration for a tunnel to a home server is only a few lines.

[Interface]
PrivateKey = (the laptop's private key)

[Peer]
PublicKey = (the home server's public key)
Endpoint = 203.0.113.10:51820
AllowedIPs = 192.168.1.0/24

Endpoint is where the home server can be reached from the internet. AllowedIPs says which destinations go into the tunnel: here only the home network, 192.168.1.x, while the rest of your traffic travels as usual. WireGuard's own documentation covers the remaining lines and the server's side.

What to remember

  • A VPN is an encrypted tunnel from your device to a server somewhere else.
  • Reaching a private network and buying a privacy service are two different uses of the same tool.
  • With a VPN, the local network and your provider see only that you use one. The VPN provider sees what they used to see.
  • A website sees the VPN's address until you log in. Then it knows who you are.
  • No VPN stops malware or phishing, and none makes you anonymous.
  • It helps most on Wi-Fi you do not trust and for reaching your own network.
  • Pick a provider by ownership, audits and logging policy, and prefer open protocols such as WireGuard and OpenVPN.

A good first project is a tunnel into your own home, because it teaches the idea with nobody else to trust. Before you build one, read Firewalls, NAT and Port Forwarding, which explains how the outside world reaches a machine behind your router in the first place.