Libreswan Documentation

Logo

Libreswan's Online Documentation

View the Project on GitHub libreswan/libreswan.github.io

Support
FAQ Common Error Messages
History
Implemented Standards
Kernel Support
HOWTO Additional ipsec.conf documentation
AWS Mesh
brendans Road Warrior Setup at Home
Configuration examples
Confuse !?@: github wiki
Enterprise cloud encryption
Entropy matters
EoIP shared ethernet LAN using IPsec
High Availability Fallover VPN in AWS
Host to host VPN
Host to host VPN with PSK
Libreswan as client to a Cisco ASA or VPN3000 server
Microsoft Azure configuration
Migrate from IKEv1 DPD to IKEv2 LIVENESS
Opportunistic IPsec
Opportunistic IPsec using LetsEncrypt
Pluto and DNSSEC
Read status output
Route based VPN
SElinux and Labeled IPsec VPN
Subnet extrusion
Subnet to subnet using NAT
Subnet to subnet VPN
Subnet to subnet VPN with PSK
Unauthenticated Opportunistic IPsec
Using Apache to serve PKCS
Using NSS Hardware Tokens
Using NSS with libreswan
VPN server for remote clients using IKEv2
VPN server for remote clients using IKEv2 split VPN
GSoC 2027 Code Project Ideas DRAFT
Contributor Guidance DRAFT
Completed Projects 2026 RFC 9593 Announcing Supported Authentication Methods in IKEv2
2026 Improve the ACQUIRE to IKE policy lookup
2026 Add HOST TO HOST Support on BSD
2021 RFC 8420 Add EdDSA Signature Authentication Support to IKEv2
2020 Session Resumption
2020 IKEv2 Interop testing with OpenBSD
2020 IKE Intermediate Exchange
2019 Libreswan Opportunistic IPsec using LetsEncrypt
2018 RSA PSS Support in compliance with RFC 7427 and RFC 8247
2018 RFC 7427 Add ECDSA Signature Authentication Support to IKEv2
2018 RFC 5685 Redirect Mechanism
2018 Managing Interface
2017 TCP encapsulation of IKE and IPsec
2017 RFC 7427 Add Signature Authentication Support to IKEv2
2017 Postquantum Preshared Keys
Presentations
IRC
Hacking Documentation
Git, GitHub, and Pull Requests
Merging GitHub Pull Requests
Programming Conventions
Testing Docker
KVM 1. Setup The Host
2. Configure Testing
3. Compile Libreswan
4. Test Libreswan
5. Accessing The Console
6. Maintenance and Internals
Bisecting
Debugging Pluto
Logging In Using SSH
Performance
Running A Custom Kernel
Running A Single Test
Running In The Background
Setup a Web Server
Testing Old Branches
Updating Test Results
Namespace Magic
Namespaces
Topology
Internals 3.14 X509
Benchmarking and Performance testing
Cipher suites and algorithm support
Cloud OE ideas
Compiling with AddressSanitizer
Compliance of RFC 7427 Signature Authentication in IKEv2
Coverity
Cryptographic Acceleration
Developer links strongswan android
Discouraged or forbidden C functions
IKEv2 Child SA
IKEv2 CP and EAP support
Introduction
Libreswan xfrm kernel support
Logging cleanup
New OE
Pluto
Pluto packet processing
Proposed ipsec ca command
Retransmit timings
Road Map
SAref code
Setting up system for debug logging
stf status
Testing 2017 Next Generation
Unbound
Uncrustify
Use Cases and Requirements document for ECC ECDSA support
Use Cases and Requirements document
XFRM Interface Development Notes
XFRM pCPU
XFRM pCPU RSS
Security Crypto boundary and certification
Libreswan and Heartbleed
Libreswan and TunnelCrack
Reporting a Vulnerability
Vulnerabilities
Meetups 2013 Helsinki
2014 San Francisco
2014 Toronto
2018 Toronto
Obsolete HOWTOs IKEv1 XAUTH with FreeOTP and FreeIPA
IKEv1 XAUTH with Google Authenticator One Time Passwords
Route based VPN using VTI
Testing Namespace
VPN server for remote clients using IKEv1 with L2TP
VPN server for remote clients using IKEv1 XAUTH with Certificates
VPN server for remote clients using IKEv1 XAUTH with PSK

IKEv1’s DPD (Dead Peer Detection) and IKEv2’s LIVENESS mechanism are very different beasts. But so is how Libreswan v3/v4, and v5 implemented these features.

Consequently when migrating from a v3 or v4 Libreswan configuration using IKEv1 and DPD, to a v5 Libreswan configuration using IKEv2 and LIVENESS, both differences are at play.

Why was DPD seemingly renamed to LIVENESS?

Because the very different mechanism is confirming that the other end is still alive. The IKEv2 RFC puts it this way:

If there has only been outgoing traffic on all of the SAs associated with an IKE SA, it is essential to confirm LIVENESS of the other endpoint to avoid black holes. If no cryptographically protected messages have been received on an IKE SA or any of its Child SAs recently, the system needs to perform a LIVENESS check in order to prevent sending messages to a dead peer. (This is sometimes called “dead peer detection” or “DPD”, although it is really detecting live peers, not dead ones.) Receipt of a fresh cryptographically protected message on an IKE SA or any of its Child SAs ensures LIVENESS of the IKE SA and all of its Child SAs.

IKEv1 vs IKEv2

(in the below “parent” and “child” are used, while they are not part of the RFCs, they hopefully help clarify relationships)

In IKEv1, a “child” IPsec SA can out-live the “parent” ISAKMP SA used to create it (i.e., the “child” IPsec SA can be orphaned). In IKEv2, a “child” Child SA can never out-live the “parent” IKE SA used to create it. Consequently, deleting an IKEv2 “parent” IKE SA implicitly deletes all children.

In IKEv1, a “child” IPsec SA needing to exchange control messages with its peer when there’s no “parent” ISAKMP SA, must first create the “parent” ISAKMP SA. In IKEv2 that can never happen, “child” Child SA needing to exchange control messages with its peer always has its “parent” IKE SA available.

In IKEv1, each control exchange between two “parent” ISAKMP SAs is performed independently, this means that the timeout of one exchange does not necessarily mean that the “parent” ISAKMP SA has failed. In IKEv2, the control exchanges between two “parent” IKE SAs are serialized, this means that a timeout of the current exchange means that the “parent” IKE SA has failed, and should be deleted (which, per above, includes all “children”).

The consequence is that:

As a result:

IKEv2 uses retransmit-timeout= not dpdtimeout=

With IKEv2, should any exchange (including LIVENESS) take longer than retransmit-timeout to complete, then the connection is declared dead.

What happens next is described below.

When migrating, set the IKEv2 connection’s retransmit-timeout= to the smaller of the IKEv1 connection’s dpdtimeout= or retransmit-timeout=.

Historic note: it would appear that old code required both dpddelay= and dpdtimeout= to be non-zero before IKEv2 LIVENESS was enabled (even though the value dpdtimeout= was meaningless and being ignored).

dpdaction= was obsoleted

Instead what happens when a connection fails is determined by the UP and ROUTE (ONDEMAND) policy bits.

dpdaction=restart is replaced by policy UP. dpdaction=hold is replaced by ROUTE (ONDEMAND). dpdaction=clear is replaced by failure-shunt=none?

These changes apply to both IKEv1 and IKEv2.

Historic note: dpdaction= never fully described what was needed to manage a connection. For instance, dpdaction=clear didn’t specify what action to take once the (cough) clear was cleared.

a connection with policy UP, tries to say UP

In v5, when an established connection with policy UP (auto=up, ipsec up conn) fails, it will commence revival:

Either outbound traffic, or the retry timer will cause the connection to start negotiation:

Once the connection establishes:

Should the negotiation fail, then the above restarts (but with a larger revival timer).

This behaviour replaces dpdaction=restart.

a connection with policy ROUTE (ONDEMAND), goes back to ROUTE (ONDEMAND)

In v5, when established connection with policy ROUTE (ONDEMAND) (auto=route, ipsec route conn) fails, it goes back to goes back to ROUTE (ONDEMAND):

Outbound traffic will then cause the connection to start negotiation:

Once the connection establishes:

Should the negotiation fail, then the connection goes back to on-demand.

IKEv2 honours dpddelay=

The dpddelay determines how long before Pluto suspects a connection has failed, and initiates either a DPD or LIVENESS check.

Remember, with IKEv2, any recent successful exchange serves to confirm LIVENESS. And there’s no point queuing a LIVENESS exchange when there’s already an exchange outstanding.