Switching firewalld to iptables on CentOS
One of the most important changes to be made in the CentOS is changing iptables to firewalld. If you want to revert this switch and go back to using iptables, it is possible however, you must originally configure the firewall. Follow the steps outlined below to change firewalld to iptables.
Use the following code to install iptables:
yum install –y iptables-services
Then mask firewalld service:
systemctl mask firewalld
Now, we should enable the iptables service:
systemctl enable iptables
systemctl enable ip6tables
Next, enter the iptables directory and set all the rules that you want to configure:
After rule configuration, stop the firewalld service:
systemctl stop firewalld
Finally, enter the following codes to run iptables service:
systemctl start iptables
systemctl start ip6tables
Please Note: you must configure SSH rules on port 22 to avoiding losing connection when you start iptables service.