| Description |
This article describes how to configure IKEv2 IPsec using LDAP authentication with FortiToken or FortiToken Cloud for two-factor authentication. |
| Scope |
FortiOS v7.4.9, v7.6.1 and later, FortiClient v7.4.4 and later |
| Solution |
To enable two-factor authentication (2FA) for IKEv2 IPsec users authenticated against an external LDAP server, with secondary authentication enforced through FortiToken or FortiToken Cloud, the following configuration is required:
config user ldap edit "LDAP" set server "ldap.fortilab.local" set cnid "userPrincipalName" set dn "DC=fortilab,DC=local" set type regular set username "admin@fortilab.local" set password fortinet set secure ldaps set ca-cert "ldapcert" set port 636 next end
config user local edit "test@fortilab.local" set type ldap set two-factor fortitoken-cloud set email-to "admin@fortilab.local" set ldap-server "LDAP" next end
config user group edit "LocalGRP" set member "test@fortilab.local" next end
config vpn ipsec phase1-interface edit "IKEv2" set type dynamic set interface "wan1" set ike-version 2 set peertype any set net-device disable set mode-cfg enable set proposal aes128-sha1 aes256-sha256 set dpd on-idle set dhgrp 5 set eap enable set eap-identity send-request set transport udp set ipv4-start-ip 192.168.30.5 set ipv4-end-ip 192.168.30.20 set dns-mode auto set ipv4-split-include "Loopbackaddress" set client-auto-negotiate enable set client-keep-alive enable set psksecret fortinet set dpd-retryinterval 60 next end config vpn ipsec phase2-interface edit "IKEv2P2" set phase1name "IKEv2" set proposal aes128-sha1 aes256-sha256 set dhgrp 5 next end
config firewall policy edit 1 set name "IKEv2VPN" set srcintf "IKEv2" set dstintf "Loopback" set action accept set srcaddr "all" set dstaddr "all" set schedule "always" set service "ALL" set logtraffic all set groups "LocalGRP" next end
Validation of EAP user identity and 2FA status:
FGT # diagnose vpn ike gateway list | grep eap-user -A 4 -B 9 name: IKEv2_0 version: 2 interface: port15 29 addr: 10.191.19.236:4500 -> 10.5.143.230:58773 tun_id: 192.168.30.5/::10.0.0.17 remote_location: 0.0.0.0 network-id: 0 transport: UDP created: 1109s ago eap-user: test@local.lab 2FA: yes groups: LocalGRP 4 peer-id: 10.5.143.230
Important notes:
Remote LDAP user - 2FA configuration use case: config user ldap edit "LDAPRemote" set server "ldap.fortilab.local" set cnid "userPrincipalName" set dn "DC=fortilab,DC=local" set type regular set two-factor fortitoken-cloud set two-factor-filter "(&(objectCategory=Person)(userPrincipalName=*)(memberOf=CN=vpnldap,OU=lab,DC=fortilab,DC=local))" set username "admin@fortilab.local" set password fortinet set secure ldaps set ca-cert "ldapcert" set port 636 next end
Related articles: Technical Tip: How to enable EAP-TTLS for IPSec IKEv2 tunnels in VPN-only (unlicensed) FortiClient Technical Tip: A guide to dial-up IPSec VPN authentication and policy matching |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.