只能从外部子网访问FTP服务器(错误425)

背景/networking结构

这是两层路由器。 外层路由器的公网IP为123.123.123.123 (假冒为例),私网IP为192.168.0.1 。 内层路由器也是外层路由器的客户端,公网IP为192.168.0.2 ,私网IP为192.168.1.1 。 带有FileZilla Server的Windows 7 Enterprise计算机是IP 192.168.1.48的内部路由器的客户端。 所有的IP都是静态的。

我一直使用互联网的另一端连接到Win7机器几个月的Windows远程桌面。 所以我认为我的两个路由器的端口转发规则是正确的。

从互联网的另一端,FTP连接也很好。 我已经

  1. 将FileZilla Server FTP端口设置为21
  2. 将FileZilla服务器通过TLS端口的隐式FTP设置为990
  3. 将FileZilla Server被动模式自定义端口范围设置为1024-65534
  4. 在Windows防火墙入站规则中允许这些端口
  5. 在内部路由器上将这些端口(TCP)转发到IP 192.168.1.48
  6. 将这些端口(TCP)转发到外部路由器的IP 192.168.0.2

定义…

有三个networking位置:

  1. 互联网,在互联网的某个地方。
  2. 外部子网作为外部路由器的客户端,IP地址为192.168.0.xxx
  3. 内部子网作为内部路由器的客户端,IP地址为192.168.1.xxx

我能做什么/我不能做什么:

A. Windows远程桌面 – 由于我已经在两台路由器上转发了端口3389,RDP在所有这三个位置上工作。

B.使用端口21的基本FTP(不是FTPS隐式,不是FTPS显式) – 适用于所有三个位置。 虽然很不安全。

C. FTPS(我专注于FTPS隐式,这是更安全)使用端口990:

  1. 通过互联网,通过ftps://123.123.123.123:990 ,它的工作原理。
  2. 在外部子网中,计算机和移动电话的IP为192.168.0.11192.168.0.12 。 通过ftps://192.168.0.2:990访问FTP服务器,只有这种情况,不起作用,我不知道为什么。
  3. 在与FTP服务器在同一个子网中的内部子网上。 通过ftps://192.168.1.48:990访问ftps://192.168.1.48:990 。 它按预期工作。

补充:明确的FTPS也不适用于案例C2。

更多的问题

如上所述,只有外部子网中的客户端不能通过隐式FTPS(端口990)协议访问FTP服务器。

确切地说,根据FTP服务器和FTP客户端的日志,我们可以login,但是没有列出目录和文件。

案例C2中的FileZilla FTP客户端日志:

 Status: Connecting to 192.168.0.2:990... Status: Connection established, initializing TLS... Status: Verifying certificate... Status: TLS connection established, waiting for welcome message... Status: Logged in Status: Retrieving directory listing... Command: PWD Response: 257 "/" is current directory. Command: TYPE I Response: 200 Type set to I Command: PASV Response: 227 Entering Passive Mode (192,168,1,48,32,136) Command: MLSD Response: 425 Can't open data connection for transfer of "/" Error: Failed to retrieve directory listing 

案例C2中的FileZilla FTP服务器日志:

 (000873)12/05/2017 01:50:00 - (not logged in) (192.168.0.11)> Connected on port 990, sending welcome message... (000873)12/05/2017 01:50:00 - (not logged in) (192.168.0.11)> 220-FileZilla Server 0.9.60 beta (000873)12/05/2017 01:50:00 - (not logged in) (192.168.0.11)> 220-written by Tim Kosse ([email protected]) (000873)12/05/2017 01:50:00 - (not logged in) (192.168.0.11)> 220 Please visit https://filezilla-project.org/ (000873)12/05/2017 01:50:00 - (not logged in) (192.168.0.11)> TLS connection established (000873)12/05/2017 01:50:02 - (not logged in) (192.168.0.11)> USER midnite (000873)12/05/2017 01:50:02 - (not logged in) (192.168.0.11)> 331 Password required for midnite (000873)12/05/2017 01:50:02 - (not logged in) (192.168.0.11)> PASS *** (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> 230 Logged on (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> SYST (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> 215 UNIX emulated by FileZilla (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> FEAT (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> 211-Features: (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> MDTM (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> REST STREAM (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> SIZE (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> MLST type*;size*;modify*; (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> MLSD (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> AUTH SSL (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> AUTH TLS (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> PROT (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> PBSZ (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> UTF8 (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> CLNT (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> MFMT (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> EPSV (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> EPRT (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> 211 End (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> PBSZ 0 (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> 200 PBSZ=0 (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> PROT P (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> 200 Protection level set to P (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> PWD (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> 257 "/" is current directory. (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> TYPE I (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> 200 Type set to I (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> PASV (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> 227 Entering Passive Mode (192,168,1,48,32,136) (000873)12/05/2017 01:50:02 - midnite (192.168.0.11)> MLSD (000873)12/05/2017 01:50:12 - midnite (192.168.0.11)> 425 Can't open data connection for transfer of "/"