Get the App
SLTechnology News&Howtos  ›  Servers  › 

Analysis of linux to check the status of firewalls and ports open to the outside world

Shulou Source: shulou.com Published: 2022-06-02 01:45:48 10月03日 Update

1. View firewall status

View firewall status systemctl status firewalld

Turn on firewall systemctl start firewalld

Turn off Firewall systemctl stop firewalld

Turn on firewall service firewalld start

If you can't open it.

First use: systemctl unmask firewalld.service

Then: systemctl start firewalld.service

two。 View the status of ports open to the outside world

Query the open port netstat-ntulp | grep port number: you can view a specific port number.

Query whether the specified port has firewall-cmd enabled-- query-port=666/tcp

The prompt yes indicates that it is enabled, and no indicates that 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 specified ports that need to be open: firewall-cmd-- add-port=123/tcp-- permanent

Reload the added port: firewall-cmd-- reload

Query whether the specified port is enabled successfully: firewall-cmd-- query-port=123/tcp

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

Summary

The above is the linux that the editor introduced to you to check the status of the firewall and the port status that is open to the outside world. I hope it will be helpful to everyone!

Tags: Port Firewall Fire Protection status Open external query Open slogan success first use help Development Tip Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Tech Info NVidia Shulou Technology Shulou Information