FileZilla CLI: FTP Active Mode Configuration

Active vs Passive Mode

While the differences between these two modes can get complex, here’s a basic explanation:
FTP and FTPS connections use two different channels to a server at once. One is used for
commands and responses, the other for the actual data being transferred.

It’s a little like ordering a pizza: You make a phone call or put in an order via a website, but
the actual pizza arrives by car or scooter.

The second channel – the data channel – is opened differently in active and passive modes. In
active mode, the remote server opens the data channel. In passive mode, the local machine
opens the data channel using the IP address and port number with which the remote server
replies to a successful connection request. Sort of like the difference between having a pizza
delivered (active mode) and going to pick it up yourself (passive mode).

The reason these differences are important is that some firewalls and routers won’t allow
a remote server to initiate a connection to a computer on the local network. If the remote
server can’t open the data channel, the active mode FTP connection can’t transfer any data.
By default, FileZilla Pro Command Line uses passive mode for FTP and FTPS connections.
To see or change which mode FileZilla Pro Command Line change the FTP mode setting.

FTP Active Mode Configuration

Set the range of local port numbers that a remote server can use

You can restrict the local ports that remote FTP servers can use to initiate data channels.
These will need to correspond to ports that the router is configured to allow access from
outside the local network.

Enable the Limit ports setting and set the range you want with the Limit local ports range settings.

Configure the external IP address for your local machine

Before a remote server can send a request to open a data channel, it needs to know the external
IP address of your computer. This is different to the IP address that it has on your
local network, and it tends to change regularly unless your router is configured to assign a
static address instead.
The easiest way to configure this is to allow FileZilla Pro Command Line to check with the
operating system to find out the current external IP address (default). If that doesn’t work,
though, there are two other options:

  • Configure FileZilla Pro Command Line to use a static IP address: only use this if your
    router and ISP support static IP addresses, and one is assigned to your computer.
  • Configure FileZilla Pro Command Line to check a third-party website to find your computer’s
    external IP address.

To configure FileZilla Pro Command Line to use a static IP address set the engine.
external_ip_mode
to 1 and set the IP address in the engine.external_ip setting.

To configure FileZilla Pro Command Line to consult a third-party website to find the local
computer’s IP address set the engine.external_ip_mode to 2 and set the URL of your preferred
IP address-checking website in the IP address in the engine.external_ip_resolver
setting.

Use external IP address for local network connections

By default, FileZilla Pro Command Line doesn’t use the external IP address for connections
to servers on the local network.

If you need FileZilla Pro Command Line to use the external IP address instead of the internal
(local network) address set the engine.no_external_ip_on_local setting to 0.

Tags: , ,