<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<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>
<interface name="eno1"/>
<rule family="ipv4">
<source address="120.115.4.0/24"/>
<service name="ssh"/>
<accept/>
</rule>
<rule family="ipv4">
<source address="120.115.4.0/24"/>
<accept/>
</rule>
</zone>
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>cloudcmd</short>
<description>Cloud Commander is a file manager for the web. It includes a com$
<port protocol="tcp" port="8000"/>
</service>
重新載入設定
# 重新載入設定
sudo firewall-cmd --reload
#add source IP 限制
firewall-cmd --zone=public \
--add-rich-rule 'rule family="ipv4" source address="192.168.0.0/24" service name="http" accept' \
--permanent
#remove source IP 限制
firewall-cmd --zone=public --remove-rich-rule 'rule family="ipv4" source address="192.168.0.0/24" service name="http" accept' --permanent
cat /etc/firewalld/public.xml
<?xml version="1.0" encoding="utf-8"?>
<zone>
<short>Public</short>
<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"/>
<service name="syncthing-gui"/>
<service name="cloudcmd"/>
<rule family="ipv4">
<source address="192.168.0.0/24"/>
<service name="http"/>
<accept/>
</rule>
</zone>