Firewalls文件配置防火墙

1、源文件

/usr/lib/firewalld/services

 

 

 

2、文件配置

cat /etc/firewalld/zones/public.xml

<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<rule family="ipv4">
<source address="10.0.0.45/26"/>
<accept/>  
</rule>

<rule family="ipv4">
<port protocol="tcp" port="7011-7012"/>
<accept/>  
</rule>

<rule family="ipv4">
<port protocol="tcp" port="80"/>
<accept/>  
</rule>

禁止 10.8.23.0/24段访问ssh服务
<rule family="ipv4">
<source address="10.8.23.0/24"/>
<service name="ssh"/>
<reject/>
</rule>

</zone>

3、启动与关闭

systemctl restart firewalld.service
systemctl stop firewalld.service
systemctl status firewalld.service

4、 检查配置

 firewall-cmd --list-all

 

posted on 2021-02-23 16:04  !!雪莲花!!  阅读(127)  评论(0)    收藏  举报