Description |
This article describes SNAT network behavior when the primary and secondary interface IP address are on the same subnet. |
Scope | FortiGate. |
Solution |
When primary or secondary interface IP addresses have different subnets, FortiOS uses the address that has the same subnet as the gateway found on the route lookup for SNAT.
Firewall Policy using 'Use Outgoing Interface Address' for SNAT (port1 is part of 'virtual-wan-link'):
Checking the IP addresses using the CLI command 'diag ip address list', the Primary IP precedes the Secondary IP.
FortiOS will use the IP address that is on top of the list for SNAT.
Confirmation using debug flow:
Session table:
This feature should be particularly aware of in the Cloud environment such as AWS when on the primary IP has the associated elastic IP (public IP) but the secondary IP does not. In that scenario, if the source IP is SNAT to the secondary IP as above, and the traffic will not be able to access the Internet anymore.
To fix this and restore the original sequence of IP, all those secondary IP addresses need to be removed and reconfigured on FortiGate.
Technical Note: SNAT and primary versus secondary IP address. |