VPN Field Guides [A]

IKEv2 field guide: a strongSwan gateway and clients that verify its identity

IKEv2/IPsec is a third path after the WireGuard and OpenVPN guides here. It is particularly useful when the client OS already has an IKEv2 integration. This example uses strongSwan's swanctl style on a Linux gateway and certificate-authenticated server identity. It does not tell a client to trust an arbitrary certificate warning or to use one shared password for a whole group.

Plan the gateway name before issuing a certificate. The name that the client enters, such as vpn.example.org, must appear in the gateway certificate's subjectAltName (SAN). The certificate needs the server-authentication role, a matching private key, and a chain trusted by each client. strongSwan's PKI Quickstart shows how to create a CA and issue the gateway certificate. Keep the CA private key away from the public gateway if possible, and protect the gateway key under /etc/swanctl. If using a private CA, install its CA certificate on each device through its supported trust-store workflow. Do not ask users to ignore a name mismatch.

Choose client authentication deliberately. strongSwan supports client certificates and EAP methods. For a mixed personal-device lab, its official EAP example uses a gateway certificate, client EAP identities and per-user secrets; choose a strong unique secret for each identity. With EAP-MSCHAPv2, authenticating the server's IKEv2 certificate is essential before sending the client password. Client certificates avoid shared passwords but add issuance, import and revocation work. Decide one method for the first client and confirm the platform supports it before distributing credentials.

On the gateway, install the distribution's strongSwan packages for swanctl/charon-systemd and the required EAP plugin. Use the official strongSwan connection example as the starting configuration in /etc/swanctl/swanctl.conf: a local section with auth = pubkey, the gateway certificate and id = your SAN name; a remote section with the chosen EAP method and eap_id = %any; a child security association whose local traffic selector covers the networks you intend to offer; and a non-overlapping address pool for clients. The strongSwan example's 0.0.0.0/0 and ::/0 selectors are for full tunneling and assume real IPv4 and IPv6 egress. If you only have IPv4 egress, do not copy its IPv6 pool or claim IPv6 protection. Put per-user EAP secrets in the secrets section with restrictive file permissions. Validate the resulting connection and loaded credentials with swanctl --load-all and swanctl --list-conns; inspect swanctl --list-sas after a client connects.

Permit UDP 500 and 4500 through the cloud and host firewalls. strongSwan uses NAT traversal with UDP 4500 when needed, and MOBIKE can also move traffic there. For full-tunnel internet access, configure forwarding and source NAT or a return route for the assigned client pool in the firewall manager you actually use. Keep a console recovery path while editing these rules. A successful IKE_SA and CHILD_SA says that authentication and tunnel setup worked; it does not prove that forwarded packets or DNS work.

On Windows, create a built-in IKEv2 VPN entry pointing to the exact gateway hostname, choose the authentication method your server configured, and ensure Windows trusts the issuing CA. strongSwan's Windows instructions explicitly require the hostname in SAN; for a private CA, follow its Local Machine trust-store procedure. On iOS and macOS, use the OS IKEv2 setup or a managed profile as appropriate, with the Server and Remote ID matching the gateway certificate. StrongSwan documents EAP-MSCHAPv2 and EAP-TLS support there. On Android, the maintained strongSwan VPN Client supports IKEv2 and checks the gateway name against SAN; it does not support PSK authentication. GrapheneOS uses Android's VPN framework, but check the selected profile's own VPN and DNS settings instead of assuming another profile's settings carry over.

Test from a phone and a desktop: inspect the negotiated IKE_SA/CHILD_SA and assigned address, reach a tunnel-side resource, reach a public address if this is full tunnel, then resolve a name with the intended DNS resolver. Repeat on Wi-Fi and mobile data and after a sleep/wake cycle. Test IPv6 separately. If authentication fails, compare the exact server name, SAN, CA trust, clock, EAP identity and method before changing cipher proposals. If the handshake works but websites do not, check pool routing, firewall/NAT and DNS. Record the client identity so you can disable one lost device without silently locking out everyone else.

Sources, checked 3 October 2026:
strongSwan EAP server example — https://docs.strongswan.org/docs/latest/interop/windowsEapServerConf.html
strongSwan PKI Quickstart — https://docs.strongswan.org/docs/latest/pki/pkiQuickstart.html
strongSwan swanctl.conf reference — https://docs.strongswan.org/docs/latest/swanctl/swanctlConf.html
strongSwan NAT traversal — https://docs.strongswan.org/docs/latest/features/natTraversal.html
strongSwan Windows CA trust — https://docs.strongswan.org/docs/latest/interop/windowsCaCert.html
strongSwan Android client — https://docs.strongswan.org/docs/latest/os/androidVpnClient.html
strongSwan iOS/macOS interoperability — https://docs.strongswan.org/docs/latest/interop/ios.html
GrapheneOS FAQ — https://grapheneos.org/faq

↑ 9

Debate

Comentarios

0

Aún no hay comentarios.

Escribir Únete para participar en la discusión.