Home > Article > Operation and Maintenance > Detailed explanation of CentOS firewalld (firewall) instructions
The following column centos system tutorial will introduce CentOS firewalld (firewall) instructions to everyone. I hope it will be helpful to friends in need!
CentOS firewalld (firewall) command
1. View firewalld status
Check the firewalld service status command:
systemctl status firewalld
Check the firewalld status command:
firewall-cmd --state
2. Turn on, Restart and shut down the firewalld service
Open:
service firewalld start
Close:
service firewalld stop
Restart:
service firewalld restart
3. Query, open and close firewalld ports
Query all open ports:
firewall-cmd --list-all
Query whether a certain port is open :
firewall-cmd --query-port=[端口]/tcp
Open port:
firewall-cmd --permanent --add-port=[端口]/tcp
Close port:
firewall-cmd --permanent --remove-port=[端口]/tcp
Refresh service (refresh is required after opening and closing port operations to take effect ):
firewall-cmd --reload
PS: Error ModuleNotFoundError: No module named 'gi'
Execute command: sudo vim /usr/bin/firewall-cmd, open Modify the first line of python in the file to python2
For more centos related technical articles, please visit the centos basic tutorial column!
The above is the detailed content of Detailed explanation of CentOS firewalld (firewall) instructions. For more information, please follow other related articles on the PHP Chinese website!