![FTP 客户端接收整个文件,但总是在完成之前关闭连接](https://linux22.com/image/633007/FTP%20%E5%AE%A2%E6%88%B7%E7%AB%AF%E6%8E%A5%E6%94%B6%E6%95%B4%E4%B8%AA%E6%96%87%E4%BB%B6%EF%BC%8C%E4%BD%86%E6%80%BB%E6%98%AF%E5%9C%A8%E5%AE%8C%E6%88%90%E4%B9%8B%E5%89%8D%E5%85%B3%E9%97%AD%E8%BF%9E%E6%8E%A5.png)
在 Windows Server 2008 R2 标准版计算机上,我无法连接 Windows FTP 服务器并从该服务器下载文件。
文件大小约为 3KB 到 6KB。很少约为 100KB 到 500KB,但服务器有足够的磁盘空间。
我尝试过被动连接:
Response: 220-Microsoft FTP Service
Response: 220 Regal Logistics
Command: USER ********
Response: 331 Password required for ********.
Command: PASS ********
Response: 230 User ******** logged in.
Status: Connected
Status: Starting download of /********/PO/201405130227.xml
Command: CWD /********/PO
Response: 250 CWD command successful.
Command: TYPE A
Response: 200 Type set to A.
Command: PASV
Response: 227 Entering Passive Mode (***,***,***,**,19,64)
Command: RETR 201405130227.xml
Response: 125 Data connection already open; Transfer starting.
Response: 426 Data connection closed. Error scanning content
Error: File transfer failed after transferring 3,465 bytes in 1 second
奇怪的是,该文件有 3,465 字节,因此整个文件都可以通过,只是没有正确完成。
我已经尝试过主动连接:
Response: 220-Microsoft FTP Service
Response: 220 Regal Logistics
Command: USER ********
Response: 331 Password required for ********.
Command: PASS ********
Response: 230 User ******** logged in.
Command: PORT 10,0,0,114,214,65
Response: 200 PORT command successful.
Command: RETR 201405130227.xml
Response: 150 Opening ASCII mode data connection for 201405130227.xml(3465 bytes).
Response: 426 Data connection closed. Error scanning content
我已尝试从同一服务器上的两个不同的 FTP 客户端(Filezilla 和 CLI FTP 客户端)进行操作,并得到了相同的响应:
125 Data connection already open; Transfer starting.
426 Data connection closed. Error scanning content
我已尝试从单独的网络成功下载文件,因此它对于服务器的位置来说是唯一的。
我已经联系了服务器所在位置的系统/网络管理员,他们向我保证 FTP 运行所需的端口是开放的。(我猜他们已经开放了 21 个,其他端口我不确定。)他们的网络上有一个物理防火墙,但不幸的是,我同样无法访问它。服务器上的 Windows 防火墙已禁用。
我还能看看什么来判断它是否真的失败了?
这是失败之前的请求的数据包日志:
No. Time Source Destination Protocol Length Info
39 6.878855000 LOCAL-IP EXTERNAL-FTP-SERVER-IP FTP 77 Request: RETR 201405130227.xml
Frame 39: 77 bytes on wire (616 bits), 77 bytes captured (616 bits) on interface 0
Ethernet II, Src: Hewlett-_ab:cd:ef (00:1e:a1:ab:cd:ef), Dst: Watchgua_12:34:56 (ab:cd:7f:12:34:56)
Internet Protocol Version 4, Src: LOCAL-IP (LOCAL-IP), Dst: EXTERNAL-FTP-SERVER-IP (EXTERNAL-FTP-SERVER-IP)
Transmission Control Protocol, Src Port: 56623 (56623), Dst Port: ftp (21), Seq: 55, Ack: 207, Len: 23
File Transfer Protocol (FTP)
No. Time Source Destination Protocol Length Info
40 6.893662000 EXTERNAL-FTP-SERVER-IP LOCAL-IP TCP 60 ftp > 56623 [ACK] Seq=207 Ack=78 Win=93362 Len=0
Frame 40: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) on interface 0
Ethernet II, Src: Watchgua_12:34:56 (ab:cd:7f:12:34:56), Dst: Hewlett-_ab:cd:ef (00:1e:a1:ab:cd:ef)
Internet Protocol Version 4, Src: EXTERNAL-FTP-SERVER-IP (EXTERNAL-FTP-SERVER-IP), Dst: LOCAL-IP (LOCAL-IP)
Transmission Control Protocol, Src Port: ftp (21), Dst Port: 56623 (56623), Seq: 207, Ack: 78, Len: 0
No. Time Source Destination Protocol Length Info
41 6.957666000 EXTERNAL-FTP-SERVER-IP LOCAL-IP FTP 108 Response: 125 Data connection already open; Transfer starting.
Frame 41: 108 bytes on wire (864 bits), 108 bytes captured (864 bits) on interface 0
Ethernet II, Src: Watchgua_12:34:56 (ab:cd:7f:12:34:56), Dst: Hewlett-_ab:cd:ef (00:1e:a1:ab:cd:ef)
Internet Protocol Version 4, Src: EXTERNAL-FTP-SERVER-IP (EXTERNAL-FTP-SERVER-IP), Dst: LOCAL-IP (LOCAL-IP)
Transmission Control Protocol, Src Port: ftp (21), Dst Port: 56623 (56623), Seq: 207, Ack: 78, Len: 54
File Transfer Protocol (FTP)
No. Time Source Destination Protocol Length Info
42 6.986757000 EXTERNAL-FTP-SERVER-IP LOCAL-IP FTP 106 Response: 426 Data connection closed. Error scanning content
Frame 42: 106 bytes on wire (848 bits), 106 bytes captured (848 bits) on interface 0
Ethernet II, Src: Watchgua_12:34:56 (ab:cd:7f:12:34:56), Dst: Hewlett-_ab:cd:ef (00:1e:a1:ab:cd:ef)
Internet Protocol Version 4, Src: EXTERNAL-FTP-SERVER-IP (EXTERNAL-FTP-SERVER-IP), Dst: LOCAL-IP (LOCAL-IP)
Transmission Control Protocol, Src Port: ftp (21), Dst Port: 56623 (56623), Seq: 261, Ack: 78, Len: 52
File Transfer Protocol (FTP)
No. Time Source Destination Protocol Length Info
43 6.986768000 LOCAL-IP EXTERNAL-FTP-SERVER-IP TCP 54 56623 > ftp [ACK] Seq=78 Ack=313 Win=65280 Len=0
Frame 43: 54 bytes on wire (432 bits), 54 bytes captured (432 bits) on interface 0
Ethernet II, Src: Hewlett-_ab:cd:ef (00:1e:a1:ab:cd:ef), Dst: Watchgua_12:34:56 (ab:cd:7f:12:34:56)
Internet Protocol Version 4, Src: LOCAL-IP (LOCAL-IP), Dst: EXTERNAL-FTP-SERVER-IP (EXTERNAL-FTP-SERVER-IP)
Transmission Control Protocol, Src Port: 56623 (56623), Dst Port: ftp (21), Seq: 78, Ack: 313, Len: 0
我收集了更多的日志 - 这次我监视的不只是端口 21 和 22 - 我还监视了 FTP 连接的 IP:
No. Time Source Destination Protocol Length Info
2607 11.440148000 __REMOTE__IP__ _LOCAL_IP_ FTP 105 Response: 227 Entering Passive Mode (198,104,198,16,17,233)
Frame 2607: 105 bytes on wire (840 bits), 105 bytes captured (840 bits) on interface 0
Ethernet II, Src: Watchgua_LOCALMAC (AA:BB:CC:LOCALMAC), Dst: Hewlett-_SUB_MAC (11:22:33:SUB_MAC)
Internet Protocol Version 4, Src: __REMOTE__IP__ (__REMOTE__IP__), Dst: _LOCAL_IP_ (_LOCAL_IP_)
Transmission Control Protocol, Src Port: ftp (21), Dst Port: 54613 (54613), Seq: 195, Ack: 60, Len: 51
File Transfer Protocol (FTP)
No. Time Source Destination Protocol Length Info
2608 11.440763000 _LOCAL_IP_ __REMOTE__IP__ FTP 74 Request: RETR testthing.txt
Frame 2608: 74 bytes on wire (592 bits), 74 bytes captured (592 bits) on interface 0
Ethernet II, Src: Hewlett-_SUB_MAC (11:22:33:SUB_MAC), Dst: Watchgua_LOCALMAC (AA:BB:CC:LOCALMAC)
Internet Protocol Version 4, Src: _LOCAL_IP_ (_LOCAL_IP_), Dst: __REMOTE__IP__ (__REMOTE__IP__)
Transmission Control Protocol, Src Port: 54613 (54613), Dst Port: ftp (21), Seq: 60, Ack: 246, Len: 20
File Transfer Protocol (FTP)
No. Time Source Destination Protocol Length Info
2609 11.441029000 _LOCAL_IP_ __REMOTE__IP__ TCP 66 54617 > 4585 [SYN] Seq=0 Win=65535 Len=0 MSS=1460 WS=128 SACK_PERM=1
Frame 2609: 66 bytes on wire (528 bits), 66 bytes captured (528 bits) on interface 0
Ethernet II, Src: Hewlett-_SUB_MAC (11:22:33:SUB_MAC), Dst: Watchgua_LOCALMAC (AA:BB:CC:LOCALMAC)
Internet Protocol Version 4, Src: _LOCAL_IP_ (_LOCAL_IP_), Dst: __REMOTE__IP__ (__REMOTE__IP__)
Transmission Control Protocol, Src Port: 54617 (54617), Dst Port: 4585 (4585), Seq: 0, Len: 0
No. Time Source Destination Protocol Length Info
2610 11.442013000 __REMOTE__IP__ _LOCAL_IP_ TCP 60 ftp > 54613 [ACK] Seq=246 Ack=80 Win=93360 Len=0
Frame 2610: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) on interface 0
Ethernet II, Src: Watchgua_LOCALMAC (AA:BB:CC:LOCALMAC), Dst: Hewlett-_SUB_MAC (11:22:33:SUB_MAC)
Internet Protocol Version 4, Src: __REMOTE__IP__ (__REMOTE__IP__), Dst: _LOCAL_IP_ (_LOCAL_IP_)
Transmission Control Protocol, Src Port: ftp (21), Dst Port: 54613 (54613), Seq: 246, Ack: 80, Len: 0
No. Time Source Destination Protocol Length Info
2622 11.459434000 __REMOTE__IP__ _LOCAL_IP_ TCP 66 4585 > 54617 [SYN, ACK] Seq=0 Ack=1 Win=65535 Len=0 WS=2 MSS=1400 SACK_PERM=1
Frame 2622: 66 bytes on wire (528 bits), 66 bytes captured (528 bits) on interface 0
Ethernet II, Src: Watchgua_LOCALMAC (AA:BB:CC:LOCALMAC), Dst: Hewlett-_SUB_MAC (11:22:33:SUB_MAC)
Internet Protocol Version 4, Src: __REMOTE__IP__ (__REMOTE__IP__), Dst: _LOCAL_IP_ (_LOCAL_IP_)
Transmission Control Protocol, Src Port: 4585 (4585), Dst Port: 54617 (54617), Seq: 0, Ack: 1, Len: 0
No. Time Source Destination Protocol Length Info
2623 11.459475000 _LOCAL_IP_ __REMOTE__IP__ TCP 54 54617 > 4585 [ACK] Seq=1 Ack=1 Win=4194304 Len=0
Frame 2623: 54 bytes on wire (432 bits), 54 bytes captured (432 bits) on interface 0
Ethernet II, Src: Hewlett-_SUB_MAC (11:22:33:SUB_MAC), Dst: Watchgua_LOCALMAC (AA:BB:CC:LOCALMAC)
Internet Protocol Version 4, Src: _LOCAL_IP_ (_LOCAL_IP_), Dst: __REMOTE__IP__ (__REMOTE__IP__)
Transmission Control Protocol, Src Port: 54617 (54617), Dst Port: 4585 (4585), Seq: 1, Ack: 1, Len: 0
No. Time Source Destination Protocol Length Info
2634 11.482207000 __REMOTE__IP__ _LOCAL_IP_ FTP 108 Response: 125 Data connection already open; Transfer starting.
Frame 2634: 108 bytes on wire (864 bits), 108 bytes captured (864 bits) on interface 0
Ethernet II, Src: Watchgua_LOCALMAC (AA:BB:CC:LOCALMAC), Dst: Hewlett-_SUB_MAC (11:22:33:SUB_MAC)
Internet Protocol Version 4, Src: __REMOTE__IP__ (__REMOTE__IP__), Dst: _LOCAL_IP_ (_LOCAL_IP_)
Transmission Control Protocol, Src Port: ftp (21), Dst Port: 54613 (54613), Seq: 246, Ack: 80, Len: 54
File Transfer Protocol (FTP)
No. Time Source Destination Protocol Length Info
2635 11.483996000 __REMOTE__IP__ _LOCAL_IP_ FTP-DATA 60 FTP Data: 4 bytes
Frame 2635: 60 bytes on wire (480 bits), 60 bytes captured (480 bits) on interface 0
Ethernet II, Src: Watchgua_LOCALMAC (AA:BB:CC:LOCALMAC), Dst: Hewlett-_SUB_MAC (11:22:33:SUB_MAC)
Internet Protocol Version 4, Src: __REMOTE__IP__ (__REMOTE__IP__), Dst: _LOCAL_IP_ (_LOCAL_IP_)
Transmission Control Protocol, Src Port: 4585 (4585), Dst Port: 54617 (54617), Seq: 1, Ack: 1, Len: 4
FTP Data (test)
No. Time Source Destination Protocol Length Info
2636 11.484173000 __REMOTE__IP__ _LOCAL_IP_ FTP 106 Response: 426 Data connection closed. Error scanning content
Frame 2636: 106 bytes on wire (848 bits), 106 bytes captured (848 bits) on interface 0
Ethernet II, Src: Watchgua_LOCALMAC (AA:BB:CC:LOCALMAC), Dst: Hewlett-_SUB_MAC (11:22:33:SUB_MAC)
Internet Protocol Version 4, Src: __REMOTE__IP__ (__REMOTE__IP__), Dst: _LOCAL_IP_ (_LOCAL_IP_)
Transmission Control Protocol, Src Port: ftp (21), Dst Port: 54613 (54613), Seq: 300, Ack: 80, Len: 52
File Transfer Protocol (FTP)
啊 - 因此我们测试了连接使用非标准控制端口的 FTP 服务器,并且文件传输正常进行。
只有当我们连接到使用标准控制端口 21 的 FTP 服务器时,传输才会出现问题。
我们清除了防火墙的设置,重建并重置了防火墙的设置。然后问题就解决了。
应用的设置与之前的设置相同。防火墙上的设置不知何故被破坏了。事实上,这就是她写的全部内容。
答案1
响应:426 数据连接已关闭。扫描内容时出错
有确实防火墙位于两者之间,用于拦截 FTP 通信。据我所知,Microsoft FTP 不支持扫描内容。
要明确的是:这更像是中央防火墙比Windows防火墙事物。
此外,非标准端口-working 支持这一点。(中央 FW 似乎只检查到端口 21 的流量)
与您的网络管理员讨论此事。
答案2
根据您收到的“426 数据连接已关闭。扫描内容时出错”消息,这看起来可能是网络防火墙正在扫描病毒。