Home > Operation and Maintenance > CentOS > Detailed explanation of CentOS firewalld (firewall) instructions

Detailed explanation of CentOS firewalld (firewall) instructions

藏色散人
Release: 2020-07-03 13:37:07
forward
2764 people have browsed it

The following column centos system tutorial will introduce CentOS firewalld (firewall) instructions to everyone. I hope it will be helpful to friends in need!

Detailed explanation of CentOS firewalld (firewall) instructions

CentOS firewalld (firewall) command

1. View firewalld status

Check the firewalld service status command:

systemctl status firewalld
Copy after login

Detailed explanation of CentOS firewalld (firewall) instructions

Check the firewalld status command:

firewall-cmd --state
Copy after login

Detailed explanation of CentOS firewalld (firewall) instructions

2. Turn on, Restart and shut down the firewalld service

Open:

service firewalld start
Copy after login

Close:

service firewalld stop
Copy after login

Restart:

service firewalld restart
Copy after login

Detailed explanation of CentOS firewalld (firewall) instructions

3. Query, open and close firewalld ports

Query all open ports:

firewall-cmd --list-all
Copy after login

Detailed explanation of CentOS firewalld (firewall) instructions

Query whether a certain port is open :

firewall-cmd --query-port=[端口]/tcp
Copy after login

Detailed explanation of CentOS firewalld (firewall) instructions

Open port:

firewall-cmd --permanent --add-port=[端口]/tcp
Copy after login

Close port:

firewall-cmd --permanent --remove-port=[端口]/tcp
Copy after login

Refresh service (refresh is required after opening and closing port operations to take effect ):

firewall-cmd --reload
Copy after login

Detailed explanation of CentOS firewalld (firewall) instructions

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template