iptables 转ftp端口

iptables 转ftp端口 

 

#iptables 转ftp端口  /etc/sysconfig/iptables-config文件结尾加ftp支持,顺序不能改

cat >>/etc/sysconfig/iptables-config<<EOF
IPTABLES_MODULES="ip_conntrack_ftp"
IPTABLES_MODULES="ip_nat_ftp"
EOF


sysctl -w net.ipv4.ip_forward=1

modprobe ip_conntrack_ftp
modprobe ip_nat_ftp


iptables -t nat -A PREROUTING -p tcp --dport 22222  -j DNAT --to-destination 192.168.0.20:21
iptables -t nat -A POSTROUTING  -p tcp --dport 21 -j MASQUERADE

 

 

posted @ 2019-10-22 17:31  些许记忆  阅读(415)  评论(0编辑  收藏  举报