This guide walks you through setting up a site-to-site IPsec VPN tunnel between two gateways using theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/strongswan/strongswan/llms.txt
Use this file to discover all available pages before exploring further.
swanctl command-line tool and the modern VICI configuration interface.
Prerequisites
- Linux kernel 4.5 or later (with
esp4,esp6, andxfrm_usermodules available) - strongSwan installed with
swanctland thecharondaemon running - X.509 certificates issued by a common CA for both gateways
Kernel modules (
esp4, esp6, xfrm_user) are loaded automatically when needed on most distributions. Run modprobe xfrm_user to load manually if required.Network topology
In this example, gateways moon and sun connect two private subnets through an encrypted IPsec tunnel:Configure gateway moon
Place the following credential files on moon:/etc/swanctl/swanctl.conf on moon:
/etc/swanctl/swanctl.conf
Configure gateway sun
Place the following credential files on sun:/etc/swanctl/swanctl.conf on sun:
/etc/swanctl/swanctl.conf
The identities (
id) are the Subject Distinguished Names from the peer’s end-entity certificate. The start_action = trap setting installs a policy that automatically initiates the tunnel when the first matching plaintext packet is seen.Bring up the tunnel
Run the following commands on both gateways after placing the configuration files.Load credentials
Load certificates, CA certificates, and private keys into the charon daemon:Expected output confirms the number of loaded certificates and keys:
Directory structure reference
The defaultswanctl configuration directory layout:
Next steps
VPN scenarios
Explore host-to-host, roadwarrior, and EAP authentication scenarios
PKI & certificates
Generate your own CA, issue certificates, and manage CRLs with the pki tool
swanctl commands
Full reference for all swanctl subcommands and options
swanctl.conf options
Complete reference for connection, pool, and secret configuration