Home>Article>Operation and Maintenance> How to check if there is a firewall in centos7
In centos7, you can use the "sudo systemctl status firewalld" command to check whether there is a firewall. This command can check the status of the current firewall. When "active (running)" appears, it means that the firewall has been turned on.
The operating environment of this article: centos 7 system, Dell G3 computer.
1. Open, close, and disable firewall commands
(1) Set up the firewall at startup: systemctl enable firewalld.service
(2) Set the firewall to be disabled at boot: systemctl disable firewalld.service
(3) Start the firewall: systemctl start firewalld
(4) Turn off the firewall: systemctl stop firewalld
(5) Check the firewall status: systemctl status firewalld
2. Use firewall-cmd to configure the port
(1) Check the firewall status: firewall-cmd --state
(2) Reload the configuration: firewall-cmd --reload
(3) View the open ports: firewall-cmd --list-ports
(4) Open the firewall port: firewall -cmd --zone=public --add-port=9200/tcp --permanent
Command meaning:
–zone #scope
–add-port= 9200/tcp #Add port, the format is: port/communication protocol
--permanent #Permanently effective, without this parameter it will be invalid after restarting
Note: After adding the port, you must use the command firewall-cmd --reload will take effect after reloading
(5) Close the firewall port: firewall-cmd --zone=public --remove-port=9200/tcp --permanent
See centos7 To check the status of the firewall, the command to view is
sudo systemctl status firewalld.
After checking, if you see active (running), it means the firewall is turned on.
Recommended tutorial: "centos tutorial"
The above is the detailed content of How to check if there is a firewall in centos7. For more information, please follow other related articles on the PHP Chinese website!