{"canonical_url":"https://engineer.company/glossary/vpn/","content_markdown":"# VPN\n\n## What it is\n\nA VPN, short for virtual private network, is a set of tunnels or labelled paths that lets a\nclosed group of machines reach one another by their own addresses and routes, whatever networks\nthe packets cross on the way. The IETF's terminology treats it as a matter of separation rather\nthan secrecy: the group is kept apart from other users, and encryption is mentioned as a possible\nextra that lies outside the working groups' scope. In daily use two shapes dominate. A\nsite-to-site VPN joins whole networks, such as an office and a cloud project, through a gateway at\neach end. A remote-access VPN joins one laptop or phone to a network it is away from.\n\nVery different technologies share the name. IPsec protects IP packets inside the network stack of\na host or a security gateway and commonly uses IKEv2 to negotiate its keys; it is what most firewalls,\nrouters and managed cloud gateways speak. WireGuard is a newer tunnel that appears as an ordinary\nnetwork interface, travels over UDP, identifies each peer by a public key and deliberately offers\none fixed set of ciphers instead of a menu to negotiate. OpenVPN runs as a user-space process and\nsets up its keys with TLS. Carrier VPNs built on BGP and MPLS keep customers apart inside a\nprovider's backbone and, by their own specification, provide no cryptographic privacy at all.\nWhen a contract, a diagram or a firewall vendor says VPN, it pays to ask which of these is meant.\n\n## Why it matters\n\nThe decision a VPN usually settles is how two places that need to talk can do so without putting\nthe service between them on the open internet. A database that only a pipeline in another cloud\nreads, an internal admin panel, a backup target: each can listen publicly behind a login, or\nlisten on a private address that only the tunnel makes reachable. The second option shrinks what\na scanner can find to one gateway port, and for links between sites it remains the plain,\nwell-understood answer.\n\nWireGuard or IPsec is the next question, and the far end usually decides it. If that end is a\nfirewall appliance, a cloud provider's managed gateway or a partner's network team, IPsec is\noften the only thing on offer, and interoperability outweighs elegance. If both ends are Linux\nmachines under your own control, WireGuard is quicker to set up and easier to reason about: one\nshort configuration file per side, one public key per peer, and a list of the addresses each peer\nmay send from. Its design paper puts the Linux implementation at under 4,000 lines of code, small\nenough to audit, while an IPsec setup on Linux pairs the kernel's packet transform with a\nseparate key-exchange daemon and a longer list of options to agree on.\n\nThe running cost is rarely the software, which ships with Linux and with most firewalls. The cost\nis attention. Tunnels drop at night, rekeying breaks hours after somebody changed a setting on\nthe far side, and the only symptom is silence: packets go in and nothing comes back. A tunnel\ndeserves the same treatment as any other production service, with its own health check, its own\nalert and a written note of who owns each end.\n\nA VPN is also the wrong tool in some places. Handing every remote employee a full tunnel into\nthe office network grants reach to a whole subnet when the person needed one application, and\nonce connected, everything on that subnet tends to trust them. Per-application access, where each\nrequest is authenticated on its own and usually sold as zero trust, fits better when the users\nare people and the targets are web applications. The consumer apps that advertise a VPN for\nprivacy are a third thing again: they move trust from the internet provider to the VPN company\nand can hide the original source IP address from destination sites, but do not\nby themselves guarantee anonymity.\n\n## What it looks like in practice\n\nBetween 2022 and 2024, secure traffic between Google Cloud and on-premises Linux systems ran over\n[eight WireGuard and IPsec tunnels, managed and troubleshot as one set](/portfolio/managed-8-wireguard-and-ipsec-vpn-connections/).\nThey had been fragile and slow to diagnose, and a dead tunnel could cut communication between\nenvironments. Their configuration was standardised so that no tunnel remained a special case,\ntheir health was monitored, and the recurring routing and key-exchange problems were fixed at the\nroot rather than cleared with a restart. All eight then ran reliably, and the recurring\nconnectivity incidents stopped.\n\nIn the same years an organisation needed data from a remote warehouse that sat behind an IPsec\nVPN. For\n[six ETL/ELT pipelines feeding Google BigQuery](/portfolio/designed-and-ran-6-etl-elt-pipelines/),\nthe tunnel was the first link in the chain: secure connections to the protected server were set\nup so that retrieval could run unattended. Scheduled jobs then downloaded compressed archives of\nParquet, CSV and .bak files, restored and staged them in MSSQL and PostgreSQL, and loaded the\nresult into BigQuery. Over a tunnel that no longer waited for a person, the full run took under\n20 minutes against at least three hours of manual work, and the data refreshed daily rather than\nweekly. The VPN is the least visible part of that result\nand the part everything else rests on: a pipeline that cannot reach its source stops at step one,\nhowever good the SQL behind it is.\n\n## Where it goes wrong\n\n**Big packets vanish while small ones get through.** Every tunnel adds headers, so the largest\npacket that fits inside is smaller than the path outside allows. A WireGuard data message adds 32\nbytes of fixed overhead before the outer UDP and IP headers, about 60 bytes in all\nover IPv4 and 80 over IPv6, in addition to any packet padding. When\nthe tunnel's MTU is set too high and the path drops the ICMP messages that would report it, ping\nand an SSH login work while file transfers and TLS handshakes hang. Test with a full-size packet\nthat forbids fragmentation, then lower the interface MTU or clamp the TCP segment size to fit.\n\n```sh\n# When each WireGuard peer last completed a handshake, as Unix time\nwg show wg0 latest-handshakes\n# A 1,420-byte packet that may not be fragmented on the way\nping -M do -s 1392 -c 3 10.0.0.2\n# Which interface and route the kernel picks for a remote host\nip route get 10.20.0.5\n```\n\n**Two sites picked the same addresses.** Private ranges such as 10.0.0.0/8 and 192.168.0.0/16\nare reused everywhere, and joining two networks that both use 10.0.0.0/24 leaves a router with\nno way to tell which side a packet is meant for. Plan the ranges before the first tunnel, or\naccept address translation at one end, which complicates every log line and firewall rule after\nit.\n\n**The tunnel is up and the route is wrong.** A peer can show a fresh handshake while traffic\nstill leaves through the default route, because the route for the remote subnet is missing or\nbecause WireGuard's list of allowed addresses for that peer leaves it out. In IPsec the\ncounterpart is traffic selectors that differ between the two ends. IKEv2 either narrows them to\nthe overlap or refuses them with a TS_UNACCEPTABLE notification, so a tunnel can come up carrying\nless than either side intended.\n\n**Rekeying fails long after the change.** Both protocols replace active session keys over time, so a\nmismatch introduced at one end, such as an edited proposal or a rotated key, may show only when\nthe current keys are replaced. WireGuard starts a new session about every two minutes while traffic flows.\nIPsec lifetimes are local policy at each end and need not match. For WireGuard, interpret the age of the last\nsuccessful handshake alongside expected traffic or health probes: an idle peer's\nold handshake alone does not establish failure. Enable IKEv2's liveness check,\noften called dead peer detection, so a gateway notices a silent peer instead of\nsending into a black hole.\n\n**Connected becomes trusted.** On many remote-access setups a laptop on the VPN is treated as if\nit sat in the office, so one stolen credential reaches everything on that subnet. Filter what\neach VPN client can reach at the gateway, keep authentication on the services behind it, and\ndecide deliberately whether name lookups and internet traffic go through the tunnel or around it.\n\n## Further reading\n\n- [RFC 4026, section 3.10](https://www.rfc-editor.org/rfc/rfc4026#section-3.10) — the IETF's\n  generic definition of a VPN, and the note that encryption lies outside the working groups'\n  charters.\n- [WireGuard: Next Generation Kernel Network Tunnel](https://www.wireguard.com/papers/wireguard.pdf)\n  — the design paper: cryptokey routing, the handshake and the timers behind rekeying.\n- [RFC 4301](https://www.rfc-editor.org/rfc/rfc4301) — the security architecture for IP that\n  every IPsec implementation follows.\n- [RFC 7296](https://www.rfc-editor.org/rfc/rfc7296) — IKEv2, including traffic selector\n  narrowing, lifetimes as local policy and the liveness check.\n- [RFC 4364](https://www.rfc-editor.org/rfc/rfc4364) — BGP/MPLS IP VPNs, the carrier kind, with\n  overlapping address spaces and no cryptographic privacy.\n\n\u003chttps://engineer.company/glossary/vpn/\u003e\n","date_modified":"2026-11-09T21:50:25Z","description":"VPNs for joining offices, clouds and remote data sources: WireGuard or IPsec, what a tunnel really costs to run, and why most outages are about routing.","formats":{"gemtext":"https://engineer.company/glossary/vpn/index.gmi","gopher":"https://engineer.company/glossary/vpn/gophermap","html":"https://engineer.company/glossary/vpn/","json":"https://engineer.company/glossary/vpn/index.json","markdown":"https://engineer.company/glossary/vpn/index.md","pdf":"https://engineer.company/glossary/vpn/index.pdf"},"kind":"page","language":"en","title":"What is a VPN?","url":"https://engineer.company/glossary/vpn/","version":1}