firewall-cmd --reload
systemctl status firewalld #查看状态
firewall-cmd --list-all
firewall-cmd --list-rich-rules
firewall-cmd --list-services
firewall-cmd --list-all-zones
firewall-cmd --get-default-zone
firewall-cmd --get-active-zones
firewall-cmd --get-services
systemctl start firewalld #启动
systemctl stop firewalld #停止
firewall-cmd –reload #重启
systemctl disable firewalld #开机禁用
systemctl enable firewalld #开机启动
firewall-cmd --zone=public --add-port=10022/tcp --permanent
--zone :网络区域
--permanent:永久生效,没有此参数重启后失效
firewall-cmd --add-service=http –permanent #添加一个服务permanent
firewall-cmd --add-port=80/tcp –permanent # permanent上开放一个80端口
firewall-cmd --zone=public --add-rich-rule 'rule family="ipv4" source address="192.168.1.10" accept' --permanent
firewall-cmd --zone=public --add-rich-rule 'rule family="ipv4" source address="192.168.2.0/24" accept' --permanent
允许192.168.1.10所有访问TCP协议的22端口
firewall-cmd --zone=public --add-rich-rule 'rule family="ipv4" source address="192.168.1.10" port port=22 protocol=tcp accept' --permanent
firewall-cmd --remove-service=http –permanent
firewall-cmd --remove-port=80/tcp –permanent
firewall-cmd --zone=public --remove-rich-rule 'rule family="ipv4" source address="192.168.1.10" accept' --permanent
<zone>
<short>Publicshort>
<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.description>
<service name="ssh"/>
<service name="dhcpv6-client"/>
<service name="cockpit"/>
<port protocol="tcp" port="22/">
<rule family="ipv4">
<source address="196.168.1.1"/>
<accept/>
rule>
<rule family="ipv4">
<source address="192.168.1.10"/>
<port port="22" protocol="tcp"/>
<accept/>
rule>
zone>
<port protocol="tcp" port="10022">
<rule family="ipv4">
<source address="196.168.1.1"/>
<accept/>
rule>
<rule family="ipv4">
<source address="192.168.1.10"/>
<port port="22" protocol="tcp"/>
<accept/>
rule>