Home>Article>Operation and Maintenance> How to check if there is a firewall in centos7

How to check if there is a firewall in centos7

WBOY
WBOY Original
2022-02-08 15:48:15 17176browse

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.

How to check if there is a firewall in centos7

The operating environment of this article: centos 7 system, Dell G3 computer.

How to check if there is a firewall in centos7

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.

How to check if there is a firewall in centos7

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!

Statement:
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