The Network Address Translation (NAT) engine in SonicOS Enhanced allows users to define granular NAT polices for their incoming and outgoing traffic. This article illustrates the different types of NAT policies which can be configured in the SonicWall for various purpose.
For the purpose of this article, we’ll be using the following IP addresses as examples to demonstrate the NAT policy creation and activation. You can use these examples to create NAT policies for your network, substituting your IP addresses for the examples shown here:
This release includes significant user interface changes and many new features that are different from the SonicOS 6.5 and earlier firmware. The below resolution is for customers using SonicOS 7.X firmware.
Many to One NAT
This is the most common NAT policy which allows you to translate a group of addresses into a single address.This generally means that you are translating a Internal IP(Private Subnet) outgoing request into the IP address of the SonicWall WAN port. In this case, the destination sees the request coming from the IP address of the SonicWall WAN interface and not from the internal IP address.
SonicWall has a default outgoing NAT policy preconfigure for each interface configured under thePolicy|Rules and Policies|NAT Rulespage translating all outgoing requests into the IP address of the SonicWalls primary WAN interface.
To view the default NAT policies preconfigure in the SonicWall, Navigate to Policies|Rules and Policies|NAT Rules.You can add the NAT policies under the same section.
EXAMPLE: The following image is the configuration menu for such a default NAT policy to translate outbound traffic to the IP of the SonicWall's X1 Interface.We can also look the network address translation into the diagram format by enabling show diagram.
However, in certain scenarios it may be necessary to translate a particular subnet to an IP Address other than the WAN Primary IP. Such a NAT policy is simple to create and activate. To create a NAT policy to allow all systems on the X1 interface to initiate traffic using a public IP address other than SonicWalls WAN primary IP address, follow these steps:
add a new address object for the alternate WAN IP you wish to translate to.
EXAMPLE:Example NAT policy created below for reference following the examples above
One to One NAT
This is another common NAT policy on a SonicWall and allows you to translate an internal IP address into a unique IP address. This is useful when you want specific systems, such as servers, to use a specific IP address when they initiate traffic to other destinations. Most of the time, a NAT policy such as this is used to map a servers private IP address to a public IP address, and its paired with a mirror policy that allows any system from the public Internet to access the server, along with a matching firewall access rule that permits this.
In this example we have chosen to demonstrate a webserver using HTTP service, however the following steps apply to any service you wish to use (like HTTPS, SMTP, FTP, Terminal Services, SSH, etc).
Creating the necessary Address Objects
EXAMPLE: Example provided below for a webserver
Address Object for Server on LAN
Name: Webserver Private
ZoneAssignment:LAN
Type:Host
IPAddress:192.168.1.100
Address Object for Server's Public IP
Name: Webserver Public
ZoneAssignment:WAN
Type:Host
IPAddress:1.1.1.1
Creating an Inbound NAT Policy
This policy allows you to translate an external public IP address into an internal private IP address. This NAT policy, when paired with an allow access rule, allows any source to connect to the internal server using the public IP address. The SonicWall will handle the translation between the private and public address. Below, we will be creating the NAT Policy as well as the rule to allow HTTP access to the server.
We can also look the NAT policies created in the structural format by enabling the Show Diagram option:
The users can also enable the Dock Diagram option in the NAT Policies:
Inbound NAT Policy
Example Outbound/Reflexive Policy:
DNS Loopback NAT Policy
The purpose of a DNS Loopback NAT Policy is for a host on the LAN or DMZ to be able to access the webserver on the LAN (192.168.1.100) using the server's public IP address (1.1.1.1) or by its fully qualified domain name (FQDN).
EXAMPLE:In the example below Firewalled Subnets is used as the original source, but this may need adjusted to include all subnets behind the SonicWall if you are routing additional subnets through a layer 3 device behind the SonicWall. Traffic is translated to the Webservers public IP (but this can be any public address) to be able to communicate and translate back through the SonicWall appliance. This process can be bypassed by creating a local DNS entry to translate your webserver to it's private IP instead.
Inbound Port Address Translation via WAN (X1) IP Address:
This is one of the more complex NAT policies you can create on a SonicWall UTM Appliance with SonicOS Enhanced firmware. It allows you to use the WAN IP address of the SonicWall device to provide access to multiple internal servers. This is most useful in situations where your ISP has only provided a single public IP address, and that IP address had to be used by the SonicWalls WAN interface.
Below, well provide public access to two internal Webservers via the SonicWalls WAN IP address; each will be tied to a unique custom port. In the examples, well only be setting up two, but its possible to create more than this as long as the ports are all unique.
In this section, we have five tasks to complete:
Creating two custom ports:
Creating two address objects:
Creating inbound NAT Policies:
To create the NAT policies to map the custom ports to the servers real listening ports and to map the SonicWalls WAN IP address to the servers private addresses, create the following NAT Policies
NOTE: Outbound NAT policies will need to be created if traffic is to be generated from the servers separately and to be translated to the same public IP.
We can also enable Create a Reflexive policyin the NAT Policies in Advanced/Actions section. Source port Remap can also be enabled and disabled under the same section.
This release includes significant user interface changes and many new features that are different from the SonicOS 6.2 and earlier firmware. The below resolution is for customers using SonicOS 6.5 firmware.
Many to One NAT
This is the most common NAT policy on a SonicWall, and allows you to translate a group of addresses into a single address. Most of the time, this means that youre taking an internal “private” IP subnet and translating all outgoing requests into the IP address of the SonicWalls WAN port, such that the destination sees the request as coming from the IP address of the SonicWalls WAN port, and not from the internal private IP address.
SonicWall has a default outgoing NAT policy preconfigure for each interface configured under the Manage | Network | Interfaces page translating all outgoing requests into the IP address of the SonicWalls primary WAN port (WAN Primary IP). To view the default NAT policies preconfigure in the SonicWall click Manage | Rules|NAT Policies.
EXAMPLE:The following image is the configuration menu for such a default NAT policy to translate outbound traffic to the IP of the SonicWall's X1 Interface.
However, in certain scenarios it may be necessary to translate a particular subnet to an IP Address other than the WAN Primary IP. Such a NAT policy is simple to create and activate. To create a NAT policy to allow all systems on the X1 interface to initiate traffic using a public IP address other than SonicWalls WAN primary IP address, follow these steps:
EXAMPLE:Refer to the screenshot below for an example where a Host object was created and 1.1.1.2 is the example IP is what objects would be NAT translated to
EXAMPLE: ExampleNAT policy created below for reference following the examples above
One to One NAT
This is another common NAT policy on a SonicWall, and allows you to translate an internal IP address into a unique IP address. This is useful when you want specific systems, such as servers, to use a specific IP address when they initiate traffic to other destinations. Most of the time, a NAT policy such as this is used to map a servers private IP address to a public IP address, and its paired with a mirror policy that allows any system from the public Internet to access the server, along with a matching firewall access rule that permits this.
In this example we have chosen to demonstrate a webserver using HTTP service, however the following steps apply to any service you wish to use (like HTTPS, SMTP, FTP, Terminal Services, SSH, etc).
Creating the necessary Address Objects
EXAMPLE: Example provided below for a webserver
Address Object for Server on LAN
Name:Wwebserver Private
ZoneAssignment:LAN
Type:Host
IPAddress:192.168.1.100
Address Object for Server's Public IP
Name:Wwebserver Public
ZoneAssignment:WAN
Type:Host
IPAddress:1.1.1.1
Creating an Inbound NAT Policy
This policy allows you to translate an external public IP address into an internal private IP address. This NAT policy, when paired with an allow access rule, allows any source to connect to the internal server using the public IP address. The SonicWall will handle the translation between the private and public address. Below, we will be creating the NAT Policy as well as the rule to allow HTTP access to the server.
![]() | Inbound NAT Policy Original Source: Any
|
Example Outbound/Reflexive Policy |
NOTE:If you need to create an access rule to allow the traffic through the firewall for an inbound NAT policy, refer toHow to Enable Port Forwarding and Allow Access to a Server Through the SonicWall
DNS Loopback NAT Policy
The purpose of a DNS Loopback NAT Policy is for a host on the LAN or DMZ to be able to access the webserver on the LAN (192.168.1.100) using the server's public IP address (1.1.1.1) or by its fully qualified domain name (FQDN).
EXAMPLE:In the example below Firewalled Subnets is used as the original source, but this may need adjusted to include all subnets behind the SonicWall if you are routing additional subnets through a layer 3 device behind the SonicWall. Traffic is translated to the Webservers public IP (but this can be any public address) to be able to communicate and translate back through the SonicWall appliance. This process can be bypassed by creating a local DNS entry to translate your webserver to it's private IP instead.
Inbound Port Address Translation via WAN (X1) IP Address
This is one of the more complex NAT policies you can create on a SonicWall UTM Appliance with SonicOS Enhanced firmware. It allows you to use the WAN IP address of the SonicWall device to provide access to multiple internal servers. This is most useful in situations where your ISP has only provided a single public IP address, and that IP address had to be used by the SonicWalls WAN interface.
Below, well provide public access to two internal Webservers via the SonicWalls WAN IP address; each will be tied to a unique custom port. In the examples, well only be setting up two, but its possible to create more than this as long as the ports are all unique.
In this section, we have five tasks to complete:
Creating two custom ports:
EXAMPLE:In the example below, Webserver 1 will be using port 4433 for 443 services and Webserver 2 will be using 4434 for 443 services
![]() | ![]() |
Creating two address objects:
EXAMPLE:For the purposes of our example, the private webserver IPs will be setup to be 192.168.1.100 and 192.168.1.101
![]() | ![]() |
Creating inbound NAT Policies:
To create the NAT policies to map the custom ports to the servers real listening ports and to map the SonicWalls WAN IP address to the servers private addresses, create the following NAT Policies
EXAMPLE:Below are the two example NAT policies created using the same information from the Service and Address objects created above. Both private IPs are translated from the same public IP but are based on different source ports.With these policies in place, the SonicWall will translate the servers public IP address to the private IP address when connection requests arrive from the WAN interface bound for the IP of the Webserver Public address. To access the web server 192.168.1.100, users on the Internet have to enter https://1.1.1.1:4433 in their web browser. Likewise, to access the web server 192.168.1.101, enter https://1.1.1.1:4434.
![]() | ![]() |
NOTE:Outbound NAT policies will need to be created if traffic is to be generated from the servers separately and to be translated to the same public IP.