分享

centos7防火墙配置

 binke 2015-03-24
centos7防火墙配置
CentOS7使用的是Linux Kernel 3.10.0的内核版本,新版的Kernel内核已经有了防火墙netfilter,并且firewalld的使用效能更高,稳定性更好。
CentOS7配置防火墙的两种方法:
一、使用xml配置文件的方式配置;
方法一
cp /usr/lib/firewalld/services/http.xml /etc/firewalld/services/
firewall-cmd --reload
二、使用命令的方式配置;
方法二
##Add
firewall-cmd --permanent --zone=public --add-port=80/tcp
##Remove
firewall-cmd --permanent --zone=public --remove-port=80/tcp
##Reload
firewall-cmd --reload
其中,方法二的配置方式是间接修改/etc/firewalld/zones/public.xml文件,方案一也需要在public.xml里面新增,否则http的防火墙规则不会生效,而且两种配置方式都需要重新载入防火墙。
附:
查看防火墙状态
systemctl status firewalld.service
启动防火墙
systemctl start firewalld.service
关闭防火墙
systemctl stop firewalld.service
重新启动防火墙

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多