Firewalld
查看防火墙状态
systemctl status firewalld
开启防火墙
systemctl start firewalld
关闭防火墙
systemctl stop firewalld
添加新规则
firewall-cmd --zone=public --add-source=172.43.0.0/16 --permanent
添加指定端口规则
firewall-cmd --zone=public --add-port=80/tcp --permanent
移除指定端口规则
firewall-cmd --zone=public --remove-port=80/tcp --permanent
重新加载Firewalld
firewall-cmd --reload
查看防火墙规则
firewall-cmd --zone=public --list-all
直接编辑配置文件
vi /etc/firewalld/zones/public.xml
<port port="80" protocol="tcp"/>
<rule family="ipv4">
<source address="172.43.12.1"/>
<accept/>
</rule>
<rule family="ipv4">
<source address="172.43.12.1"/>
<port port="80" protocol="tcp"/>
<reject/>
</rule>