CentOS4.2(RHEL4)系统
Iptables 1.2.11 (系统自带)
eth0 公网静态IP
eth1 内网IP
目的,用SNAT代理内网上网,并只开放部分端口和应用。
编写如下脚本,运行后,内网客户端上网、QQ、MSN等正常,
但,FTP无法连接,错误信息如下。
请高人指点。
谢谢!
脚本如下:
########### FW ##########
/sbin/iptables -F
/sbin/iptables -X
/sbin/iptables -Z
/sbin/iptables -P INPUT ACCEPT
/sbin/iptables -P OUTPUT ACCEPT
/sbin/iptables -P FORWARD DROP
########### NAT ##########
echo "1" > /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -F
/sbin/iptables -t nat -X
/sbin/iptables -t nat -Z
/sbin/modpobe ip_nat_ftp
#/sbin/modpobe ip_conntrack
#/sbin/modpobe ip_conntrack_ftp
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
/sbin/iptables -A FORWARD -p tcp -m multiport --port 21,25,80,110,443,1863,37054 -j ACCEPT
/sbin/iptables -A FORWARD -p udp -m multiport --port 53,51596 -j ACCEPT
/sbin/iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -p icmp -j ACCEPT
/sbin/iptables -t nat -L
/sbin/iptables -L
FTP错误提示如下:
FlashFXP v3.1.10 build 1067 [BETA RELEASE]
[右] 正在连接到 ftp.redhat.com -> DNS=ftp.redhat.com IP=66.187.224.30 PORT=21
[右] 正在连接到 ftp.redhat.com
[右] 220 Red Hat FTP server ready. All transfers are logged. (FTP) [no EPSV]
[右] USER anonymous
[右] 331 Please specify the password.
[右] PASS (隐藏)
[右] 230 Login successful.
[右] SYST
[右] 215 UNIX Type: L8
[右] FEAT
[右] 211-Features:
[右] EPRT
[右] EPSV
[右] MDTM
[右] PASV
[右] REST STREAM
[右] SIZE
[右] TVFS
[右] 211 End
[右] PWD
[右] 257 "/"
[右] TYPE A
[右] 200 Switching to ASCII mode.
[右] PASV
[右] 227 Entering Passive Mode (66,187,224,30,48,77)
[右] 正打开数据连接 IP: 66.187.224.30 端口: 12365
[右] 数据 Socket 错误: 连接超时
[右] 列表错误
[右] PASV
[右] 227 Entering Passive Mode (66,187,224,30,47,130)
[右] 正打开数据连接 IP: 66.187.224.30 端口: 12162
[右] 数据 Socket 错误: 连接超时
[右] 列表错误
[右] QUIT
[右] 221 Goodbye.
[右] 注销: ftp.redhat.com |