Skip to main content

Documentation 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.conf is the primary configuration file for strongSwan’s swanctl frontend. It defines IKE connections, virtual IP pools, authentication secrets, and certificate authority settings. File location: /etc/swanctl/swanctl.conf
Additional configuration files can be included using include conf.d/*.conf at the end of swanctl.conf, keeping large configurations modular.

Top-level sections

SectionPurpose
connectionsIKE connection definitions
poolsVirtual IP address pools
secretsPSKs, EAP passwords, and private key passphrases
authoritiesCertificate authority settings

connections

The connections section contains one subsection per IKE connection. Each subsection name becomes the connection’s identifier.

IKE parameters

ParameterDefaultDescription
version0IKE version: 1 for IKEv1, 2 for IKEv2, 0 accepts both and initiates with IKEv2
local_addrs%anyLocal address(es) for IKE communication (IP, DNS name, CIDR, or range)
remote_addrs%anyRemote address(es) for IKE communication. At least one specific address is required to initiate
local_port500Local UDP port. Port 500 enables automatic float to 4500 for NAT traversal
remote_port500Remote UDP port. Port 500 enables automatic float to 4500 for NAT traversal
proposalsdefaultComma-separated IKE algorithm proposals. default selects safe, interoperable algorithms
vipsVirtual IPs to request via configuration payload. 0.0.0.0 or :: requests any address
poolsComma-separated list of named pools to assign virtual IPs from
rekey_time4hSchedule IKE rekeying. Refreshes key material without rechecking credentials
reauth_time0sSchedule full IKE reauthentication. Disabled by default
dpd_delay0sInterval for liveness (DPD) checks using IKEv2 INFORMATIONAL or IKEv1 R_U_THERE
mobikeyesEnable MOBIKE on IKEv2 connections for client mobility and multi-homing
fragmentationyesIKE fragmentation: yes, accept, force (IKEv1 only), or no
uniquenoUniqueness policy: no, never, keep, or replace
send_certifaskedWhen to send certificate payloads: ifasked, always, or never

local and remote auth sections

Each connection has one or more local and remote subsections defining authentication rounds. Use a suffix (e.g. local-1, local-2) for multiple rounds.
ParameterDefaultDescription
authpubkeyAuthentication method: pubkey, psk, eap, eap-md5, eap-mschapv2, xauth
certsComma-separated certificate files for authentication (relative to /etc/swanctl/x509/ or absolute)
idIKE identity. Must match the certificate subject or subjectAltName when using pubkey
eap_idEAP identity sent during EAP-Identity exchange
xauth_idXAuth username
For IKEv2 multi-round EAP (RFC 4739), define multiple local and remote sections with unique suffixes. For IKEv1 XAuth, add a second round with auth = xauth after the initial pubkey or psk round.

children subsection

Each connection contains a children subsection with one entry per CHILD_SA (IPsec SA). The subsection name becomes the CHILD_SA identifier.
ParameterDefaultDescription
local_tsdynamicLocal traffic selectors. dynamic uses the tunnel outer address or virtual IP
remote_tsdynamicRemote traffic selectors
modetunnelIPsec mode: tunnel, transport, beet, iptfs, pass, or drop
start_actionnoneAction after loading config: none (manual), trap (on-demand), start (immediate), or trap|start
close_actionnoneAction when remote closes CHILD_SA: none, trap, or start
dpd_actionclearAction on DPD timeout: clear, trap, or restart
esp_proposalsdefaultESP algorithm proposals
rekey_time1hSchedule CHILD_SA rekeying
life_timerekey_time + 10%Hard CHILD_SA lifetime before closing
inactivity0sClose CHILD_SA after this period of inactivity. 0 disables the check
updownScript to invoke on CHILD_SA up/down events

pools

The pools section defines named virtual IP address pools. Connections reference pools by name using the pools parameter.
ParameterDescription
addrsCIDR subnet or range (<from>-<to>) of addresses to allocate
dnsComma-separated DNS server addresses to push to clients
nbnsComma-separated NBNS/WINS server addresses
See Virtual IP Pools for full pool configuration details.

secrets

The secrets section stores credentials for IKE/EAP authentication and private key decryption.
Storing private key passphrases in swanctl.conf provides no real security benefit over unencrypted keys. Either store keys unencrypted or enter passphrases manually when running swanctl --load-creds.

Secret types

PrefixPurpose
ikeIKE pre-shared key (PSK)
eapEAP or XAuth password
xauthAlias for eap
ntlmNT hash for EAP-MSCHAPv2
privatePassphrase for a key in the private/ directory
rsaPassphrase for a key in the rsa/ directory
ecdsaPassphrase for a key in the ecdsa/ directory
pkcs8Passphrase for a PKCS#8 key
pkcs12Passphrase for a PKCS#12 bundle
ppkPost-quantum preshared key (PPK)
Each secret subsection contains:
  • secret — the secret value (plain string, 0x-prefixed hex, or 0s-prefixed Base64)
  • id (or id-1, id-2, …) — identity the secret belongs to

authorities

The authorities section defines certificate authority trust anchors and associated metadata.
ParameterDescription
cacertCA certificate file (relative to /etc/swanctl/x509ca/ or absolute path)
crl_urisComma-separated CRL distribution point URIs (LDAP, HTTP, or file)
ocsp_urisComma-separated OCSP responder URIs
cert_uri_baseBase URI for Hash-and-URL certificate exchange (IKEv2)

Complete example

The following example configures a roadwarrior server with certificate authentication in the first round and EAP-MSCHAPv2 in the second round.
swanctl.conf
connections {
    rw {
        version       = 2
        local_addrs   = 192.0.2.1
        remote_addrs  = %any
        pools         = rw-pool

        local {
            auth  = pubkey
            certs = server-cert.pem
            id    = server.example.org
        }
        remote {
            auth   = eap-mschapv2
            eap_id = %any
        }

        children {
            rw {
                local_ts     = 10.1.0.0/16
                remote_ts    = dynamic
                mode         = tunnel
                start_action = none
                esp_proposals = aes256gcm16-prfsha256-ecp256
                rekey_time   = 30m
            }
        }
    }
}

pools {
    rw-pool {
        addrs = 10.3.0.0/24
        dns   = 10.1.0.1
    }
}

secrets {
    eap-alice {
        id     = alice
        secret = "correct-horse-battery-staple"
    }
    eap-bob {
        id     = bob
        secret = "hunter2"
    }
}

authorities {
    vpn-ca {
        cacert   = ca-cert.pem
        crl_uris = http://crl.example.org/vpn-ca.crl
    }
}

include conf.d/*.conf