Network Address Translation (NAT) is the process that enables a single device such as a router or firewall to act as an agent between the Internet or Public Network and a local or private network. This agent acts in real time to translate the source or destination IP address of a client or server on the network interface. For the source IP translation, this enables a single public address to represent a significantly larger number of private addresses. For the destination IP translation, the firewall can translate a public destination address to a private address. So we don't have to configure a real public IP address for the server deployed in a private network.
We can subdivide NAT into two types: source NAT (SNAT) and destination NAT (DNAT). This topic is about SNAT, We support three NAT working modes: static SNAT, dynamic SNAT, and central SNAT.
In static SNAT all internal IP addresses are always mapped to the same public IP address. This is a port address translation, Since we have 60416 available port numbers, this one public IP address can handle the conversion of 60,416 internal IP addresses. See example below.
FortiGate firewall configurations commonly use the Outgoing Interface address.
The following example of static SNAT uses an internal network with subnet 10.1.100.0/24 (vlan20) and an external/ISP network with subnet 172.16.200.0/24 (vlan30).
When the clients in internal network need to access the servers in external network, We need to translate IP addresses from 10.1.100.0/24 to an IP address 172.16.200.0/24, In this example, we implement static SNAT by creating a firewall policy.
To configure static NAT:
- In Policy & Objects > IPv4 Policy, click Create New.
- Enter the required policy parameters.
- Enable NAT and select Use Outgoing Interface Address.
- If needed, enable Preserve Source Port.
Enable Preserve Source Port to keep the same source port for services that expect traffic to come from a specific source port.
Disable Preserve Source Port to allow more than one connection through the firewall for that service.
For packets that match this policy, its source IP address is translated to the IP address of the outgoing interface.