Skip to main content
mswan
Explorer
Feb 13, 2026 5:01 PM UTC
Question

StrongSwan: Connecting to FortiGate IKEv2 IPSec VPN using PSK + EAP

Hello traveler, I'm assuming you've stumbled upon this post after using very specific search terms and are perhaps now at the end of your rope. I hope I can maybe be your last stop.

 

There's a lot that's going to depend on your own setup, such as which cipher suites you're using, your local and remote subnets, etc. I'm not posting this as a definitive guide to get your swanctl.conf perfect - I'm assuming you've already got it to a place where it "should be working".

 

My goal is instead to draw attention to the changes that took my tunnel creation getting totally dropped and ignored by the FortiGate after first contact, to it actually trying to authenticate. It was of course, very simple, but took me hours upon hours to finally get right.

 

The lynchpin was this: Set Remote auth to PSK. Set Local auth to EAP. Make sure Local is set to round 2, otherwise it sends your EAP credentials before it's asked and the Fortigate shrugs it off.

 

Note that on my FortiGate side, I'm not requesting a specific peer ID, which is why I have Local "id" set to blank below. If you, for instance, have FortiGate set to accept specific peer IDs (Configured in the Authentication section of the IPSec Tunnel configuration, under Peer Types) you can enter your peer ID here. I've confirmed this works.

 

Lastly, when connecting, make sure you're using the command:

sudo swanctl --initiate --child hq

If you initiate without specifying the child, it gets stuck at the end and will never fully complete.

 

Here's my exact StrongSwan config with all the identities changed -

swanctl.conf:

 

connections {   hq {     remote_addrs = hq.example.com     version = 2     vips = 0.0.0.0     proposals = aes128-aes256-sha256-modp2048-none     rekey_time = 86400     mobike = no      remote {       id = %any       auth = psk       }      local {       round = 2       auth = eap       id =        eap_id = remoteusername     }      children {       hq {         remote_ts = 0.0.0.0/0         local_ts = 0.0.0.0/0         esp_proposals = aes128-aes256-sha256-modp2048-none         rekey_time = 43200       }     }   } }  secrets {   ike-psk {     secret = 24Q8E61G632D2B1B   }   eap-remoteuser {     id = remoteusername     secret = P4ssw0rd   } }

 

 

9 replies

Stephen_G
Staff & Editor
Staff & Editor
Feb 16, 2026 1:05 PM UTC

Thank you for sharing this, mswan. You rock! It's greatly appreciated.

Stephen_G - Fortinet Community Team
luis_abreu
Explorer
Feb 27, 2026 9:18 PM UTC

Hello.

Great post.

Btw, any info on how to get it working when the user has MFA?  I'm assuming that swanctl won't be able to solve my issue, but any tips on how to solve this?

 

Thanks again.

mswan
mswanAuthor
Explorer
Feb 27, 2026 9:34 PM UTC

My experience is very limited to our implementation alone, but on ours, MFA is no problem at all.

 

The EAP portion of ours is connected to a local RADIUS server leverages EntraID to use SAML. AKA - After submitting user/password, It sends a notification to the associated user's cell phone for them to click "approve". Because the FortiGate handles that part, the login flow is no different than connecting via FortiClient. I initiate the StrongSwan connection which submits my credentials, get the notification on my phone while my VPN connection waits, then as soon as it's approved, it finishes setting up the tunnel.

 

If that doesn't sound similar to what you're doing, StrongSwan is very robust and I wouldn't doubt it's able to accommodate. I just have no idea how to help at that point unfortunately.

luis_abreu
Explorer
Feb 28, 2026 3:54 PM UTC

Hello again.

 

Our users are local users (ie, created on the Fortigate itself) and the token is being sent by email. Maybe there's a way for swanctl to prompt me for that token, but I couldn't managed to get it working. It seems to crash after username/password validation, when it receives some sort of result package from fortigate that it can't handle...interestingly, that crash (which I'm assuming is the gate soliciting the token) is enough for breaking the connection and the email with the token never gets sent. If I go to that user and remove the MFA validation, it works perfectly though...

New Member
Jul 23, 2026 9:22 AM UTC

 Ths your swanctl.conf Sample.

I followed the instructions, made a few adjustments to the settings, and was able to connect successfully.

Ubuntu 22.04 + StrongSwan(swanctl)5.9.5 + Fortigate 7.6.7 IPSecVPN IKEv2 PSK+EAP

 

connections {

FortiGate {

version = 2

remote_addrs = xxx.xxx.xxx.xxx

vips = 0.0.0.0

mobike = no

fragmentation = yes

rekey_time = 86400

proposals = aes128-sha256-ecp384,aes256-sha256-ecp384,aes128gcm16-prfsha256-ecp384,aes256gcm16-prfsha384-ecp384,chacha20poly1305-prfsha256-ecp384

local {
auth = eap-mschapv2
eap_id = username
}

remote {
auth = psk
id = %any
}

children {

vpn {

local_ts = 0.0.0.0/0
remote_ts = 0.0.0.0/0

esp_proposals = aes128-sha256-ecp384,aes256-sha256-ecp384,aes128gcm16-ecp384,aes256gcm16-ecp384,chacha20poly1305

rekey_time = 43200

mode = tunnel

start_action = none

dpd_action = restart

}
}
}
}

secrets {

ike {

secret = "EnterYourPSK"

}

eap-alex {

id = Username

secret = "Password"

}
}
include conf.d/*.conf

Fortiagte 7.6.7 IPSecVPN Setting

config vpn ipsec phase1-interface
edit "IPsecVPN_IN"
set type dynamic
set interface "a"
set ike-version 2
set peertype any
set net-device disable
set mode-cfg enable
set proposal aes128-sha256 aes256-sha256 aes128gcm-prfsha256 aes256gcm-prfsha384 chacha20poly1305-prfsha256
set comments "VPN: IPsecVPN_IN -- Created by VPN wizard"
set dhgrp 20 21
set eap enable
set eap-identity send-request
set wizard-type dialup-forticlient
set transport auto
set ipv4-start-ip 192.168.10.1
set ipv4-end-ip 192.168.10.20
set dns-mode auto
set ipv4-split-include "IPsecVPN_IN_split"
set save-password enable
set psksecret EnterYourPSK
next
end
config vpn ipsec phase2-interface
edit "IPsecVPN_IN"
set phase1name "IPsecVPN_IN"
set proposal aes128-sha1 aes256-sha1 aes128-sha256 aes256-sha256 aes128gcm aes256gcm chacha20poly1305
set dhgrp 20 21
set comments "VPN: IPsecVPN_IN -- Created by VPN wizard"
next
end

 

New Member
Nov 4, 2026 4:14 PM UTC

Hi everyone, I'm trying to configure this, and I have almost the same settings, but I can't connect. The only difference is `set authusrgrp “Remote Group”`, and I don't have `ipv4-split-include`.
strongSwan swanctl 5.9.5
FortiOS 7.6.8
Any ideas?

Risk and Resilience in the Age of AI. An OT Thought Leadership Summit for Houston's Critical Infrastructure Leaders. Date: Thursday, December 3, 2026. Time: 8:30 am - 1:30 pm (CT). Location: The Westin Houston, Memorial City | 945 Gessner Road, Houston, TX 77024