Centos7 View the open port corresponding to the firewall

View open ports
firewall-cmd --list-ports

Open port
firewall-cmd --zone=public --add-port=80/tcp --permanent
Command meaning :
–zone # Scope
–add-port=80/tcp # Add port , The format is : port / Communication protocol
–permanent # Permanent effect , Failure after restart without this parameter

Remember to restart after opening the port

start-up :
systemctl start firewalld
stop it :
systemctl stop firewalld
restart :
systemctl restart firewalld.service
View status :
systemctl status firewalld
Boot up :
systemctl enable firewalld.service
Boot disabled :
systemctl disable firewalld
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 services that failed to start :
systemctl --failed
View version :
firewall-cmd --version
view help :
firewall-cmd --help
Display status :
firewall-cmd --state
View all open ports :
firewall-cmd --zone=public --list-ports
Update firewall rules :
firewall-cmd --reload
View area information :
firewall-cmd --get-active-zones
View the area of the specified interface :
firewall-cmd --get-zone-of-interface=eth0
Reject all packages :
firewall-cmd --panic-on
Cancel reject status :
firewall-cmd --panic-off
Check whether to reject :
firewall-cmd --query-panic
to open up 80 port :
firewall-cmd --zone=public --add-port=80/tcp --permanent
(–permanent Permanent effect , Failure after restart without this parameter )
see 80 port :
firewall-cmd --zone=public --query-port=80/tcp
delete 80 port :
firewall-cmd --zone=public --remove-port=80/tcp --permanent
Open port range :
firewall-cmd --permanent --zone=public --add-port=8080-9999/tcp // permanent
Reload makes the configuration take effect immediately :
firewall-cmd --reload