strongSwan can be used as a practical alternative to FortiClient on Linux when the FortiGate remote-access VPN is configured for IPsec/IKEv2.
This configuration has been tested on Ubuntu 24.04 LTS. It uses IKEv2, a pre-shared key for the FortiGate gateway authentication and EAP-MSCHAPv2 for the user credentials.
Important: This setup is not officially supported by Fortinet. In this tested configuration, split routes pushed by the FortiGate are not automatically installed by the Linux client, so the remote networks must be configured manually using rightsubnet.
Install strongSwan
Install strongSwan together with the plugins required for EAP authentication and additional IPsec functionality:
Configure the FortiGate VPN Connection
Edit the strongSwan IPsec configuration:
Add the VPN connection:
leftsourceip=%config requests a virtual IP address from the FortiGate. The rightsubnet option defines which remote networks should be routed through the IPsec tunnel.
Configure Split Tunnel Networks
FortiGate-pushed routes were not automatically applied in this tested Linux setup. Add every network that must be reachable through the VPN manually:
Only traffic destined for these networks will use the VPN tunnel.
Configure the Pre-Shared Key and User Credentials
Edit the strongSwan secrets file:
Add the FortiGate pre-shared key and the EAP username/password:
Protect the Configuration Files
The VPN configuration contains authentication information and should only be readable by root:
Configure DNS Received from the VPN
If the FortiGate provides DNS servers to the VPN client, enable the strongSwan resolve plugin and configure the interface used by resolvconf:
Configure the file as follows:
Replace <PHYSICAL_INTERFACE_NAME> with the Linux interface used for the connection, for example:
Restart strongSwan After Configuration Changes
After changing the IPsec configuration, restart strongSwan and reload the secrets:
Connect to the FortiGate VPN
Bring the VPN tunnel up manually:
Disconnect the VPN:
Check VPN Status
Display the complete IKE and IPsec Security Association status:
After the tunnel is established, verify the virtual IP and installed routes:
Useful Troubleshooting Commands
If the tunnel does not establish, monitor the strongSwan logs while connecting:
Useful commands for checking the connection:
Important Notes
- This configuration was tested on Ubuntu 24.04 LTS.
- strongSwan is not an officially supported FortiClient replacement from Fortinet.
- The FortiGate must be configured with matching IKE, ESP, authentication and EAP parameters.
- Remote split-tunnel networks must be listed manually in rightsubnet in this tested setup.
- strongSwan is open-source software licensed under GPLv2 and can be used without FortiClient licensing.