+1 (506) 500-5957 sales@monovm.com Get US VPS for 50% OFF!

Switching firewalld to iptables on CentOS

Switching firewalld to iptables on CentOS, Throughout this short tutorial, we will show you a step-by-step guide on how to change firewalld to iptables on CentOS. This tutorial is designed for CentOS 7 users, however, it might work in other versions as well.

Posted: 15 May, 19 Updated: 05 Mar, 23 by Oliver K 1 Min

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:

cd /etc/sysconfig

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.

Oliver K

Oliver K

I’m Oliver k. I have MS degree in Computer Engineering. For nearly 5 years that I have been working on web programing and also in last 2 years I have worked on windows and Linux VPS. This is my honor to share my experiences with a new community.