Network Tunnels: How One Packet Rides Inside Another
A network tunnel carries one communication inside another. It adds an outer layer that lets the traffic travel between tunnel endpoints, where that wrapping is added and removed. The wrapping can change how traffic crosses a network without, by itself, hiding the contents.
The mechanism is called encapsulation. A packet is a unit of network data with instructions about how to handle it. Those instructions sit in a header, which can include the packet's destination address.
Follow a Packet Through a VPN Tunnel
Two destinations on the same journey
Suppose two offices want to carry packets between their networks across an intermediate network. A packet originally addressed to a computer in the second office reaches the tunnel entrance in the first.
The entrance puts that whole packet inside a new one. The new, outer header names the tunnel exit as its destination. Equipment carrying the outer packet uses that address to move it toward the exit.
At the exit, the outer wrapping comes off. The original packet, still addressed to the office computer, is available for onward handling.
IP-in-IP is a documented example: an Internet Protocol packet carried inside another Internet Protocol packet. The Internet Engineering Task Force's encapsulation specification describes that outer-header journey and recovery of the original packet.
It's rather like putting an addressed envelope inside a parcel sent to a forwarding office. The outside address handles one part of the journey; the inside address becomes useful after unpacking. The tunnel doesn't require a dedicated physical wire between offices.
Carrying a packet and protecting it are separate jobs
Plain IP-in-IP encapsulation doesn't encrypt the inner packet. Encryption transforms readable information so that recovering it requires the right key, a secret data value used by the encryption method. Adding another header doesn't perform that transformation.
A tunnel can be combined with security protections. IPsec, short for Internet Protocol Security, is an architecture that provides several selectable services. These include encryption for confidentiality, checks for unauthorized changes, checks on where protected traffic came from and protection against accepting captured traffic replayed later.
The IPsec architecture also supports tunnel mode, with an inner packet and an outer IP header. The services chosen determine the protection; the word “tunnel” alone doesn't tell you which ones are present.
- Turn sketchy hotel and airport Wi-Fi into your own private network in minutes.
- Put every device you own behind your VPN at once, with nothing to install on each one.
- Block ads and trackers for everything connected with the flick of a switch.
What happens after the exit?
A virtual private network, or VPN, can use a protected tunnel to connect a device or network to another location. Its policy determines which traffic takes that route.
When protection runs between the tunnel entrance and exit, it covers that part of the journey. Traffic leaving the exit may need its own protection for the next part. An application can have separate encryption extending farther, but that's another layer with its own endpoints.
To understand a tunnel's reach, trace the wrapping: where it starts, where it comes off and where the original packet goes next.
Encapsulation: Why It Means Different Things in Code and Networks

IPsec: A Protected Route Between Networks

VPNs: Follow the Protected Connection to Its Exit

QUOTE:
"Amateurs hack systems, professionals hack people."
