Linux firewall status check method example

Linux firewall status check method example

How to check the status of Linux firewall

1. Basic Operations

# View the firewall status service iptables status
# Stop the firewall service iptables stop
# Start the firewall service iptables start
# Restart the firewall service iptables restart
# Permanently turn off the firewall chkconfig iptables off
# Permanently shut down and restart chkconfig iptables on

2. Open port 80

vim /etc/sysconfig/iptables
# Add the following code -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

Save and exit and restart the firewall

service iptables restart

2. Firewall

1. Check the firewall service status

systemctl status firewalld

If Active: active (running) is highlighted, it means it is in the startup state.

Active: inactive (dead) in gray means stop, you can also look at the words.

2. Check the status of the firewall

firewall-cmd --state

3. Start, restart, or shut down firewalld.service

# Enable service firewalld start# Restart service firewalld restart# Disable service firewalld stop

4. Check firewall rules

firewall-cmd --list-all

5. Query, open, and close ports

# Check whether the port is open 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 the firewall (restart the firewall after modifying the configuration)
firewall-cmd --reload

Parameter Explanation

1. Firewall-cmd: It is a tool provided by Linux to operate firewall;

2. --permanent: indicates that it is set to be persistent;

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

This is the end of this article about examples of methods to check the status of the Linux firewall. For more relevant content on checking the status of the Linux firewall, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to configure Linux firewall and open ports 80 and 3306
  • A brief analysis of Linux to check the firewall status and the status of the ports open to the outside world
  • 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

<<:  MySQL 5.7.27 installation and configuration method graphic tutorial

>>:  The problem of Vue+tsx using slot is not replaced

Recommend

Example code for implementing dynamic column filtering in vue+element table

Requirement: When displaying data in a list, ther...

Detailed explanation of non-parent-child component value transfer in Vue3

Table of contents App.vue sub1.vue sub2.vue Summa...

The use of anchor points in HTML_PowerNode Java Academy

Now let's summarize several situations of con...

Two ways to install the Linux subsystem in Windows 10 (with pictures and text)

Windows 10 now supports Linux subsystem, saying g...

How to solve the front-end cross-domain problem using Nginx proxy

Preface Nginx (pronounced "engine X") i...

Vue Basics Listener Detailed Explanation

Table of contents What is a listener in vue Usage...

How to build a DHCP server in Linux

Table of contents 1. Basic knowledge: 2. DHCP ser...

JavaScript macrotasks and microtasks

Macrotasks and Microtasks JavaScript is a single-...

WebStorm cannot correctly identify the solution of Vue3 combined API

1 Problem Description Vue3's combined API can...

How to underline the a tag and change the color before and after clicking

Copy code The code is as follows: a:link { font-s...

25 div+css programming tips and tricks

1. The ul tag has a padding value by default in M...

A simple and in-depth study of async and await in JavaScript

Table of contents 1. Introduction 2. Detailed exp...