16.4. VPN
Table of Contents
Introduction
A Virtual Private Network, usually called a VPN, is a way to create a secure, private connection over an untrusted network such as the public internet. Instead of sending your traffic in clear form from point A to point B, a VPN wraps that traffic in encryption, adds authentication, and often hides internal addresses from outsiders. In networking, VPNs are a central tool for protecting data in transit, especially between sites or for remote workers connecting back into a company network.
This chapter focuses on what makes VPNs unique in network security: the idea of a trusted “tunnel” across an untrusted path, how that tunnel is created and protected, and the typical real world uses and trade offs of VPNs.
Core Idea of a VPN Tunnel
At the heart of any VPN is the concept of a tunnel. The term “tunnel” does not refer to a physical path. It is a logical, virtual path created between two endpoints, such as two routers, or a laptop and a VPN gateway. All traffic that uses the VPN is first encapsulated inside a new packet, then is encrypted, and finally is sent across the internet to the other endpoint, which decrypts and decapsulates it.
You can think of it as putting a letter into a locked box. Outsiders can move the box from sender to receiver, but cannot read or alter the letter inside without the key. The untrusted network only sees the outer box, not the original content.
A simple view of data flow through a VPN tunnel is:
- Original packet is created by the sending device, for example from a remote laptop to an internal company server.
- VPN software or hardware wraps this packet inside another packet that uses VPN specific headers.
- The wrapped packet is encrypted.
- The encrypted packet is sent across the public network to the VPN peer.
- The peer decrypts the outer packet, removes the VPN headers, and then forwards the original packet inside the private network.
The result is that devices on each private side behave as if they were directly on the same local network, even though their traffic crossed the internet.
Key Properties Provided by VPNs
VPNs exist to add specific security properties to network traffic as it crosses untrusted segments. The exact details depend on the protocol and configuration, but the common goals are similar.
First, VPNs attempt to provide confidentiality. This is protection of the data from being read by anyone other than the intended peers. Strong encryption algorithms are used to scramble the content so that captured traffic appears as random data.
Second, VPNs aim to ensure integrity. Integrity means that if data is modified in transit, accidentally or by an attacker, the receiving side can detect that alteration. Integrity is usually implemented with cryptographic checksums. The receiver recomputes the checksum and compares it to the one in the packet. A mismatch signals tampering or corruption.
Third, VPNs rely on authentication. Before a tunnel is created, each side must prove who it is, for example by using pre shared keys, certificates, or usernames and passwords. This avoids sending private traffic to the wrong peer or to an impostor.
Fourth, many VPN setups add some level of anti replay protection. This is the ability to detect if an attacker captures a previous VPN packet and tries to resend it. Sequence numbers and windows are used so that old packets are rejected.
These properties can be summarized as follows.
| Property | Purpose |
|---|---|
| Confidentiality | Hides content of traffic from outsiders |
| Integrity | Detects tampering or corruption of packets |
| Authentication | Confirms identity of VPN peers or users |
| Anti replay | Blocks reuse of captured old packets |
A correctly configured VPN must at least provide confidentiality, integrity, and authentication for the traffic it protects. If one of these is missing or misconfigured, the VPN may give a false sense of security.
Tunneling vs Direct Connections
Without a VPN, traffic typically flows directly from the source host to the destination host using normal routing. Each router along the path sees the real source and destination IP addresses, and if the data is not encrypted at a higher layer, the contents are visible. With a VPN, the path looks different.
A VPN creates an additional, virtual layer of addressing and routing on top of the existing network. Hosts send traffic to a logical gateway, often a VPN client or gateway device. That device then encapsulates and encrypts the traffic, and sends it to the VPN peer as the next hop. The original packet, with its internal private addresses, travels inside this outer encrypted packet.
This layering allows two significant features. First, private IP addresses from different sites can be used and kept hidden from the public internet. Second, security policies can be applied easily at the VPN endpoints, since all protected traffic must pass through those endpoints.
The logical flow can be thought of as two routes for each packet. One is the inner route, from the original source to the intended destination inside the private networks. The other is the outer route, from one VPN endpoint to the other across the public network. Routers in the public network only care about the outer route, and cannot see or process the inner route information.
Common Types of VPNs
VPNs are often categorized based on what they connect and how users or devices join the private network through them. For beginners, the most important categories are remote access VPNs and site to site VPNs. There are also more modern variations such as clientless approaches and per application VPNs.
A remote access VPN connects an individual user or device to a private network from a remote location. The user runs VPN client software on a laptop, phone, or other device. When the client connects to the VPN gateway, it creates a secure tunnel. The user is then able to reach internal resources as if directly connected to the company network. This type is widely used for home workers, travelers, or administrators on call.
A site to site VPN connects two or more networks rather than individual devices. Typically, VPN capable routers or firewalls at each location create a tunnel between the sites. Once the tunnel is established, internal devices often do not need any special software. They simply send traffic to remote site addresses, and the local gateway decides whether to send it through the VPN tunnel or out to the internet in the normal way. Site to site VPNs are common for linking branch offices to a main office.
Some organizations use hub and spoke VPN topologies, where branch sites connect back to a central hub. Others use partial or full mesh of tunnels between many sites. The routing decisions that determine how traffic moves between these sites are handled by the gateways and depend on network design.
Clientless VPN is another pattern where users access internal applications through a web browser, often using technologies such as SSL portals. In this case, a full network tunnel might not be created. Instead, specific applications or web services are made available. This can simplify access and limit exposure.
Per application VPNs, common on mobile devices, direct only selected application traffic into the VPN, while other apps continue to use the normal internet connection. This avoids sending unrelated traffic through the corporate tunnel, which can reduce load and improve privacy.
Tunneling and Encapsulation in VPNs
Encapsulation is central to how VPNs work, but within VPNs it has a specific flavor known as tunneling. In general, tunneling means wrapping packets of one protocol inside packets of another protocol so that they can travel across a network that does not natively support the original protocol or addresses.
For VPNs, the most typical case is IP inside IP. The inner packet uses source and destination addresses from private networks, while the outer packet uses public addresses of the VPN gateways. The inner packet is the real conversation. The outer packet is just a secure envelope for transport over the internet.
Several tunneling mechanisms exist. Some VPN protocols use techniques such as UDP encapsulation. Others use raw IP protocols. The choice affects how the traffic passes through NAT devices and firewalls, and what ports need to be opened.
It is useful to think of the VPN as adding another virtual network interface to the system. Traffic that is destined for the remote private network is sent out this virtual interface, where it is captured by the VPN software, encapsulated, and encrypted. Normal internet traffic may continue to use the physical interface without using the VPN, depending on configuration.
Split Tunneling vs Full Tunneling
A significant configuration choice for VPNs, especially for remote access, is whether to use split tunneling or full tunneling. This choice has a direct impact on both security and performance.
In a full tunnel configuration, all traffic from the VPN client is sent through the VPN tunnel. This includes traffic destined for the internal private network and traffic destined for the public internet. The VPN gateway becomes the default route for the client. From the client perspective, everything goes “through the company first”. This can give the organization more control and visibility, but also increases load on the VPN gateway and may slow down non corporate traffic.
In split tunneling, only traffic intended for specific private networks is sent over the VPN. Other traffic continues to use the local internet connection directly. This improves performance and reduces gateway bandwidth usage. However, it also introduces risks. For example, an infected device could have a path to both the internet and the corporate network at the same time, which can aid attackers in moving between them.
The trade off between security and efficiency is often handled by policy. High security environments tend to favor full tunnels. Less sensitive environments might accept split tunneling with compensating controls such as strong endpoint security.
Authentication and Identity in VPNs
VPNs depend critically on sound authentication. Before a tunnel is brought up, the VPN endpoints must agree on who they are talking to, and users may also need to authenticate to gain access to resources.
At the device or gateway level, VPNs often use keys or digital certificates. Pre shared keys are shared secrets configured on both sides. Certificates rely on a public key infrastructure to verify identity. Device authentication ensures the tunnel is formed only between trusted equipment.
On top of device authentication, many remote access VPNs perform user authentication. This can involve usernames and passwords, tokens, smart cards, or multifactor approaches. The user identity can then be used for authorization decisions, such as what internal networks and resources that user is allowed to reach.
It is important that these identities are bound directly to the VPN session. When the user logs out or the session expires, the tunnel is torn down or restricted. Idle timeouts and session lifetimes are common features in VPN systems.
VPN Performance Considerations
While VPNs add security, they also introduce overhead. Encryption and decryption consume CPU resources. Encapsulation adds extra headers, which slightly increase packet size. Routing all traffic through a central gateway can add additional path length and potential bottlenecks.
These factors mean that VPN design must consider bandwidth, latency, and processing capacity. For example, a heavy site to site VPN between data centers needs devices with enough hardware acceleration to handle encryption at high speeds. A poorly sized VPN gateway can become a chokepoint.
Packet size is another practical factor. VPN encapsulation increases each packet’s total size. If this pushes packets beyond a path’s maximum transmission unit, they may need to be fragmented or adjusted. This can affect throughput and requires careful tuning of MTU or use of path MTU discovery.
Quality of service and traffic prioritization can also be relevant. If business critical traffic shares the same VPN tunnel with bulk data or less important streams, the VPN endpoints must enforce policies to ensure important flows are not starved.
Typical Use Cases for VPNs
In real networks, VPNs appear in several repeating patterns. One major use is remote work. Employees at home or on the road connect securely to their company network. The VPN client enforces corporate security policies and gives them safe access to internal systems.
Another widespread use is secure site interconnection. Branch offices, warehouses, and small remote locations can be connected to headquarters without the cost of dedicated private lines. The VPN tunnels over the public internet, while encryption maintains confidentiality and integrity.
Third party access is also a frequent scenario. Business partners may be given restricted VPN connections into certain internal systems. These connections often use a combination of filtering and segmentation on top of the VPN to limit exposure.
Cloud connectivity is an increasingly common application. Organizations establish VPN tunnels between on premises networks and their virtual private clouds. This allows extension of internal address spaces into cloud environments using secure tunnels, so workloads in the cloud can behave like another site in the corporate network.
VPNs can also be used for privacy and censorship avoidance in some contexts. In such setups, users connect to a VPN provider, and their public IP appears to be that of the provider’s gateway. While this overlaps with security concepts, in enterprise networking the focus is usually on controlled access to organizational resources, not anonymous browsing.
Security Risks and Best Practices Specific to VPNs
Although VPNs are a security technology, they themselves can become a risk if not handled carefully. A VPN effectively extends the trusted boundary of a network. If a remote device or site is compromised, an attacker may use the VPN tunnel as a direct path into sensitive internal environments.
One risk is weak authentication. If pre shared keys are simple or reused, or if user accounts are poorly protected, attackers can try to guess or steal credentials and create their own tunnels. Another is outdated or misconfigured encryption, which can lead to weakened confidentiality or integrity.
Endpoint security is also critical. A secure tunnel from an infected laptop is a secure tunnel for the attacker inside that laptop. For this reason, many organizations combine VPN access with device posture checks, such as verifying antivirus status, operating system version, or the presence of required security tools before granting full access.
From an architectural perspective, it is usually better to avoid giving VPN users broad, unfiltered access to the entire internal network. Instead, use segmentation and access controls so that the VPN tunnel provides only the minimum required reach. This reduces the potential blast radius if a VPN account or device is compromised.
Logging and monitoring of VPN sessions are equally important. Tracking who connected, from where, when, and what resources they accessed can help detect suspicious behavior quickly. Anomalies such as logins from unusual countries or at unusual times can trigger further investigations.
Conclusion
VPNs provide a secure, private path across untrusted networks by creating encrypted tunnels between devices or sites. They encapsulate internal traffic, protect confidentiality and integrity, and rely on strong authentication to connect only trusted peers and users. They enable remote access, interconnect sites, and link on premises networks to cloud resources.
At the same time, VPNs must be designed and operated carefully. Decisions such as remote access versus site to site, split tunneling versus full tunneling, and the scope of allowed access have a direct effect on both security and performance. When combined with sound authentication, endpoint protection, segmentation, and monitoring, VPNs become a powerful and reliable tool in modern network security.
Views: 66
KAHIBARO