In this scenario two security gateways moon and sun connect two private subnets through an IPsec tunnel. All traffic between the subnets is encrypted end-to-end.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.
Network topology
192.168.0.1) protects 10.1.0.0/16. Gateway sun (192.168.0.2) protects 10.2.0.0/16. The === link represents the encrypted IPsec tunnel over the public network.
Certificate files
Place the following files on each gateway before loading credentials:- moon
- sun
strongswanCert.pem must be present on both gateways so each peer can authenticate the other.
Configuration
- moon (192.168.0.1)
- sun (192.168.0.2)
Identity and authentication
Theid fields in the remote sections are the subjectDistinguishedNames (DNs) from the peer’s end-entity certificate. strongSwan extracts this value from the certificate automatically and matches it against the configured identity.
The DN string must match exactly what is encoded in the certificate, including field order and spacing. Use
pki --print --in peerCert.pem to inspect the exact DN.auth = pubkey, which means the daemon verifies the peer’s certificate signature against the trusted CA in /etc/swanctl/x509ca/.
Loading configuration and bringing up the tunnel
Traffic-triggered tunnel (start_action = trap)
With start_action = trap, strongSwan installs a kernel policy (trap) for the configured traffic selectors. The IKE negotiation is triggered automatically the first time a plaintext packet matches the selector — no manual initiation is needed.