IPSec VPN Tunnel Creation

What is IPSec?

IPsec (Internet Protocol, secure) is a group of protocols that are used together to set up encrypted connections between devices.

How does IPsec work?

IPsec connections include the following steps:

Keys are necessary for encryption; a key is a string of random characters that can be used to “lock” (encrypt) and “unlock” (decrypt) messages. IPsec sets up keys with a key exchange between the connected devices, so that each device can decrypt the other device’s messages.

Packet headers and trailers: All data that is sent over a network is broken down into smaller pieces called packets. Packets contain both a payload, or the actual data being sent, and headers, or information about that data so that computers receiving the packets know what to do with them. IPsec adds several headers to data packets containing authentication and encryption information. IPsec also adds trailers, which go after each packet’s payload instead of before.

IPsec provides authentication for each packet, like a stamp of authenticity on a collectible item. This ensures that packets are from a trusted source and not an attacker.

IPsec encrypts the payloads within each packet and each packet’s IP header (unless transport mode is used instead of tunnel mode: see below). This keeps data sent over IPsec secure and private.

Encrypted IPsec packets travel across one or more networks to their destination using a transport protocol. At this stage, IPsec traffic differs from regular IP traffic in that it most often uses UDP as its transport protocol, rather than TCP. TCP, the Transmission Control Protocol, sets up dedicated connections between devices and ensures that all packets arrive. UDP, the User Datagram Protocol, does not set up these dedicated connections. IPsec uses UDP because this allows IPsec packets to get through firewalls.

At the other end of the communication, the packets are decrypted, and applications (e.g. a browser) can now use the delivered data.

IKE Phases

A bidirectional ISAKMP SA is established between peers to provide a secure management channel (IKE in main or aggressive mode)

Two unidirectional IPsec SAs are established for data transfer using separate keys (IKE quick mode)

What protocols are used in IPsec?

In networking, a protocol is a specified way of formatting data so that any networked computer can interpret the data. IPsec is not one protocol, but a suite of protocols. The following protocols make up the IPsec suite:

If you would like to know more about this subject or others, leave a comment below with you questions for the folks at Functionkey, Inc.