en-US
search-icon

Knowledge Base

How to Enable Port Forwarding and Allow Access to a Server Through the SonicWall

Description

This article describes how to access an Internal device or server behind the SonicWall firewall. This process is also known as opening ports, NAT, and Port Forwarding.

For this process the device that is attempting to be accessed can be any of the following:

  • Web Server
  • FTP Server
  • Email Server
  • Terminal Server
  • DVR (Digital Video Recorder)
  • PBX
  • SIP Server
  • IP Camera
  • Printer
  • Application Server
  • Any custom Server Roles
  • Game Consoles

Don't want to read? Watch instead!

Cause

By default the SonicWall disallows all Inbound Traffic that isn't part of a communication that began from an internal device, such as something on the LAN Zone. This is to protect internal devices from malicious access, however it is often necessary to open up certain parts of a network, such as Servers, to the outside world.

To accomplish this the SonicWall needs a Firewall Access Rule to allow the traffic from the public Internet to the internal network as well as a Network Address Translation (NAT) Policy to direct the traffic to the correct device.

Resolution

Manually opening Ports / enabling Port forwarding to allow traffic from the Internet to a Server behind the SonicWall using SonicOS involves the following steps:

  1. Creating the necessary Address Objects
  2. Creating the appropriate NAT Policies which can include Inbound, Outbound, and Loopback
  3. Creating the necessary Firewall Access Rules

These steps will also allow you to enable Port Address Translation with or without altering the IP Addresses involved.

TIP: The Public Server Wizard is a straightforward and simple way to provide public access to an internal Server through the SonicWall. The Public Server Wizard will simplify the above three steps by prompting your for information and creating the necessary Settings automatically.

Click Quick Configuration in the top navigation menu.

You can learn more about the Public Server Wizard by reading How to open ports using the SonicWall Public Server Wizard.

CAUTION: The SonicWall security appliance is managed by HTTP (Port 80) and HTTPS (Port 443), with HTTPS Management being enabled by default. If you are using one or more of the WAN IP Addresses for HTTP/HTTPS Port Forwarding to a Server then you must change the Management Port to an unused Port, or change the Port when navigating to your Server via NAT or another method.

Image

Scenario Overview

The following walk-through details allowing HTTPS Traffic from the Internet to a Server on the LAN. Once the configuration is complete, Internet Users can access the Server via the Public IP Address of the SonicWall's WAN. Although the examples below show the LAN Zone and HTTPS (Port 443) they can apply to any Zone and any Port that is required. Similarly, the WAN IP Address can be replaced with any Public IP that is routed to the SonicWall, such as a Public Range provided by an ISP.

TIP: If your user interface looks different to the screenshot in this article, you may need to upgrade your firmware to the latest firmware version for your appliance. To learn more about upgrading firmware, please see Procedure to Upgrade the SonicWall UTM Appliance Firmware Image with Current Preferences.


Step 1: Creating the necessary Address Objects

  1. Log into the SonicWall GUI.
  2. Click Manage in the top navigation menu.
  3. Click Objects | Address Objects.
  4. Click the Add a new Address object button and create two Address Objects for the Server's Public IP and the Server's Private IP.
  5. Click OK to add the Address Object to the SonicWall's Address Object Table.

Image

Step 2: Creating the necessary Service Object

  1. Click Manage in the top navigation menu
  2. Click Objects | Service Objects.
  3. Click the Add a new Service object button and create the necessary Service Objects for the Ports required.
  4. Ensure that you know the correct Protocol for the Service Object (TCP, UDP, etc.). If you're unsure of which Protocol is in use, perform a Packet Capture.
  5. Click OK to add the Service Object to the SonicWall's Service Object Table.

Image

Step 3: Creating the appropriate NAT Policies which can include Inbound, Outbound, and Loopback


A NAT Policy will allow SonicOS to translate incoming Packets destined for a Public IP Address to a Private IP Address, and/or a specific Port to another specific Port. Every Packet contains information about the Source and Destination IP Addresses and Ports and with a NAT Policy SonicOS can examine Packets and rewrite those Addresses and Ports for incoming and outgoing traffic.

  1. Click Manage in the top navigation menu.
  2. Click Rules | NAT Policies.
  3. Click the Add a new NAT Policy button and a pop-up window will appear.
  4. Click Add to add the NAT Policy to the SonicWall NAT Policy Table.

Note: When creating a NAT Policy you may select the "Create a reflexive policy" checkbox. This will create an inverse Policy automatically, in the example below adding a reflexive policy for the NAT Policy on the left will also create the NAT Policy on the right. This option is not available when configuring an existing NAT Policy, only when creating a new Policy.

Image
Loopback NAT Policy

A Loopback NAT Policy is required when Users on the Local LAN/WLAN need to access an internal Server via its Public IP/Public DNS Name. This Policy will "Loopback" the Users request for access as coming from the Public IP of the WAN and then translate down to the Private IP of the Server. Without a Loopback NAT Policy internal Users will be forced to use the Private IP of the Server to access it which will typically create problems with DNS.

If you wish to access this server from other internal zones using the Public IP address Http://1.1.1.1 consider creating a Loopback NAT Policy:

  • Original Source: Firewalled Subnets
  • Translated Source: X1 IP
  • Original Destination: X1 IP
  • Translated Destination: Example Name Private
  • Original Service: HTTPS
  • Translated Service: Original
  • Inbound Interface: Any
  • Outbound Interface: Any
  • Comment: Loopback policy
  • Enable NAT Policy: Checked
  • Create a reflexive policy: Unchecked

Image
Step 3: Creating the necessary Firewall Access Rules

  1. Click Manage in the top navigation menu.
  2. Click Rules | Access Rules.
  3. Select the View Type as Matrix and select your WAN to Appropriate Zone Access Rule. (This will be the Zone the Private IP of the Server resides on.)
  4. Click the Add a new entry/Add... button and in the pop-up window create the required Access Rule by configuring the fields as shown below.
  5. Click Add when finished.

Image