Add a NAT rule
You can create NAT rules to modify the IP addresses and ports for traffic flowing between networks, generally between a trusted and an untrusted network.
You can specify source NAT rules for traffic originating from the specified source address and destination NAT rules for traffic to the specified destination address. You can also specify loopback policies to translate traffic from internal sources to internal servers.
To create a source NAT rule, specify the original and translated sources and the inbound and outbound interfaces.
To create a destination NAT rule, specify the original and translated destinations and services, and the inbound and outbound interfaces.
NAT method in destination rules allows you to enforce load balancing and failover for internal hosts. You can specify health checks to enforce the load balance and failover settings.
- Go to Rules and policies > NAT rules, select IPv4 or IPv6 and click Add NAT rule.
The rule is turned on by default.
Enter the rule details.
Name Description Rule name Enter a name. Rule group Select a rule group or create one. The firewall rule will belong to this group.
If you select Automatic, the firewall rule is added to an existing group based on the first match with rule type and source-destination zones.
Specify the translation settings for source, destination, services, and interfaces to match traffic flowing through interfaces and VPN tunnels.
Original source, destination, and service are the pre-NAT entities of traffic when it enters Sophos Firewall. Translated source, destination, and services are the post-NAT entities of traffic when it exits Sophos Firewall. You can select the original source, destination, and services or create new ones.
Name Description Original source Specify the pre-NAT source objects of outgoing traffic. To create an inbound NAT rule when the inbound IP address is unknown, select Any. Translated source (SNAT) IP addresses of the original source objects are translated to the IP addresses that you specify. Use this to perform source NAT (SNAT) for outgoing traffic. To masquerade traffic, select MASQ. By default, MASQ translates the original IP address to the outbound IP address. If you want to translate using the xfrm IP address for route-based VPN traffic, set the translated source in the SNAT rule to the xfrm IP address rather than MASQ.
To create an inbound NAT rule, select Original.
Original destination Specify the pre-NAT destination objects of incoming traffic. To create an outbound NAT rule, select Any. Translated destination (DNAT) IP addresses of the destination objects are translated to the IP addresses or FQDN that you specify. To create an outbound NAT rule, select Original. Original service Specify the pre-NAT services. Services are a combination of protocols and ports. To create an outbound NAT rule, this is generally set to Any. Translated service (PAT) Original services are translated to the services that you specify. Use this for port address translation (PAT). If you've specified more than one original service or set it to Any, set the translated service to Original.
The translated protocol must match the original protocol. You can translate original service ports to a single or equal number of translated service ports.
You can use this to port forward traffic to internal servers, for example, specify TCP port 443 to forward incoming HTTPS traffic to an internal web server.
Inbound interface Select the interfaces through which traffic specified in this rule enters Sophos Firewall.
For destination NAT, you can specify Any.
For VPNs, set this interface to Any, since VPNs are not interfaces.
Outbound interface Select the interfaces from which traffic specified in this rule exits Sophos Firewall.
For VPNs and for destination NAT rules that translate public IP addresses to private IP addresses, set this interface to Any.
Select Override source translation for specific outbound interfaces to apply interface-specific source translation. This option applies only to source NAT rules.
- Select an option in Outbound interface and Translated source (SNAT). To specify more than one, select Expand .
- Select Create loopback rule to allow internal hosts to access other internal hosts, for example, servers.
Select Create reflexive rule to create a mirror rule that reverses the matching criteria of the rule from which it’s created.
You can create loopback and reflexive rules for destination NAT rules. They are created, using the original NAT rule ID and name. Changing the original NAT rule settings later doesn’t change loopback and reflexive rule settings.
Select an option in Load balancing method to load balance traffic among the translated internal hosts.
Name Description Round robin Requests are served sequentially, starting with the server next to the previously assigned server. Use it when you want to distribute traffic equally and don’t require session persistence. First alive Incoming requests are served to the primary server (the first IP address of the range). If the primary server fails, requests are forwarded to the next server and so on. Use it for failover. Random Requests are served randomly to the servers with equal load distribution. Use this when you want equal distribution and don’t require session persistence or order of distribution. Sticky IP Traffic from a specific source is forwarded to the mapped server. Use this when you want the requests to be processed by the same server. One-to-one Requests are sent to the mapped IP addresses. The IP addresses of the original and translated destinations must be equal in number.
Select Health check to enforce server failover. Specify the probe interval, response time-out and the number of retries after which to deactivate the host.
Health check is enforced by default for First alive NAT method.
- Select the probe method. You can select ICMP (ping) or TCP protocols.
- Enter the port over which to check.
- Specify the probe interval. It’s the interval between health checks.
- Specify the response time-out. The server must respond within this time period to be considered alive.
- For Deactivate host after, specify the number of retries.
- Click Save.