iptables is a firewall component service under Linux. It has more powerful functions than Windows firewall. Let’s take a look at the common operations of iptables in the Linux system to determine whether the Linux system has enabled the iptables service, and Tutorial on clearing firewall rules.
1. Check whether iptables is installed
1. Firewall iptables under Linux is generally a system-integrated component, check whether it can be installed
Query via rpm -qa
2. If the component is not installed, you can install it through yum install iptables (must be connected to the Internet)
2. Check whether the linux firewall is turned on
1. If it is found that iptables has been installed, check whether the iptables service is running
You can pass service iptables status as shown in the figure (if there are other components such as fail2ban, firewall rules will also be called) followed by the rule chain
2, List iptables rules
If you want to view specific iptables rules, you can also enter iptables -L List the rules
3, Judge by service
In addition to the methods introduced above, you can also judge by stopping the iptables service (as shown in the figure, OK xxx means that iptables is currently enabled)
4. If the prompt does not contain any information, it means that the iptables service (process) is not enabled in the current system
3. Close iptables firewall/delete rules
1, Iptables starts automatically at boot
If you want to turn off the iptables service, you also need to check whether there is an iptables service in the chkconfig list.
2. Shutdown steps: First stop the chkconfig iptables off boot project, then remove it, and finally check again
3, Clear iptables rules
If you only need to delete iptables firewall rules, you can clear the list rules through iptables-F (iptables -L lists the current iptables rules)
4. Delete an iptables rule, select and enter iptables -d xxxx , and start the iptables service as shown in the figure
Precautions:
Pay attention to the iptables service. In addition, there is also an ip6tables for firewalls under ipv6
The above is the detailed content of How to check whether the firewall is enabled and clear the firewall rules in Linux?. For more information, please follow other related articles on the PHP Chinese website!