VPNs

How Virtual Private Networks Work

By NeatVirtual Editorial Team · · 5 min read

A virtual private network, or VPN, creates a protected connection across a network you do not control, usually the public internet. To the devices on each end, it behaves as though they were joined by a private cable. The traffic that crosses it is encrypted, so those in between see scrambled data rather than your actual communication.

People use VPNs for two main reasons. Organizations use them to let staff reach internal systems from outside the office. Individuals use them to protect traffic on untrusted networks, such as public Wi-Fi, or to change the apparent network location of their connection. The technology is the same in both cases, but the goals differ.

The core idea: a tunnel

The key concept is tunneling. Your device takes a normal network packet, encrypts it, and places it inside another packet addressed to the VPN server. This outer packet travels across the internet. At the other end, the server removes the outer wrapper, decrypts the contents and forwards the original packet to its destination.

An observer on the path sees only that your device is exchanging encrypted data with the VPN server. The websites and services inside are hidden from them. This process is called encapsulation.

What happens when you connect

  1. Authentication. Your client proves who you are, with a password, a certificate, a key pair or a combination of methods, and checks that the server is genuine.
  2. Key exchange. The two sides agree on shared secret keys without sending them in the open, using the public-key techniques that underlie modern encryption.
  3. Tunnel setup. The client creates a virtual network interface on your device, and gets an internal address.
  4. Routing. Your operating system is told which traffic should travel through the tunnel. This can be all traffic or only traffic for certain destinations.
  5. Data transfer. Packets are encrypted, sent, decrypted and forwarded, in both directions, until you disconnect.

Common VPN protocols

Several protocols exist, each with different design choices.

  • IPsec is a long-standing suite built into many operating systems and network devices. It is often paired with IKEv2 for setting up connections and is common in business site-to-site links.
  • OpenVPN is an open-source protocol that runs over standard ports, with wide platform support and good flexibility.
  • WireGuard is a newer design with a small code base, modern cryptography and fast performance. It is now included in the Linux kernel and available on other platforms.
  • SSL/TLS-based VPNs use the same technology as secure websites, often through a web portal or a lightweight client, which helps them pass through restrictive networks.
  • Older protocols such as PPTP have known weaknesses and should be avoided.

Types of VPN setups

Remote access

A single user connects to a company network from home or while traveling. After connecting, the user can reach internal files, servers and applications as though in the office.

Site-to-site

Two entire networks, such as a head office and a branch, are linked by a permanent tunnel between their gateways. Users at each location notice nothing special; devices simply reach each other.

Consumer VPN services

A user connects to a provider's server, and the user's internet traffic exits from there. Websites see the server's address instead of the user's home address. This changes who can see what, but it does not remove the need for trust: the provider can see the traffic that passes through its servers.

Full tunnel versus split tunnel

With a full tunnel, all traffic from your device goes through the VPN. This offers the most consistent protection and central control, at the expense of extra load on the VPN and sometimes slower browsing. With a split tunnel, only traffic destined for specific networks uses the VPN, while everything else goes directly to the internet. It saves bandwidth, but leaves part of your traffic outside the protected path.

What a VPN does protect

  • It encrypts traffic between your device and the VPN server, which helps on public or shared networks.
  • It hides your destinations and content from local network observers and from your internet provider, who see only the connection to the VPN.
  • It lets remote staff reach private resources without exposing those resources directly to the internet.
  • It can hide your home network address from the sites you visit, replacing it with the server's.

What a VPN does not do

  • It does not make you anonymous. Accounts you sign in to, cookies and browser fingerprints still identify you.
  • It does not protect against malware or phishing. A harmful file or fake page works just the same through a tunnel.
  • It does not secure traffic after the exit point. Between the VPN server and the destination, traffic is only as protected as the site's own encryption, which is why HTTPS still matters.
  • It does not remove trust. You move trust from your network provider to your VPN operator.
  • It is not a substitute for good security practices, such as updates, strong authentication and careful downloads.

Practical considerations

  • Speed can drop because of encryption overhead and the extra distance to the server.
  • A "kill switch" feature blocks traffic if the tunnel drops, preventing accidental exposure.
  • DNS requests should go through the tunnel too, otherwise your lookups can reveal where you browse.
  • For organizations, combine VPN access with multi-factor authentication and least-privilege rules, because a VPN that grants access to everything becomes a single point of failure.
  • Keep VPN software updated, since gateways are attractive targets.

Frequently Asked Questions

Is a VPN legal and safe to use?

In most countries, using a VPN is legal, although some places restrict or regulate it. Safety depends mostly on the operator and configuration, so choose carefully, keep software updated and follow your local rules and your employer's policy.

Does a VPN make public Wi-Fi safe?

It improves things by encrypting your traffic across the local network, so other users cannot easily read it. Since most sites already use HTTPS, the gain is smaller than it once was, but a VPN still protects lookups and non-HTTPS traffic and prevents some local tampering.

Will a VPN slow down my connection?

Usually a little. Encryption takes processing time, and traffic travels through an extra stop. Efficient protocols and a nearby server keep the difference small, and many people barely notice it during normal browsing.

Related reading