Networking

VPN — Virtual Private Network

IP's own applications section mentions this in one line: "encapsulating one IP packet inside another is the basic trick behind most VPN implementations." This page is that one line, expanded — how wrapping a whole packet, encrypted, inside another one makes a device on the other side of the internet behave as if it's plugged directly into a private network.

Quick reference
What it is
An encrypted, authenticated tunnel across an untrusted network, making a remote device appear as if it's directly on a private network.
Mental model
A private, armored corridor built through a public building — you're still physically inside the same building (the internet), but nothing outside the corridor can see or touch what's moving through it.
Key numbers
Common protocols: WireGuard (modern, minimal), OpenVPN (older, built on TLS), IPsec (network-layer, common for site-to-site links).
Reach for it when
A remote device needs to behave like it's on a private network, or two private networks need to be joined together across the public internet.

Encapsulation — a packet inside a packet

A VPN client doesn't send its traffic to the internet directly. Instead, it takes each entire original IP packet — headers and all — encrypts it, and wraps it inside a brand new outer IP packet addressed to the VPN server. That outer packet travels the public internet normally; only the VPN server can decrypt and unwrap it, recovering the original packet and forwarding it onward exactly as if it had originated from inside the private network all along.

The original IP packet is encrypted and wrapped inside a new outer IP packet addressed to the VPN server, which unwraps it and forwards the original packet onward as if it originated locally Outer IP packet — addressed to the VPN server, travels the public internet Encrypted payload Original IP packet — your real source, destination, and data The outer packet is all anyone on the public internet path can see — the real packet inside is opaque ciphertext until the VPN server decrypts it.
The same nested-box shape as Ethernet's encapsulation diagram — one more layer wrapped around an already-complete packet.

Site-to-site vs. remote-access

Site-to-site
Permanently joins two entire office/site networks together, router-to-router — no individual client software involved; every device at either site simply reaches the other site transparently.
Remote-access
An individual device (a laptop, a phone) connects into a private network from wherever it happens to be, running client software that establishes the tunnel on demand.

Real-world applications

Gotchas

Field notes