如何设置Iptables,让外网可以访问本地的FTP,,,,,,,,,,,,

由 prolife 在 05-31-2003 16:26 发表:

如何设置Iptables,让外网可以访问本地的FTP,,,,,,,,,,,,

系统redhat9.0,完全安装。

想实现功能如下:

1,对外无限制访问,

2,外网只能访问本地FTP

结果:对外无访问没问题,但本地FTP却无法连接。

问题:为何FTP没办法连接???错在哪里??

防火墙清单:


iptables -F OUTPUT

iptables -F FORWARD

iptables -F INPUT

iptables -P INPUT DROP

iptables -A INPUT -p tcp --dport 21 -i ppp0 -j ACCEPT

iptables -A INPUT -i ppp0 -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -P OUTPUT ACCEPT

iptables -P FORWARD DROP


touch /etc/rc.d/firewall

chmod u+x /etc/rc.d/firewall

把iptables清单写入firewall中,执行./firewall


iptables -L

target prot opt source destination

ACCEPT tcp -- anywhere anywhere tcp dpt:ftp

ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED

Chain FORWARD (policy DROP)

target prot opt source destination

Chain OUTPUT (policy ACCEPT)

target prot opt source destination


由 nicosoft 在 05-31-2003 18:19 发表:


FTP服务:FTP服务有点特别,因为需要两个端口,因为FTP有命令通道和数据通道。其中命令端口为21,数据端口为20,并且有主动和消极两种服务模式,

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus