我无法与在 Windows 7 计算机上运行的 FTP 服务器建立连接。我的 NAT 路由器打开了 5000-5100 和 21 端口,我有外部 IP 地址,LAN 中的 FTP 已启动,已在 ftptest.net 和其他使用我的外部 IP 地址的 FTP 测试器上进行了测试,一切正常。但当我尝试从浏览器访问它时,它说连接被拒绝。还尝试了一些 Python 和 C# 脚本来列出 FTP 目录,在 LAN 中可以正常使用,但使用外部 IP 时,出现同样的错误。
FTPTest.net 输出:
Status: Resolving address of 192.140.xx.xxx
Status: Connecting to 192.140.xx.xxx
Warning: The entered address does not resolve to an IPv6 address.
Status: Connected, waiting for welcome message...
Reply: 220-FileZilla Server 0.9.60 beta
Reply: 220-written by Tim Kosse ([email protected])
Reply: 220 Please visit https://filezilla-project.org/
Command: CLNT https://ftptest.net on behalf of 192.140.xx.xxx
Reply: 200 Don't care
Command: AUTH TLS
Reply: 234 Using authentication type TLS
Status: Performing TLS handshake...
Status: TLS handshake successful, verifying certificate...
Status: Received 1 certificates from server.
Status: cert[0]: subject='CN=192.140.xx.xxx,C=55,ST=Bahia,L=Itabuna,O=Contato Pericia Automotiva,OU=Contato Itabuna,[email protected]' issuer='CN=192.140.xx.xxx,C=55,ST=Bahia,L=Itabuna,O=Contato Pericia Automotiva,OU=Contato Itabuna,[email protected]'
Command: USER anonymous
Reply: 331 Password required for anonymous
Command: PASS ************************
Reply: 230 Logged on
Command: SYST
Reply: 215 UNIX emulated by FileZilla
Command: FEAT
Reply: 211-Features:
Reply: MDTM
Reply: REST STREAM
Reply: SIZE
Reply: MLST type*;size*;modify*;
Reply: MLSD
Reply: AUTH SSL
Reply: AUTH TLS
Reply: PROT
Reply: PBSZ
Reply: UTF8
Reply: CLNT
Reply: MFMT
Reply: EPSV
Reply: EPRT
Reply: 211 End
Command: PBSZ 0
Reply: 200 PBSZ=0
Command: PROT P
Reply: 200 Protection level set to P
Command: PWD
Reply: 257 "/" is current directory.
Status: Current path is /
Command: TYPE I
Reply: 200 Type set to I
Command: PASV
Reply: 227 Entering Passive Mode (192,140,xx,xxx,19,140)
Command: MLSD
Status: Data connection established, performing TLS handshake...
Status: TLS handshake successful, verifying certificate...
Status: Received 1 certificates from server.
Status: cert[0]: subject='CN=192.140.xx.xxx,C=55,ST=Bahia,L=Itabuna,O=Contato Pericia Automotiva,OU=Contato Itabuna,[email protected]' issuer='CN=192.140.xx.xxx,C=55,ST=Bahia,L=Itabuna,O=Contato Pericia Automotiva,OU=Contato Itabuna,[email protected]'
Status: TLS session of transfer connection has been resumed.
Reply: 150 Opening data channel for directory listing of "/"
Reply: 226 Successfully transferred "/"
Listing: type=dir;modify=20161214150710; 2016
Listing: type=file;modify=20170808123602;size=2459; 2016 - Atalho.lnk
Listing: type=dir;modify=20170825193146; 2017
Listing: type=file;modify=20141126124218;size=244012; Apresentação1.png
Listing: type=file;modify=20160615135130;size=376600; BOLSONI RASCUNHO.jpg
Listing: type=file;modify=20170306121017;size=349184; Caixa depesas Contato.xls
Listing: type=dir;modify=20170830151015; CONTATO
Listing: type=file;modify=20141126124820;size=21129; CONTATO.jpeg
Listing: type=dir;modify=20170731185326; Documentos
Listing: type=file;modify=20140204041918;size=3049489; DSC00016.JPG
Status: Skipped display of 10 listing lines
Status: Success
正如我之前所说,路由器端口 5000-5100 和 21 是开放的。
在 FileZilla 服务器选项上:
- 被动模式设置:
- 自定义端口范围:5000 - 5100
- 被动模式传输的外部服务器 IP 地址:
- 192.140.xx.xxx
- FTP over TLS 设置:
- 启用 FTP over TLS 支持
- 在默认端口 990 上侦听隐式 FTP over TLS 连接
FileZilla 界面上没有错误或警告。
Windows 上的防火墙:
创建入站规则以允许在本地端口 5000-5100 上与 TCP 协议进行连接,甚至添加了 21 和 990 以确保仍然出现相同的错误,远程端口所有端口。
我还可以做些什么?
答案1
所以,我刚刚又做了同样的测试,今天可以正常工作了,我不知道为什么,也许我在不知情的情况下在我的网络内部使用外部 IP 地址进行测试,只是也许......但我的问题现在已经解决了。