当前位置:
首页
文章
前端
详情

CentOS 7.0如何将iptables作为防火墙(默认使用的是firewall作为防火墙)

1、直接关闭防火墙
 systemctl stop firewalld.service #停止firewall
 systemctl disable firewalld.service #禁止firewall开机启动

2、设置 iptables service
 yum -y install iptables-services

 如果要修改防火墙配置,如增加防火墙端口3306
 vi /etc/sysconfig/iptables
 增加规则
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
 保存退出后

 systemctl restart iptables.service #重启防火墙使配置生效
 systemctl enable iptables.service #设置防火墙开机启动
 最后重启系统使设置生效即可

------------------------------------------------------------------------------------

启动/关闭iptables防火墙
 重启后有效:
  开启: chkconfig iptables on
  关闭: chkconfig iptables off
 重启后失效:
  开启: service iptables start
  关闭: service iptables stop

免责申明:本站发布的内容(图片、视频和文字)以转载和分享为主,文章观点不代表本站立场,如涉及侵权请联系站长邮箱:xbc-online@qq.com进行反馈,一经查实,将立刻删除涉嫌侵权内容。