Technical Tip: Understanding SNAT source port changes for IKE traffic
Description
This article describes why Source NAT (SNAT) can change the source port of IKE traffic passing through a FortiGate firewall.
Scope
FortiGate.
Solution
The source port selected during SNAT depends on the FortiOS version and the original source port number.
Scenario 1: Original source port is between 5117 and 65533.
Beginning in FortiOS 7.4.4, port preservation is enabled by default. When port preservation is active, FortiGate attempts to retain the original source port during SNAT if the port is available.
Port preservation is supported only for source ports in the range 5117-65533. If the source port is already in use by another session, FortiGate selects an alternate port.
The following command can be used to verify whether the translated IP address and source port are already in use:
diagnose sys session list | grep <Translated_IP>:<Original_Port>
For additional information, see Fine-tuning source-port behavior for SNAT
Scenario 2: Original source port is lower than 1023.
FortiGate treats ports below 1023 as privileged ports. During SNAT, privileged ports are translated into the reserved 512-1023 range.
IKE uses UDP port 500 as its source port. As a result, the translated source port may become a value such as UDP 520 instead of a port above 5117.
This behavior is expected and does not typically affect IKE negotiation. NAT Traversal (NAT-T) can be used to detect and accommodate address or port translation in the network path.
Preserving the original source port.
When preservation of the original source port is required, enable the fixedport option in the firewall policy:
config firewall policy
edit <policy_id>
set fixedport enable
next
endNote:
If fixedport is enabled, FortiGate preserves the original source port unconditionally during SNAT. When multiple sessions require the same translated source IP address and source port with an identical 5-tuple, session collisions can occur and may cause connectivity issues.
For additional information, see: Technical Tip: Using set fixedport or preserve source port in a firewall policy
Understanding session collisions.
FortiGate identifies sessions based on a 5-tuple:
Source IP address.
Destination IP address.
IP protocol.
Source port.
Destination port.
If two translated sessions result in an identical 5-tuple, a session collision occurs.
In this situation, only one session can remain active and a Session clashed event is generated.
Example:
date=2026-01-01 time=10:56:21 eventtime=17913885811 tz="-0500" logid="0100020085" type="event" subtype="system" level="information" vd="root" logdesc="Session clashed" status="clash" proto=17 msg="session clash" new_status="state=00000204 tuple-num=2 policyid=9 dir=0 act=1 hook=4 10.50.10.4:500->44.33.22.11:500(10.41.10.1:500) dir=1 act=2 hook=0 44.33.22.11:500->10.41.10.1:500(10.50.10.4:500)" old_status="state=00000204 tuple-num=2 policyid=9 dir=0 act=1 hook=4 10.50.10.3:500->44.33.22.11:500(10.41.10.1:500) dir=1 act=2 hook=0 44.33.22.11:500->10.41.10.1:500(10.50.10.3:500)"The following traffic example shows two different internal hosts attempting to preserve UDP port 500 while connecting to the same peer:
2026-01-01 10:56:49.996444 VLAN10_Data in 10.50.10.3.500 -> 44.33.22.11.500: udp 465
2026-01-01 10:56:49.996481 wan1 out 10.41.10.1.500 -> 44.33.22.11.500: udp 465
2026-01-01 10:56:51.183794 VLAN10_Data in 10.50.10.4.500 -> 44.33.22.11.500: udp 241
2026-01-01 10:56:51.183858 wan1 out 10.41.10.1.500 -> 44.33.22.11.500: udp 241Only one session can remain active because both translated sessions become identical after NAT.
Using overload IP pools to avoid collisions.
In environments where multiple hosts must preserve source port 500 when communicating with the same remote peer, consider using an overload IP pool with a range of public IP addresses together with fixedport enabled on the firewall policy.
Example:
10.50.10.3:500 (SNAT 10.41.10.2:500) -> 44.33.22.11
10.50.10.4:500 (SNAT 10.41.10.1:500) -> 44.33.22.11Both sessions remain active because each translated session has a unique 5-tuple:
2026-01-01 11:47:45.299015 VLAN10_Data in 10.50.10.4.500 -> 44.33.22.11.500: udp 241
2026-01-01 11:47:45.299033 wan1 out 10.41.10.1.500 -> 44.33.22.11.500: udp 241
2026-01-01 11:47:50.084353 VLAN10_Data in 10.50.10.3.500 -> 44.33.22.11.500: udp 465
2026-01-01 11:47:50.084373 wan1 out 10.41.10.2.500 -> 44.33.22.11.500: udp 465Interaction between local services and SNAT.
FortiGate avoids conflicts with existing sessions, rather than with ports used by local services.
As a result, locally originated FortiGate IKE traffic using UDP port 500 and NATed client traffic using UDP port 500 can typically coexist without issue because the resulting 5-tuples are different.
A conflict may occur if a translated session and a locally originated service attempt to communicate with the same remote peer using an identical 5-tuple. In that situation, session collisions can occur and cause connection instability.
Related articles:
Fine-tuning source-port behavior for SNAT
Technical Tip: Using set fixedport or preserve source port in a firewall policy
Technical Tip: Using 'set fixedport enable' in a policy with 'fixed-port-range' type IP pool.
Technical Tip: How to preserve source port when central NAT is enabled
Troubleshooting Tip: Explanation of the session clash message
