How does linux view firewall status
This article mainly introduces linux how to check the firewall status, the article is very detailed, has a certain reference value, interested friends must read it!
Linux check firewall status: 1, iptables firewall, check firewall status, code is [service iptables status]; 2, firewall firewall, code is [firewall-cmd-- state].
How linux can view the status of the firewall:
1. Iptables Firewall
1. Basic operation
# View 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
# restart after permanent shutdown
Chkconfig iptables on
2. Open port 80
Vim / etc/sysconfig/iptables
# add 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
# close
Service firewalld stop
4. View firewall rules
Firewall-cmd-list-all
5. Query, open and close the port
# query 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 changing the configuration)
Firewall-cmd-reload
Parameter interpretation
1. Firwall-cmd: a tool for operating firewall provided by Linux
2. Permanent: set to persistent
3. Add-port: identify the added port
The above is all the contents of the article "how to check the Firewall status of linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!