这是我在CentOS论坛上重新发布我的问题,在这里 ,我感到相当头痛,StackExchange在过去对我很好。
我有一些问题通过FTP连接到我的服务器。 我使用的ISPConfig后端(这是我不熟悉),我有一个谷歌,看看我是否可以正确设置FTP。 ISPConfig说我的FTP服务正在运行。
我得到以下两个错误取决于我尝试从哪里连接:
https://ftptest.net/
Error: Could not connect to server: No route to host Make sure to enter the correct server address Ensure that the server is up and running. Check your firewall configuration, port 21 needs to be opened. Check your NAT router configuration, port 21 needs to be forwarded. In some cases your ISP might block that port. In this case configure the server to use a different port. Contact your ISP for details.
FileZilla中
Status: Connection attempt failed with "ECONNREFUSED - Connection refused by server".
我已经做了一个pingtesting我的主机名,它解决了(96毫秒,所以它不会迷路)
以下是我认为相关的conf文件:
iptables -L -n
你的iptables-config文件需要包含nf_conntrack_ftp作为需要加载的模块… – TrevorH
我快速search了如何加载模块,因为它已经在我的proftpd.conf文件中,并在运行命令后在ServerFault上遇到了这个问题,这是我的输出/etc/rc.d/rc.sysinit输出
UPDATE
我可以确认端口21是开放的,因为我从netsat得到以下netsat
tcp 0 0 :::21 :::* LISTEN 1069/proftpd
我尝试在terminal使用ftp命令,这是我的回应
computer:~ user$ ftp IP-ADDRESS ftp: Can't connect to `IP-ADDRESS': Connection refused
TL;博士
我不能通过FTP连接,我不知道发生了什么…
编辑
iptables -L -n输出 Tracepath显示到达主机本身没有问题(从configuration文件中获取主机名)。 但是当试图到达主机的端口21时,tcpdump会显示:
07:18:15.545762 IP my.router.48912 > your.host.ftp: Flags [S], seq 1872206172, win 29200, options [mss 1460,sackOK,TS val 621547848 ecr 0,nop,wscale 7], length 0 07:18:16.034781 IP your.host > my.router: ICMP host your.host unreachable - admin prohibited, length 68
原因可能是你的iptables规则,它没有为端口21指定特定的INPUT处理,但只为22(ssh)和8080:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited
因此,它会落到icmp-host-prohibited这一行,这将导致“ICMP主机your.host不可访问 – pipe理员禁止,长度为68”,如上所示。
我不知道如何使用ISPConfig来解决这个问题,但是您至less需要为端口21添加一条规则。而且,如果您想要允许被动的FTP模式,您还需要允许更多,请参阅https:// unix。 stackexchange.com/questions/93554/iptables-to-allow-incoming-ftp 。 被动模式是必要的,如果你的任何客户端不能使用主动模式,因为他们在一些防火墙或路由器,其中包括大多数用户在家庭路由器,也在大多数移动networking。
并确保iptables规则实际上被激活。