Linux – proftpd, dynamic IP, and filezilla: port troubles

ftplinux

The basic setup: Two computers, one running proftpd, one attempting to connect via filezilla. Both linux (xubuntu on the server, kubuntu on the client). Both are at the moment behind a router on a residential (read: dynamic IP) connection; the client is a laptop I plan to take away from the home network, so I'll need this to work externally. I have my router set up to allow specific ports forwarded to each machine and, where possible, have plugged in those numbers into proftpd (via gadmin, double-checking the config file) and filezilla.

Attempting to connect via active mode using the internal IP works:

Status: Connecting to 192.168.1.139:8085...
Status: Connection established, waiting for welcome message...
Response:   220 Crossroads FTP
Command:    USER <redacted>
Response:   331 Password required for <redacted>
Command:    PASS *******
Response:   230 Anonymous access granted, restrictions apply
Command:    OPTS UTF8 ON
Response:   200 UTF8 set to on
Status: Connected
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/" is the current directory
Command:    TYPE I
Response:   200 Type set to I
Command:    PORT 192,168,1,52,153,140
Response:   200 PORT command successful
Command:    LIST
Response:   150 Opening ASCII mode data connection for file list
Response:   226 Transfer complete
Status: Directory listing successful

Attempting to connect via the domain name, however, leads to issues; in active mode, the PORT is the last command to be received according to the server's logs, and in passive mode, it's the PASV command. This leads me to believe I'm being redirected to a bad port?

Active Sample:

Status: Resolving address of <url>
Status: Connecting to <ip:port>
Status: Connection established, waiting for welcome message...
Response:   220 Crossroads FTP
Command:    USER <redacted>
Response:   331 Password required for <redacted>
Command:    PASS *******
Response:   230 Anonymous access granted, restrictions apply
Command:    OPTS UTF8 ON
Response:   200 UTF8 set to on
Status: Connected
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/" is the current directory
Command:    TYPE I
Response:   200 Type set to I
Command:    PORT 174,111,127,27,153,139
Response:   200 PORT command successful
Command:    LIST
Error:  Connection timed out
Error:  Failed to retrieve directory listing

Passive sample:

Status: Resolving address of ftp.bonsaiwebdesigns.com
Status: Connecting to 174.111.127.27:8085...
Status: Connection established, waiting for welcome message...
Response:   220 Crossroads FTP
Command:    USER yamikuronue
Response:   331 Password required for yamikuronue
Command:    PASS *******
Response:   230 Anonymous access granted, restrictions apply
Command:    OPTS UTF8 ON
Response:   200 UTF8 set to on
Status: Connected
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/" is the current directory
Command:    TYPE I
Response:   200 Type set to I
Command:    PASV
Response:   227 Entering Passive Mode (64,95,64,197,101,88).
Command:    LIST
Error:  Connection timed out
Error:  Failed to retrieve directory listing

In both cases, the log file ends at "PORT" or "PASV" – there's no record of ever receiving a "LIST" command. Just above that I can see the attempt to connect actively via the internal IP, which does indeed include a LIST command.

My config file includes "PassivePorts 20001-26999", which are the port forwards I set up for the ftp server, and "Port 8085", which is also forwarded to the same machine. I also have a MasqueradeAddress set up to prevent it from reporting its internal IP, which was an earlier issue I had.

I think what I'm asking is, is there another setting someplace I have to change to get this setup to work?

Best Answer

So I think I solved it. Someone else suggested removing the MasqueradeAddress. When I did, Filezilla tells me the server gave me a bogus IP so it's falling back to the server's own address. Which works.

WTF? Can someone explain this to me?