CentOS7 use firewalld to open and close the firewall and port, centos7firewalld
1. Basic use of firewalld start: systemctl start firewalld view status: systemctl status firewalld stop: systemctl disable firewalld disable: systemctl stop firewalld 2. systemctl is the main tool in CentOS7 service management tools. It integrates the functions of previous services and chkconfig.
Start a service: systemctl start firewalld. service
Disable a service: systemctl stop firewalld. service
Restart a service: systemctl restart firewalld. service
Displays the status of a service: systemctl status firewalld. service
Enable a service at startup: systemctl enable firewalld. service
Disable a service at startup: systemctl disable firewalld. service
Check whether the service is started: systemctl is-enabled firewalld. service
View the list of started services: systemctl list-unit-files | grep enabled
View the list of failed services: systemctl -- failed
3. Configure firewalld-cmd
View version: firewall-cmd -- version view help: firewall-cmd -- help display status: firewall-cmd -- state view all opened ports: firewall-cmd -- zone = public -- list-ports update firewall rules: firewall-cmd -- reload view region information: firewall-cmd -- get-active-zones to view the region of the specified interface: firewall-cmd -- get-zone-of-interface = eth0 reject all packets: firewall-cmd -- panic-on cancel rejection status: firewall-cmd -- panic-off check whether the request is rejected: firewall-cmd -- query-panic how to enable a port and add firewall-cmd -- zone = public -- add-port = 80/tcp -- permanent (-- permanent takes effect permanently, this parameter does not expire after restart) reload firewall-cmd -- reload view firewall-cmd -- zone = public -- query-port = 80/tcp delete firewall-cmd -- zone = public -- remove-port = 80/tcp -- permanent