当我做wget ftp://x.x.x.x:myport/a.jpg
--date time-- ftp://x.x.x.x:myport/a.jpg
=> ‘a.jpg’
Connecting to x.x.x.x:myport... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD not needed.
==> SIZE a.jpg ... 982159
==> PASV ...
然后 wget “冻结”,一段时间后它继续
==> PASV ... couldn't connect to x.x.x.x port myport: Connection timed out
Retrying.
所以问题是如何修复此错误/行为。从 Firefox 和 curl 我可以正常下载文件,所以这不是服务器故障。服务器使用被动 ftp 模式。服务器正在运行 Windows。
我的/etc/wgetrc
passive_ftp = on
当我通过 连接时也会出现奇怪的行为ftp
。我可以登录,但当我发送命令时,它显示227 Entering Passive Mode
,然后冻结。
我的curl
日志
0* Connected to x.x.x.x (x.x.x.x) port myport (#0)
< 220 Microsoft FTP Service
> USER anonymous
< 331 Anonymous access allowed, send identity (e-mail name) as password.
> PASS [email protected]
< 230 User logged in.
> PWD
< 257 "/" is current directory.
* Entry path is '/'
* Request has same path as previous transfer
> EPSV
* Connect data stream passively
* ftp_perform ends with SECONDARY: 0
< 229 Entering Extended Passive Mode (|||dataport|)
* Trying x.x.x.x:dataport...
* Connecting to x.x.x.x (x.x.x.x) port dataport
* Connected to x.x.x.x (x.x.x.x) port myport (#0)
> TYPE I
< 200 Type set to I.
> SIZE a.jpg
< 213 982159
> RETR a.jpg
< 125 Data connection already open; Transfer starting.
* Maxdownload = -1
* Getting file with size: 982159
{ [1460 bytes data]
33 959k 33 320k 0 0 984k 0 --:--:-- --:--:-- --:--:-- 981k* Remembering we are in dir ""
< 226 Transfer complete.
100 959k 100 959k 0 0 1759k 0 --:--:-- --:--:-- --:--:-- 1756k
* Connection #0 to host x.x.x.x left intact
答案1
事实证明,路由器上的几个数据端口没有转发。