In centos7, you can use "firewalld-cmd" to view the open ports. "firewalld-cmd" can display firewall-related configuration information. The syntax is "firewall-cmd --zone=public -- list-ports".
The operating environment of this article: centos 7 system, Dell G3 computer.
You can use the firewall-cmd --zone=public --list-ports command to view all open ports
The centos7 version is very useful for the firewall To strengthen, no longer use the original iptables, enable firewalld
The example is as follows:
Configure firewalld-cmd
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 zone information: firewall-cmd --get-active-zones
View the zone to which the specified interface belongs: firewall-cmd --get-zone-of-interface=eth0
Reject all packages: firewall-cmd --panic-on
Cancel the rejection status : firewall-cmd --panic-off
Check whether it is rejected: firewall-cmd --query-panic
You can use any A firewalld configuration tool to configure zones and firewall policies.
Expand knowledge:
Recommended tutorial: "centos tutorial"
The above is the detailed content of How to check which ports are open in centos7. For more information, please follow other related articles on the PHP Chinese website!