通过配置iptables只开放21端口即可实现客户端的主动连接和被动连接

通过配置iptables只开放21端口即可实现客户端的主动连接和被动连接

环境
: 6.7 32-bit

配置
# 配置最基本的iptables规则
iptables -F
iptables -X
iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state –state NEW -p tcp –dport 21 -j ACCEPT
iptables -A INPUT -m state –state NEW -p tcp –dport 22 -j ACCEPT
iptables -P INPUT DROP
iptables -P FORWARD DROP

# 保存iptables规则
service iptables save

# 修改/etc/sysconfig/iptables-config文件
将IPTABLES_MODULES=””改成IPTABLES_MODULES=”ip_nat_ftp”

# 重启iptables
service iptables restart

更多iptables相关教程见以下内容

7.0关闭默认防火墙启用iptables防火墙 

iptables使用范例详解

防火墙iptables详细教程

iptables的备份、恢复及防火墙脚本的基本使用

下防火墙iptables用法规则详解

下iptables防火墙设置

转载自:https://www.linuxidc.com/Linux/2016-05/131221.htm

声明: 除非转自他站(如有侵权,请联系处理)外,本文采用 BY-NC-SA 协议进行授权 | 智乐兔
转载请注明:转自《通过配置iptables只开放21端口即可实现客户端的主动连接和被动连接
本文地址:https://www.zhiletu.com/archives-6619.html
关注公众号:智乐兔

赞赏

wechat pay微信赞赏alipay pay支付宝赞赏

上一篇
下一篇

相关文章

在线留言

你必须 登录后 才能留言!

在线客服
在线客服 X

售前: 点击这里给我发消息
售后: 点击这里给我发消息

智乐兔官微