An IPsec VPN is a virtual private network built on IPsec, a suite of IETF standards that encrypts and authenticates every IP packet between two endpoints, such as two office networks or a laptop and a company gateway. It works at the network layer, so it protects all traffic between those points regardless of the app, using IKEv2 to agree keys and ESP to encrypt the packets, usually in tunnel mode.
Key takeaways
- IPsec is a suite of protocols, not one protocol: IKE sets up the keys and ESP encrypts and authenticates each packet.
- Almost every IPsec VPN uses tunnel mode, which encrypts the whole original packet; transport mode only encrypts the payload.
- IPsec VPNs are the standard choice for site-to-site links and managed remote access, while consumer VPN apps often use other protocols.
Open your VPN app and you will often see a protocol choice: OpenVPN, WireGuard, IKEv2/IPsec. That last one is the oldest and most widely deployed of the three — and it is the protocol holding together most office-to-office connections on the internet.
What is an IPsec VPN?
An IPsec VPN is a virtual private network built on IPsec, a set of internet standards that encrypt and authenticate every IP packet between two points, such as two office networks or your laptop and your company's gateway.
IPsec stands for Internet Protocol Security. It is not one protocol but a suite of them, standardized by the Internet Engineering Task Force (IETF). The architecture in use today is described in RFC 4301, published in 2005, building on specifications that first appeared in 1995.
Because IPsec works at the network layer, it protects all traffic between the two endpoints, whatever app produced it — email, file sharing, voice calls and internal websites alike. That is its main strength and the reason businesses use it for site-to-site links. As Kaspersky's guide puts it, a VPN built on these protocols creates an encrypted tunnel between two endpoints, so anyone who intercepts the traffic sees scrambled data.
Do not confuse IPsec with a VPN service. IPsec is the machinery; a VPN is the private connection built with it. A consumer VPN app that offers IKEv2/IPsec is using the same machinery to link your device to one of its servers.
How does an IPsec VPN work?
An IPsec VPN works in four stages: the two endpoints authenticate each other, agree on encryption terms, encrypt and encapsulate every outgoing packet, and the receiving end checks each packet for tampering and decrypts it.
The first two stages are handled by IKE, the Internet Key Exchange protocol, with IKEv2 the version in common use today. The peers agree on algorithms, run a Diffie-Hellman key exchange so each side can calculate the same shared keys without ever sending them, and prove their identity with certificates, a pre-shared key or, for remote users, a username and password through EAP.
The result is a security association, or SA: a one-way agreement on the algorithms, keys and lifetime for traffic in one direction. Every tunnel needs at least two SAs, one each way. The keys are replaced on a schedule until the tunnel closes.
Then ESP, the Encapsulating Security Payload, takes over. Each packet is encrypted, given an integrity check and a sequence number, which stops altered or replayed packets from being accepted. Practically every IPsec VPN uses ESP, because it provides both encryption and authentication.
What are the parts of IPsec?
IPsec is built from three main protocols: ESP encrypts and authenticates packets, AH authenticates packets without encrypting them, and IKE sets up the keys both of them use. In practice, ESP and IKE do almost all the work.
ESP (Encapsulating Security Payload) encrypts the data and checks that nobody changed it on the way. It is the protocol that carries your traffic, using IP protocol 50, or UDP port 4500 when NAT traversal is in use.
AH (Authentication Header) authenticates packets and proves they were not altered, but does not encrypt them. It is rarely used in VPNs today because ESP already provides authentication alongside encryption.
IKE (Internet Key Exchange), in its current IKEv2 form, is the negotiation protocol. It authenticates the peers, agrees the encryption and integrity algorithms, exchanges keys and manages the security associations. Without IKE, the two sides would have to configure keys by hand.
Two supporting ideas matter too. A security association is the shared rulebook for one direction of a tunnel. A security policy is the rule that says which traffic must go through IPsec — everything, or only traffic to certain networks.
What is the difference between tunnel mode and transport mode?
Tunnel mode wraps the whole original packet, headers included, inside a new encrypted packet with a new outer header. Transport mode encrypts only the payload and keeps the original IP header. Almost every IPsec VPN uses tunnel mode.
In tunnel mode, anyone watching the link sees only the two gateways talking to each other, not which machines behind them are communicating. That is why it suits office-to-office links, office-to-cloud links and remote workers connecting to a company network.
In transport mode, the original header stays visible, so it suits two hosts protecting their own traffic directly — for example, two servers in a data centre talking to each other. It is faster and simpler, but it hides less.
| Tunnel mode | Transport mode | |
|---|---|---|
| What is encrypted | The whole original packet, header included | Only the payload |
| Visible to an observer | Only the two gateways | The original source and destination addresses |
| Typical use | Site-to-site VPNs, remote access VPNs | Host-to-host traffic, e.g. two servers |
| New outer header | Yes | No |
| Used by most VPNs? | Yes | No |
If you are choosing a VPN and the documentation mentions a mode at all, it will almost always be tunnel mode. Transport mode is a specialist choice for engineers protecting traffic between specific machines.
What are the two types of IPsec VPN?
IPsec VPNs come in two types depending on what sits at each end: site-to-site, which links two networks, and remote access, which links one device to a network. The protocol is the same; the shape of the connection differs.
Site-to-site IPsec VPN
A site-to-site VPN connects two networks permanently — a head office and a branch, or an office and a cloud network. A gateway at each end encrypts traffic between them, and users on either side notice nothing. This is the classic IPsec use case and the one it was designed for.
Remote access IPsec VPN
A remote access VPN connects one device — a laptop or phone — to a company network. The user runs VPN client software, authenticates, and gets an encrypted tunnel to the company gateway. Many businesses run this with IKEv2 and certificates, and most operating systems include a built-in IKEv2 client.
Remote access is where IPsec meets the consumer world. When a VPN app lists IKEv2/IPsec as a protocol option, it is offering a remote access IPsec VPN to its own servers. You can check what address the world sees once connected with our free what-is-my-IP tool.
Which ports and protocols does IPsec use?
IPsec uses UDP port 500 for IKE key exchange, UDP port 4500 for NAT traversal, and IP protocol 50 for ESP traffic. Firewalls that block these will break the tunnel, which is a common cause of VPNs that connect in the office but fail on hotel Wi-Fi.
NAT traversal, or NAT-T, matters because most home and hotel routers use network address translation. When either side sits behind NAT, IPsec switches to UDP port 4500 and wraps ESP inside UDP so the packets cross the router unaltered. Without NAT-T, ESP packets — which have no port numbers of their own — would be dropped.
That firewall sensitivity is one reason consumer VPN apps often prefer WireGuard or OpenVPN on UDP port 443, which looks like ordinary web traffic. IPsec is more likely to be blocked on restrictive networks, and it is also easier for a network operator to identify and throttle.
IPsec vs SSL VPN vs WireGuard: what is the difference?
IPsec protects all traffic at the network layer between two endpoints. An SSL VPN protects specific applications through a browser or client. WireGuard is a newer, simpler VPN protocol that does a similar job to IPsec with far less code.
| IPsec VPN | SSL VPN | WireGuard | |
|---|---|---|---|
| Layer | Network (Layer 3) | Application / transport | Network (Layer 3) |
| Protects | All traffic between endpoints | Specific apps or web traffic | All traffic between endpoints |
| Typical use | Site-to-site, managed remote access | Browser-based remote access | Personal VPNs, modern remote access |
| Client needed | Built into most operating systems | Browser, sometimes a client | WireGuard app or built-in support |
| Complexity | High — many options to configure | Medium | Low — small codebase |
| Firewall friendliness | Needs UDP 500/4500 open | Usually works over port 443 | Single UDP port, often 51820 |
None of these is universally best. IPsec wins where standards compliance, existing gateway hardware and site-to-site links matter. WireGuard wins where simplicity and speed matter. An SSL VPN wins where users only need a browser and a few web apps. Many organizations run two of them side by side.
For home Wi-Fi specifically, the protocol choice matters less than the network itself — see our guide on how to secure your Wi-Fi for the router settings that matter most.
Is an IPsec VPN safe?
Yes, an IPsec VPN is safe when it is configured with modern settings, and risky when it is not. The protocol itself is sound; the failures come from weak configuration, and the most common failure is a weak pre-shared key.
Weaknesses to watch for include:
- Weak pre-shared keys. A short or guessable shared secret can be cracked offline if an attacker captures the handshake. Use long random keys, or better, certificates.
- Outdated algorithms. Old encryption and hashing options such as DES and MD5 should never be used. Modern setups use AES encryption with SHA-256 or stronger integrity checks.
- Aggressive mode. The older IKEv1 aggressive mode exposes more information during setup and is best avoided; IKEv2 does not have this problem.
- Trust in the gateway. The VPN gateway can see your traffic, so a VPN only moves your trust from your internet provider to the VPN operator. Check for leaks too — our WebRTC leak test shows whether your real address slips out while connected.
On the positive side, IPsec has been reviewed, standardized and implemented for decades, and it is built into Windows, macOS, Linux, iOS and Android. That long history means the bugs are mostly found and fixed — unlike a brand-new proprietary protocol.
When should you use an IPsec VPN?
Use an IPsec VPN when you need a permanent link between two networks, managed remote access for staff, or a standards-based VPN that works with the gateway hardware you already own. Choose something else for casual personal browsing.
IPsec is the right call for a branch office that must always reach head-office systems, a cloud network that must connect to an on-premises data centre, or a company laptop fleet where IT already manages certificates and VPN profiles.
For personal privacy on public Wi-Fi, a consumer VPN app is usually simpler, and the protocol it picks — WireGuard, OpenVPN or IKEv2/IPsec — matters less than the provider's trustworthiness, its logging policy and whether it leaks. If you want the technical detail, Privacy Affairs' IPsec guide walks through the same setup steps and weak spots in depth.
The bottom line
An IPsec VPN is a VPN built on the IPsec protocol suite: IKEv2 negotiates the keys, ESP encrypts every packet, and tunnel mode hides the whole original packet inside a new one. It works at the network layer, so it protects everything between two points.
That makes it the default for site-to-site links and managed remote access, and a solid option for personal use when a VPN app offers it. Just remember the two things that decide whether it actually protects you: strong authentication, and a gateway operator you trust. Check your setup with our what-is-my-IP tool once you connect.
Frequently asked questions
What is an IPsec VPN in simple terms?
It is a VPN that uses the IPsec set of standards to encrypt all internet traffic between two points, such as your laptop and your office network, so anyone in between sees only scrambled packets.
Is IPsec a VPN?
No, IPsec itself is not a VPN. It is a suite of protocols for encrypting and authenticating IP traffic. A VPN is the private connection you build using those protocols.
What is the difference between IPsec and SSL VPN?
IPsec works at the network layer and protects all traffic between two endpoints, while an SSL VPN works at the application layer, usually through a web browser, and protects specific apps or web traffic. IPsec is common for site-to-site links; SSL VPNs are common for browser-based remote access.
What ports does IPsec use?
IKE key exchange uses UDP port 500. When either side is behind NAT, IPsec switches to UDP port 4500 and wraps the encrypted traffic inside UDP, a process called NAT traversal.
Is IPsec VPN safe?
Yes, when it is configured with strong modern settings: IKEv2, AES encryption, strong authentication with certificates or strong pre-shared keys, and regular key rotation. Weak pre-shared keys and outdated algorithms are the main risks.
What is IKEv2/IPsec?
IKEv2/IPsec is the combination most VPN apps mean when they list IPsec. IKEv2 is the key exchange protocol that authenticates the two sides and agrees encryption keys, and IPsec, through ESP, then encrypts the traffic.
Does IPsec hide my IP address?
In tunnel mode, yes, from anyone watching the link: they see only the two gateways talking. The VPN gateway itself can still see your traffic, so you are trusting the gateway operator.
When should I use an IPsec VPN?
Use one for a permanent link between offices, a connection from an office to a cloud network, or managed remote access where IT controls the client. For casual browsing privacy on a personal device, a consumer VPN app may be simpler.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against RFC 4301 (IPsec architecture), the IETF IPsec protocol suite, and vendor documentation from Kaspersky and Norton.
How we write and fact-check →