centos7防火墙配置

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
重新启动防火墙
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值