Created on
‎10-08-2025
09:43 AM
Edited on
‎11-19-2025
09:31 PM
By
Jean-Philippe_P
| Description | This article demonstrates the required settings for hosting a SAML authentication server on the same TCP port as IKE. |
| Scope |
FortiOS v7.6.1 and later, FortiClient v7.4.1 and later. |
| Solution |
In v7.6.1 and later, it is possible to host a SAML SP server for IPsec user authentication on the same port as the one used for IKE TCP encapsulation. This can be necessary to support locked-down environments where the only outgoing port allowed for clients is TCP 443.
IPsec dial-up VPN over TCP also requires FortiClient v7.4.1 or later; see the FortiClient 7.4.0 New Features Guide for details on IPsec VPN over TCP support on Windows, macOS, and Linux.
Multiple resources exist demonstrating how to configure a SAML server for IKE. It is recommended to review the following documents and configure a test deployment using UDP transport for IPsec before integrating TCP transport.
Sample Configuration: This example demonstrates some important settings for transitioning an existing working dial-up tunnel to IKE TCP transport, but is not comprehensive. It uses TCP port 20443, but could be modified for any desired TCP port.
Warning: Changing the ike-tcp-port flushes all existing IPsec tunnels, including site-to-site tunnels and those using UDP transport mode. This will cause some disruption for existing traffic traversing the IPsec VPN.
When IPsec SAML authentication and IKE TCP encapsulation use the same port, the 'auth-ike-saml-port' setting is not used. The 'ike-tcp-port' should be configured to match the single TCP port that will handle both SAML authentication and IPsec traffic.
config system setting set ike-tcp-port 20443 <----- Changing ike-tcp-port flushes all IPsec tunnels, including UDP. end
config system global set auth-ike-saml-port 1001 <----- Unchanged. Must not match ike-tcp-port. end
config user setting set auth-cert <certificate for FortiGate FQDN> <----- Certificate used for client connection to FortiGate as SAML SP. end
Ensure the SAML SP information includes the intended TCP port in the URL, except when using port 443.
config user saml edit "IKE_SAML" set entity-id "http://<FortiGate FQDN>:20443/remote/saml/metadata/" set single-sign-on-url "https://<FortiGate FQDN>:20443/remote/saml/login" set single-logout-url "https://<FortiGate FQDN>:20443/remote/saml/logout" set idp-entity-id <IDP identifier URL> next end
If 'set ike-tcp-port 443' is configured:
config user saml edit "IKE_SAML" set entity-id "http://<FortiGate FQDN>/remote/saml/metadata/" set single-sign-on-url "https://<FortiGate FQDN>/remote/saml/login" set single-logout-url "https://<FortiGate FQDN>/remote/saml/logout" next end
config system interface edit "port1" set ike-saml-server "IKE_SAML" next end
config vpn ipsec phase1-interface edit "dialup_psk" set type dynamic set interface "port1" set ike-version 2 set transport tcp set fortinet-esp disable <----- Default setting. fortinet-esp is used only for FortiGate-FortiGate site-to-site tunnels. set ipv4-start-ip 10.253.0.100 set psksecret <psk> set dpd-retryinterval 60 next end
config user group edit "IKE SAML user group" set member "IKE_SAML" next end
config firewall policy edit <index> set name "RA VPN test" set srcintf "dialup_psk" set dstintf "port2" set action accept set srcaddr "IPsec VPN Admin Clients" set dstaddr "Test Address" set schedule "always" set service "PING" set groups "IKE SAML user group" next end
Potential port conflicts:
Verification: On FortiClient, enable single-sign-on and configure the single-sign-on port as 20443. Enable IPsec over TCP and configure TCP port as 20443.
FortiClient v7.4.3:
Connect to the IPsec VPN and attempt to access a resource behind the firewall.
If it is not possible to connect to the VPN, verify the TCP packets are reaching the FortiGate in a packet sniffer, and check the expected 'NOT IKETCP(), assign to AUTH' messages are visible in IKE diagnostics as shown below:
diagnose debug application ike -1 diagnose debug application authd 7 diagnose debug enable ike V=root:accepts ike tcp-transport(vd=0, vrf=0, intf=0:3, 10.250.255.27:20443->10.250.101.89:55059 sock=44 refcnt=2 ph1=(nil)) (2).
ike V=root:NOT IKETCP(), assign to AUTH authd_http: change state from 0 to 1
authd_http: change state from 1 to 2
To stop the debug:
diagnose debug reset
diagnose debug disable
If 'NOT IKETCP(), assign to AUTH' messages are seen and CPU usage is normal for the iked and authd processes, it is unlikely to be an issue specific to IPsec over TCP. In this case, see this article: Troubleshooting IPsec VPN IKEv2 with SAML authentication for further troubleshooting steps.
Note: IPsec over TCP does not support NPU offloading; see the FortiOS Administration Guide: Encapsulate ESP packets within TCP headers. The IPsec VPN Throughput Specification recorded in the product datasheet assumes the use of NPU offloading, so a lower maximum throughput is expected when TCP encapsulation is in use.
Related documents: Technical Tip: FortiGate Hub with multiple IPsec Dial-up phase1 using IKEv2 and PSK authentication TCP encapsulation of IKE and IPsec packets across multiple vendors |
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.