linux firewalld public.xml配置
时间: 2023-11-10 09:54:21 浏览: 45
Firewalld是一个Linux防火墙管理工具,其中public.xml是一个配置文件,用于指定公共区域的防火墙规则。
以下是一个public.xml文件的示例配置:
```
<?xml version="1.0" encoding="utf-8"?>
<firewall>
<rule family="ipv4">
<source address="192.168.1.0/24"/>
<source address="192.168.2.0/24"/>
<service name="http"/>
<service name="https"/>
<accept/>
</rule>
<rule family="ipv4">
<source address="192.168.1.0/24"/>
<source address="192.168.2.0/24"/>
<service name="ssh"/>
<accept/>
</rule>
</firewall>
```
该配置文件指定了两个规则:
1. 允许来自192.168.1.0/24和192.168.2.0/24的IP地址访问http和https服务。
2. 允许来自192.168.1.0/24和192.168.2.0/24的IP地址访问SSH服务。
要将此配置文件应用于您的系统,请按照以下步骤进行操作:
1. 将public.xml文件放置在/etc/firewalld/zones/public.xml目录中。
2. 运行以下命令以重新加载防火墙规则:
```
sudo firewall-cmd --reload
```
这将重新加载防火墙规则,并将您的public.xml配置文件应用于公共区域。