How to configure Passive mode FTP server behind the SonicWall.
03/29/2022 271 People found this article helpful 507,034 Views
Description
Feature/Application
FTP connections involve two TCP connections - one for Control and another for Data. In the Control phase of the connection the client and the server exchange authentication information; send and receive FTP commands on TCP port 21. The Data phase is used to transfer files. The port used for FTP-Data connection is determined by the mode the FTP server is configured in. FTP can be configured in either Active or Passive mode. In either mode the Control port is by default TCP port 21.
In Active mode, the Data connection is almost always made on TCP port 20 and is initiated by the FTP server after a Control connection is established. In Passive mode, the server sends a random port number to the client. The client initiates a new TCP connection on the port sent by the server. The port number sent by the server is based on how the server is configured. The server can be configured to use a random port between 0-65535 or can be configured to choose from a fixed range. In both methods, this new Data connection initiated by the client poses problems if the FTP server is behind a NAT device like a firewall or UTM appliance. If such a device is configured to open and forward TCP port 21, the second connection made by the client to the random port on the server is dropped.
This can be overcome by opening all high-number TCP ports (1025-65535) in the NAT device or opening the fixed range of ports configured in the server, depending on the way the server has been configured. However, this defeats the very purpose of using Passive mode which is recommended for its relative security.
SonicWall overcomes this problem by actively scanning FTP traffic using DPI and dynamically opening ports required for clients to connect to the server. This way, only the Control port, TCP port 21, requires to be explicitly opened in the SonicWall.
This article describes the configuration required in the SonicWall to allow a FTP client on the WAN (Internet) to connect to a server configured in Passive mode behind the SonicWall. For the purpose of this article a FileZilla FTP server is shown.
Resolution
Passive mode setting in the FTP Server (FileZilla)
Resolution for SonicOS 6.5
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.
- In the following configuration, the server chooses a random port between 1-65535.
- In the following configuration, the server chooses a port between 55000-65000. This is optional. The SonicWall can determine the Data ports using DPI.
Configuring the SonicWall
- Login to SonicWall management GUI.
- Navigate to Manage| Objects |Address Objects page.
- Click Add a new address object button and create two address objects; one for Server IP on LAN and another for Public IP of the server.
- Click OK.
Address Object for Server on LAN Name: FTP Server Private Zone Assignment: LAN Type: Host IP Address: 192.168.1.100 | |
Address Object for Server's Public IP
Name: FTP Server Public Zone Assignment: WAN Type: Host IP Address: 1.1.1.1 | |
Create an Access Rule
- Navigate to Manage | Rules | Access Rules page.
- Navigate to WAN | LAN page.
- Create the following access rule.
- In the above rule, the service object FTP is a pre-defined object for TCP port 21.
Create a NAT Policy
FTP Transformation
The option Enable FTP Transformations for TCP port(s) in Service Object under Firewall Settings | Advanced settings allows you to choose the Control port used in the FTP connection. This option does the following:
- Enables the SonicWall to track the FTP connection to obtain the Data port sent by the FTP server to the FTP client;
- Then dynamically open the port to allow the FTP client to connect to the FTP server.
CAUTION: Selecting the wrong object here will break the FTP connection.
TIP: By default, this option is pre-selected with the service object FTP (TCP port 21). However, if the Control port is a non-standard custom port, specify it here. Refer this article for Opening custom port for a Passive mode FTP Server behind the SonicWall.
Related Articles
Categories
Was This Article Helpful?
YESNO