Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to check the status of firewalls in a linux system

Shulou Source: shulou.com Published: 2022-06-03 06:47:43 09月20日 Update

This article mainly introduces in detail how to check the status of the firewall in the linux system. The sample code in this article is very detailed and has a certain reference value. Interested friends can refer to it.

The method of checking the status of linux Firewall

1. Basic operation

# View Firewall status service iptables status# stop Firewall service iptables stop# start Firewall service iptables start# restart Firewall service iptables restart# permanently close Firewall chkconfig iptables off# permanently shut down restart chkconfig iptables on

Recommended: Linux self-study video

2. Open port 80

Vim / etc/sysconfig/iptables# adds the following code-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 80-j ACCEPT

Restart the firewall after saving exit

Service iptables restart

II. Firewall Firewall

1. View the status of firewall service

Systemctl status firewalld

When Active: active (running) is highlighted, it indicates that it is in the starting state.

The appearance of Active: inactive (dead) gray indicates stop, or look at the word.

2. Check the status of firewall

Firewall-cmd-state

3. Enable, restart, shut down, and firewalld.service services

# enable service firewalld start#, restart service firewalld restart# and disable service firewalld stop

4. View firewall rules

Firewall-cmd-list-all

5. Query, open and close the port

# query whether the port is open for firewall-cmd-- query-port=8080/tcp# open port 80 firewall-cmd-- permanent-- add-port=80/tcp# remove port firewall-cmd-- permanent-- remove-port=8080/tcp# restart firewall (restart firewall after configuration modification) firewall-cmd-- reload

Parameter interpretation

1. Firwall-cmd: a tool for operating firewall provided by Linux

2.-- permanent: set to persistent

3.-- add-port: identifies the added port

On how to view the status of the firewall in the linux system is shared here, of course, not only the above and everyone analysis methods, but the editor can ensure its accuracy is absolutely no problem. I hope that the above content can have a certain reference value for everyone, and can be put into practice. If you like this article, you might as well share it for more people to see.

Tags: Firewall fire protection status port reference open system code value permanence service query application of knowledge interest content accuracy method word parameter basic operation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Redmi Microsoft OPPO Reno Shulou Information