Cd/usr/lib/firewalld/services directory to store the defined Network service and port parameters, system parameters, can not be modified.
cd/etc/firewalld/services/
Systemctl Status Firewall View Firewall service status
Firewall-cmd--state View the status of firewall
Firewall-cmd--list-all View Firewall rules
Method 1, modify the configuration file/etc/firewalld/zones/public.xml
[Root@nginx01 zones]# Cat Public.xml
<?xml version= "1.0" encoding= "Utf-8"?>
<zone>
<short>Public</short>
<description>for use with public areas. You don't trust the "other computers" networks to not harm your computer. Only selected incoming connections are accepted.</description>
<rule family= "IPv4" >
<source address= "122.10.70.234"/>
<port protocol= "UDP" port= "514"/>
<accept/>
</rule>
<rule family= "IPv4" >
<source address= "123.60.255.14"/>
<port protocol= "tcp" port= "10050-10051"/>
<accept/>
</rule>
<rule family= "IPv4" >
<source address= "192.249.87.114"/> The specified IP, specify the port, protocol
<port protocol= "tcp" port= "/>"
<accept/>
</rule>
<rule family= "IPv4" > Port 9527 ports for any IP access server
<port protocol= "tcp" port= "9527"/>
<accept/>
</rule>
</zone>
Add the required rules, put the source IP to 192.249.87.114, Port 80, protocol TCP
Need to back up the firewall before
Restart the Firewalld.service service
Service Firewalld Restart
Method 2,
Firwall-cmd--permanent--add-port=9527/tcp Inserts the firewall rule, puts through 9527 port.
This rule is generated automatically in/etc/firewall/zones/public.xml.
<service name= "Dhcpv6-client"/>
<port protocol= "tcp" port= "9527"/>
</zone>
Firewall-cmd--permanent--query-port=9527/tcp Query If the rule you just inserted takes effect