CentOS7 use systemctl Command to manage a single service of the system , stay CentOS7 In terms of firewalld( firewall ) Service opening , close , The same instruction is used for status queries , The operation is as follows :

Start firewall : systemctl start firewalld

View firewall status : systemctl status firewalld 

Turn off the firewall : systemctl stop firewalld

Enable firewall service at power on :systemctl enable firewalld

Disable firewall service at power on :systemctl disable firewalld

Query whether the firewall service is started :systemctl is-enabled firewalld

Query the list of started services :systemctl list-unit-files|grep enabled

Query the list of services that failed to start :systemctl –failed

When installing software or column Library , In addition to directly opening and closing the firewall , You can also open the connection directly through the port operation ; Add port :firewall-cmd –zone=public –add-port=80/tcp –permanent 

Update firewall rules :firewall-cmd –reload

View port status :firewall-cmd –zone=public –query-port=80/tcp

Remove open ports :firewall-cmd –zone=public –remove-port=80/tcp –permanent

Firewall rules are updated every time , All need to be updated :firewall-cmd –reload, Update status ;

in addition , After updating the firewall settings , You can also view all open ports :firewall-cmd –zone=public –list-ports