LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 947|回复: 1

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

[复制链接]
发表于 2003-5-31 16:26:06 | 显示全部楼层 |阅读模式
系统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
发表于 2003-5-31 18:19:15 | 显示全部楼层
FTP服务:FTP服务有点特别,因为需要两个端口,因为FTP有命令通道和数据通道。其中命令端口为21,数据端口为20,并且有主动和消极两种服务模式,其消极模式连接过程为:FTP客户端首先向FTP服务器发起连接请求,三步握手后建立命令通道,然后由FTP服务器请求建立数据通道,成功后开始传输数据,现在大多数FTP客户端均支持消极模式,因为这种模式可以提高安全性。FTP服务采用tcp协议。规则为:eth0=>仅允许目的为内部网ftp服务器的包。



http://www.linuxaid.com.cn/articles/1/4/145502601.shtml
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表