Get the App
SLTechnology News&Howtos  ›  Development  › 

How does CentOS7 use firewalld to turn on or off firewalls and ports

Shulou Source: shulou.com Published: 2022-05-31 23:34:48 09月30日 Update

This article mainly introduces CentOS7 how to use firewalld to open or close firewalls and ports related knowledge, the content is detailed and easy to understand, the operation is simple and fast, with a certain reference value, I believe that after reading this CentOS7 how to use firewalld to open or close firewalls and ports article will have a harvest, let's take a look.

1. Basic use of firewalld

Start:

Systemctl start firewalld

View status:

Systemctl status firewalld

Stop:

Systemctl disable firewalld

Disable:

Systemctl stop firewalld

2.systemctl is the main tool in centos7's service management tools, which combines the functions of service and chkconfig.

Start a service:

Systemctl start firewalld.service

Shut down a service:

Systemctl stop firewalld.service

Restart a service:

Systemctl restart firewalld.service

Displays the status of a service:

Systemctl status firewalld.service

Enable a service at boot time:

Systemctl enable firewalld.service

Disable a service at boot time:

Systemctl disable firewalld.service

Check to see if the service is powered on:

Systemctl is-enabled firewalld.service

View a list of services that have been started:

Systemctl list-unit-files | grep enabled

View the list of services that failed to start:

Systemctl-failed

3. Configure firewalld-cmd

View the 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 area information:

Firewall-cmd-get-active-zones

View the area 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 to see if you reject:

Firewall-cmd-query-panic

So how do you open a port?

Add

Firewall-cmd-zone=public-add-port=80/tcp-permanent

(--permanent is in effect forever. It will expire after restart without this parameter.)

Reload

Firewall-cmd-reload

View

Firewall-cmd-zone= public-query-port=80/tcp

Delete

This is the end of the article firewall-cmd-zone= public-remove-port=80/tcp-permanent on "how CentOS7 uses firewalld to open or close firewalls and ports". Thank you for reading! I believe that everyone has a certain understanding of "how CentOS7 uses firewalld to open or close firewalls and ports". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Services ports firewalls fire protection status knowledge content areas tools machine time articles in one value information functions parameters ownership interfaces simple operation articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information OPPO Reno Xiaomi Apple