A brief analysis of Linux to check the firewall status and the status of the ports open to the outside world

A brief analysis of Linux to check the firewall status and the status of the ports open to the outside world

1. Check the firewall status

Check the firewall status systemctl status firewalld

Start the firewall systemctl start firewalld

Disable the firewall systemctl stop firewalld

Start the firewall service firewalld start

If you cannot open

First use: systemctl unmask firewalld.service

Then: systemctl start firewalld.service

2. Check the status of open ports

Query the open ports netstat -ntulp | grep port number: You can check a specific port number

Check whether the specified port is open firewall-cmd --query-port=666/tcp

If the prompt is yes, it means it is enabled; if the prompt is no, it means it is not enabled.

3. External development port

Check whether the port you want to open is open: firewall-cmd --query-port=6379/tcp

Add the specified port to be opened: firewall-cmd --add-port=123/tcp --permanent

Reload the added port: firewall-cmd --reload

Check whether the specified port is opened successfully: firewall-cmd --query-port=123/tcp

Remove the specified port: firewall-cmd --permanent --remove-port=123/tcp

Summarize

The above is my introduction to checking the firewall status and the status of open ports in Linux. I hope it will be helpful to you!

You may also be interested in:
  • Linux firewall status check method example
  • How to configure Linux firewall and open ports 80 and 3306
  • How to modify firewall configuration in Linux system
  • How to use firewall iptables strategy to forward ports on Linux servers
  • How to check if the firewall is turned off in Linux

<<:  Detailed explanation of MySQL cursor concepts and usage

>>:  Node.js uses express-fileupload middleware to upload files

Recommend

Share JS four fun hacker background effect codes

Table of contents Example 1 Example 2 Example 3 E...

Detailed steps for deploying Microsoft Sql Server with Docker

Table of contents 1 Background 2 Create a contain...

javascript to switch pictures by clicking a button

This article example shares the specific code of ...

Explanation of factors affecting database performance in MySQL

A story about database performance During the int...

The difference between Display, Visibility, Opacity, rgba and z-index: -1 in CSS

We often need to control the hidden, transparent ...

Detailed explanation of Tomcat directory structure

Table of contents Directory Structure bin directo...

CSS tips for implementing Chrome tab bar

This time let’s look at a navigation bar layout w...

Detailed explanation of the use of Docker commit

Sometimes you need to install certain dependencie...

MySQL master-slave replication configuration process

Main library configuration 1. Configure mysql vim...

Vue.js style layout Flutter business development common skills

Correspondence between flutter and css in shadow ...

Implementation of mysql decimal data type conversion

Recently, I encountered a database with the follo...

Keepalived+Nginx+Tomcat sample code to implement high-availability Web cluster

Keepalived+Nginx+Tomcat to achieve high availabil...