远程客户端尝试连接到CentoOS中的vsftpd返回连接被拒绝

我正在尝试在我的服务器上configurationftp服务 。 一切似乎都已到位,但客户总是得到这个回应: 连接被拒绝

这是我的iptables文件的内容

# Generated by iptables-save v1.4.7 on Tue Jun 4 17:43:03 2013 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [3:412] -A INPUT -p tcp -m tcp --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT -A FORWARD -j REJECT --reject-with icmp-host-prohibited -A OUTPUT -p tcp -m tcp --sport 3306 -m state --state ESTABLISHED -j ACCEPT COMMIT # Completed on Tue Jun 4 17:43:03 2013 

如果你需要它,这是什么iptables -L返回:

 Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:mysql state NEW,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT tcp -- anywhere anywhere tcp dpt:http ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp -- anywhere anywhere ACCEPT all -- anywhere anywhere ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh REJECT all -- anywhere anywhere reject-with icmp-host-prohibited ACCEPT tcp -- anywhere anywhere tcp dpt:ftp Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp spt:mysql state ESTABLISHED 

我很确定这与iptables有关,尽pipe我可能是错的。 我遵循本教程中的每一步。 有任何想法吗?

你需要把所有的REJECT之上的ftp接受。 具体这一行

 -A INPUT -m state --state NEW -p tcp --dport 21 -j ACCEPT 

需要走高于这条线

 -A INPUT -j REJECT --reject-with icmp-host-prohibited 

/etc/syconfig/iptables文件中,按照您所关注的文档。