Networking concepts
What is a VPN tunnel?
A VPN tunnel is an encrypted path between two points on a network. Your device wraps each outbound packet inside a new packet addressed to a VPN server, encrypts the original, and sends it across the public internet. The server unwraps it and forwards it on, so the networks in between see only the outer envelope.
What does the word tunnel actually mean here?
A tunnel is encapsulation: one protocol carried as the payload of another. The original packet keeps its own source and destination addresses, but nothing on the path reads them, because they are now cargo inside a second packet. That is what lets private addresses travel across a public network, and it is the same mechanism behind every kind of tunneling, not just VPNs.
The V and the P do the rest of the work. Virtual, because the network is built in software rather than out of cable you own. Private, because the encapsulated payload is encrypted before it leaves your machine.
How does a VPN tunnel work?
The client and the server first authenticate each other and agree on encryption keys, usually with a public key exchange. The client then creates a virtual network interface on your machine and edits the routing table so that traffic is sent to that interface instead of straight out of your physical adapter.
From then on, every packet handed to that interface is encrypted, given a new outer header addressed to the VPN server, and sent over the real connection. The server decrypts it, forwards the inner packet to its real destination, and sends the reply back the same way. The encapsulation costs you some bytes per packet, which is why a VPN link has a smaller usable MTU than the connection underneath it.
What is the difference between a remote access VPN and a site-to-site VPN?
A remote access VPN connects one device to a network. You run a client, you authenticate, and your laptop behaves as though it were plugged into the office. A site-to-site VPN connects two networks to each other, and the tunnel is maintained by routers or firewalls at each end rather than by software on individual machines.
Mesh VPNs are a third shape. Instead of routing everything through a central concentrator, each device builds a direct encrypted link to every other device it needs to reach, with a coordination server handling keys and discovery.
What is the difference between a VPN and a proxy?
A proxy works at the application layer and only for the applications configured to use it. An HTTP or SOCKS proxy relays requests on your behalf, but your operating system keeps sending everything else, including DNS lookups from other programs, out of the normal interface.
A VPN works at the network layer and captures traffic from every process on the machine, because the change is made in the routing table rather than in each application's settings. A proxy also gives you no encryption of its own; the confidentiality you get is whatever TLS the application already used.
Which protocols do VPN tunnels use?
Several, and the choice mostly comes down to what the network in the middle will allow through and how much code you want in the security-critical path. Most of them run over UDP, because retransmitting a lost packet twice, once in the tunnel and once in the connection it carries, causes the throughput collapse known as TCP meltdown.
| Protocol | Transport | Where you meet it |
|---|---|---|
| WireGuard | UDP | Modern consumer apps and mesh VPNs. A small codebase with a fixed, modern cipher suite and no negotiation. |
| OpenVPN | UDP or TCP | The long-standing default in corporate and commercial VPNs. Built on TLS, and its TCP mode on port 443 survives restrictive networks. |
| IPsec with IKEv2 | UDP 500 and 4500 | Site-to-site links between offices, and the VPN client built into most phones. Reconnects cleanly when a device changes network. |
| L2TP with IPsec | UDP | Older operating system clients. L2TP encrypts nothing on its own, so it is always paired with IPsec. |
| SSTP | TCP 443 | Windows environments. It looks like ordinary HTTPS on the wire, so firewalls rarely block it. |
Does a VPN make you anonymous?
No. A VPN moves trust rather than removing it. Your internet provider stops seeing which sites you visit, and the VPN operator starts seeing it instead, along with the timestamps and volumes that go with it.
Sites you visit still identify you by the account you log into, the cookies you carry, and the fingerprint your browser presents. Encryption also stops at the VPN server: from there to the destination, your traffic is protected only by whatever TLS the connection already had.
When is a VPN the wrong tool?
A VPN is built to let trusted members join a private network. It is the wrong shape when you need to give an untrusted outsider access to exactly one service. A payment provider posting a webhook, a client reviewing a staging build, or a phone on a mobile network cannot be asked to install a VPN client and hold a credential for your network.
It is also more access than the job needs. Joining someone to a VPN puts them on the network, where routing and firewall rules are the only thing standing between them and everything else on it. For one HTTP service, a reverse tunnel that publishes a single URL is both simpler and narrower.
Related reading
What is tunneling?
The general mechanism a VPN is one example of: carrying one protocol inside another.
What is split tunneling?
Sending some traffic through the VPN and the rest straight out, and what that costs you.
What is a reverse tunnel?
Why the connection is made outbound, and how that gets a service out from behind NAT.
All Learn articles
The rest of the vocabulary, and the how-to guides that use it.
How is tunnels.io different from a VPN?
tunnels.io is a reverse tunnel, not a VPN. It does not create a virtual interface, change your routing table, or put anyone on your network. The client opens one outbound connection from your machine to our edge, and we publish a single public HTTPS URL that forwards to one local port. Whoever needs to reach it uses a browser, which is the point: they install nothing and hold no credential.
The trade-off is scope. A VPN gives a trusted device the whole network. We give the whole internet one service, over HTTP, HTTPS or TCP. There is no UDP support, so we are not a transport for WireGuard or for anything else that needs datagrams. TCP tunnels start on the Pro plan; the free Basic plan is HTTPS only, with 4 GB a month, one tunnel, a random URL, and no interstitial page in front of your app.
If what you actually want is a private mesh between your own machines, a WireGuard-based VPN is the better fit, and we would rather say so. Our comparison with Tailscale sets out where each tool belongs.
Frequently asked questions
Is a VPN tunnel the same as a tunnel to localhost?
Both encapsulate traffic, but they solve opposite problems. A VPN tunnel puts your device onto a private network so you can reach things inside it. A localhost tunnel publishes one service running on your machine at a public URL so people outside can reach it, without joining any network of yours.
Does a VPN hide my traffic from my internet provider?
It hides the contents and the destinations, yes. Your provider can still see that you are connected to a VPN server, how much data you move, and when. The visibility you took away from the provider is handed to whoever operates the VPN, so the operator's logging policy becomes the thing that matters.
Is WireGuard better than OpenVPN?
WireGuard is far smaller, faster to hand off between networks, and fixes its cipher choices instead of negotiating them, which removes a whole class of misconfiguration. OpenVPN is older and more configurable, and its TCP mode on port 443 gets through networks that block UDP outright. Pick WireGuard unless the network in the middle forces your hand.
Can I use a VPN to show a client my local development site?
You can, but it means giving that client VPN software, a credential, and a route into your network for the sake of one web page. A reverse tunnel is the narrower answer: it publishes only the port you name, at a URL the client opens in a browser with nothing installed.
Does a VPN protect me on public Wi-Fi?
It does help. Everything leaving your device is encrypted before it touches the local network, so a hostile access point sees only ciphertext addressed to your VPN server. Most sites already use HTTPS, so the main gain is hiding which hosts you contact and protecting anything that is still unencrypted.