A virtual private network (VPN) is a secure way to connect to a remote computer or network over the internet, allowing users to access otherwise unavailable resources. It is a private network that uses encryption technology to protect data traveling between two points, such as computers or a computer and a server. Companies commonly use VPNs to secure remote access to their internal networks and are also popular among individuals for protecting their privacy on the internet.

A VPN creates an encrypted tunnel between the user’s computer and the remote network. All data that passes through this tunnel is secured and encrypted, making it much more difficult for hackers to intercept. This also allows users to access websites and services that their local government or ISP may block. VPNs can also be used to spoof a user’s location, allowing them to access geo-restricted content.

When setting up a VPN, users have several options. They can use a dedicated VPN service or configure their own VPN using open-source software. The type of VPN protocol used can also vary depending on the security requirements and desired performance.


Before you proceed, you may find the following posts helpful:

  1. IPsec Fault Tolerance
  2. SSL Security
  3. Dead Peer Detection
  4. SDP VPN
  5. Generic Routing Encapsulation



Key VPNOverview Discussion Points:

  • Introduction to VPNs and what is involved.

  • Highlighting the details of Layer 2 and Layer 3 VPNs.

  • Critical points on IPsec and how it works.

  • Technical details on the encryption stages and the different IKE modes.

  • Technical details on NAT-T and IPsec.


  • A key point: Video on security issues with CDN providers

The following video provides information on security issues with proxy servers that happened with a CDN provider. You may find this helpful as a part of your VPNoverview research. This security bug was a cloud vulnerability & the CDN provider’s infrastructure was at fault. The CloudBleed Bug was a RAM Leak that caused the CDN reverse proxy servers to run past a buffer’s end and return memory containing private information during HTTP requests. Unfortunately, this was cached by the search engines, and some search engines still showed this cached information until they purged their caches.



Virtual Private Network ( VPNs ) is top-rated amongst businesses and individuals who access the Internet regularly and are provided by various suppliers. They are available as Layer 2 and Layer 3 technologies. They act as extensions, expanding private over public networks. Groups of different users share public networks; if privacy is required, encryption must be deployed to secure endpoint communication. The Internet is the most prevalent and widely known “public” network. In its simplest form, a VPNoverview, VPN connects two endpoints to form a logical connection. The connection methods used for traditional VPNs act as a foundation technology used for DMVPN and the  DMVPN phases.


Back to basics with VPNOverview

Concepts of VPN

A VPN allows users to expand a private network across an untrusted network. The term “Virtual” emphasizes that a logical private connection virtually extends the private network. A VPN can be secure or insecure. For a secure VPN, we can use IPsec. In addition, when IPsec VPNs are used, traffic will be protected to ensure that an observer cannot view the plaintext data.

Almost every operating system ships with an IPsec VPN client, and numerous hardware devices provide various IPsec VPN gateway functionality. As a result, IPsec VPNs are a popular choice now for secure connectivity over the Internet or for delivering secure communications over untrusted networks, such as the Internet.



Concepts of IPSec

IPsec (Internet Protocol Security) is a network security protocol that encrypts IP packets. It is used to protect data communications between two or more computers by providing authentication and encryption of the data. It is one of the world’s most widely used security protocols, as it is the de facto standard for protecting data in transit across the internet. It also secures private networks, such as those used by corporations and government agencies.

IPsec works by authenticating and encrypting each IP packet of a communication session. It uses two main protocols to provide this security: Authenticated Header (AH) and Encapsulated Security Payload (ESP). AH provides authentication and data integrity, while ESP includes encryption. The two protocols can be used together or separately to provide the desired level of security.

IPsec can secure various communication protocols, including TCP, UDP, and ICMP. It is also used to protect mobile devices, such as smartphones, which require secure communication between them and the network they are attached to. IPsec also provides an additional layer of security by providing access control. This means that only authenticated users can access the data. This is especially important when protecting sensitive information and corporate data.


Diagram: IPsec VPN. Source Wikimedia.


Concepts of IKEv1 vs IKEV2

IKEv1 and IKEv2 are two major versions of the Internet Key Exchange (IKE) protocol; both are used to create secure Virtual Private Networks (VPNs). IKEv1 was the original version, developed in 1998, and IKEv2 was released in 2005.

Both versions of IKE use the same cryptographic algorithms and protocols, but IKEv2 is the more secure version due to its additional features. For example, IKEv2 is capable of automatic re-keying, which IKEv1 does not support, and the IKEv2 protocol is implemented more structured and modularly than IKEv1. Additionally, IKEv2 has more advanced authentication methods, such as EAP and XAUTH, and supports the authentication of multiple peers.

IKEv2 is also more efficient than IKEv1, as it is designed to reduce the amount of data sent over the network. This helps to increase the speed of the VPN connection. Finally, IKEv2 is more resilient in the face of network issues and disruptions, as it supports the ability to reconnect automatically.

It is important to note that IKEv1 and IKEv2 have advantages and drawbacks. For example, IKEv1 is simpler to deploy and configure but is less secure than IKEv2. On the other hand, IKEv2 is more secure but may require more effort to set up.

Ultimately, it is essential to consider the network’s security requirements and the VPN connection’s desired performance when deciding between IKEv1 and IKEv2.


VPNoverview: Layer 3 and Layer 2 VPNs

Firstly, for a VPNoverview let’s start with the basics of Layer 2 and 3 VPNs. Layer 2 virtual private network: Frame Relay or ATM Permanent Virtual Circuits ( PVC ) utilize someone else’s public transport to build private tunnels with ( VC ) virtual circuits. A Virtual Private LAN Service ( VPLS ) network creates tunnels over Multi-Protocol Label Switched ( MPLS ) core. Ethernet VLAN or QinQ is also an example of a Layer 2 VPN. Layer 3 virtual private network: Generic Routing Encapsulation ( GRE ) tunnels and MPLS tunnels between Service providers and customers is an examples of a Layer 3 VPN.

Also, IP Protocol Security ( IPsec ) tunnels which is the focus of this post. The critical advantage of Layer 3 IPsec VPNs is the independence of the access method. You can establish a VPN if you establish IPv4 or IPv6 connectivity between two endpoints. VPNs do not require encryption, but encryption can take place if needed.


What is IP protocol security ( IPsec )?

IPsec is a suite of protocols to provide security services for IP packets at the network layer. IPsec creates P2P associations between tunnel endpoints. Authenticates and encrypts packets. A broad term that encompasses the following features;


vpn overview
Diagram: VPN overview

VPNoverview and encryption

In the next stage of this VPNoverivew, we will discuss encryption. VPNs encrypt packets with symmetric ciphers, e.g., DES, 3DES, and AES. Ciphers work with the concept of key exchange. In particular, the symmetric cipher key used to encrypt on one side is the same key to decrypt on another side. The same key is used at both endpoints.

Symmetric encryption contrasts with asymmetric encryption ( public key algorithms ), which utilizes separate public and private keys – one for encryption and another for decryption. The encryption key is known as the public key and is made public. The private key is kept secret and used for decryption.

Encryption takes plain text and makes it incomprehensible to unauthorized recipients. A matching key is required to decode the “incomprehensible” text into readable form. Decryption is the reverse of encryption. It changes the encrypted data back to plain text form. Encryption takes effect AFTER Network Address Translation ( NAT ) and Routing.


IPsec and ISAKMP

ASA uses ISAKMP negotiations and IPsec security features to establish and maintain tunnels for LAN-to-LAN and client-to-LAN VPNs. Tunnels are dynamically negotiated with control plane protocols, IKEv1/IKEv2, over UDP port 500. ISAKMP is a protocol that allows two VPN endpoints to agree and build IPsec security associations. ASA supports both ISAKMP version 1 and ISAKMP version 2. IKEv1 supports connections from legacy Cisco VPN clients, and IKEv2 supports the AnyConnect VPN client.

Two main phases for tunnel establishment. The first phase objective establishes and creates a tunnel. The second Phase governs traffic within the tunnel. ISAKMP security associations govern tunnel establishment, and IPsec security associations govern traffic within the tunnel.


Key elements agreed upon in Phase 1 before endpoints proceed to Phase 2


Phase 1 Establishes-preliminary tunnel; used to protect later ISAKMP negotiation messages.
Securely negotiate the encryption parameters for Phase 2.
Phase 1 results in ISAKMP SA
Phase 2 Creates the secure tunnel used to protect end-point data.
IPSEC SA is used to transport protected traffic.
Tunnel mode, AH** & ESP are negotiated.
Phase 1 results in IPSEC SA

**AH only support authentication and is therefore rarely used for VPN. AH can be used in IPv6 OSPFv3 for neighbor authentication.


KEY POINT: Phase 1 is bidirectional, and Phase 2 uses two unidirectional messages. Phase 2 ESP and AH cannot be inspected by default ASA policies, which may become problematic for stateful firewalls. Phase 1 uses IKE UDP and UDP, which are inspected by default.


IKEv1 vs IKEv2

The main difference between IKEv1 and IKEv2 is authentication methods. With IKEv1, both endpoints must use the same authentication method; the encryption method must be symmetric.

IKEv2 is more flexible and does not need symmetric authentication types—possible to have certificates at one end and pre-shared keys at the other end.

IKE initiator sends all of the policies through a proposal. It’s up to the remote end to respond, check its policies, and agree if the receiving policies are acceptable. Policies are matched sequentially. The first match was utilized with an implicit deny at the bottom. IKEv2 allows multiple encryptions and asymmetric authentication types for a single policy.


Two IKE modes; Main and aggressive mode

IKE has two modes of operation, Main Mode and Aggressive Mode.

Main Mode uses more ( 6 ) messages than Aggressive Mode and takes longer to process. It’s slower but protects the identity of communicating with peers.

Aggressive useless ( 3 ) messages it’s quicker but less secure. Aggressive mode lets people know the endpoint identity, such as an IP address or Fully Qualified Domain Name ( FQDN ). It does not wait for the secure tunnel before you exchange your identity, allowing flexible authentication.


NAT-T and IPsec

IPsec uses ESP to encrypt data. It does this by encapsulating the entire inner TCP/UDP datagram within the ESP header. Like TCP and UDP, ESP is an IP protocol, but unlike TCP and UDP, it does not have any port information. No ports prevent ESP from passing through NAT / PAT devices. Nat-T auto-detects transit NAT / PAT devices and encapsulates IPsec traffic in UDP datagrams using port 4500. By encapsulating ESP into UDP, it now has port numbers, enabling the pass-through of PAT/NAT gateways.

ISAKMP does not have the same problem, as its control plane already works on UDP. As with any data encryption, it is always important to compare what is on the market to keep your data safe.



Matt Conran
Latest posts by Matt Conran (see all)

3 Responses