CentOS 7,8: How to disable firewalld and enable iptables instead?

How to disable firewalld and enable iptables instead?

To switch to from firewalld to iptables follow the steps given below.

1. Firstly ensure the iptables-services package is installed.

yum install -y -q iptables-services

2. Then prepare the iptables rules you wish to use by editing /etc/sysconfig/iptables and /etc/sysconfig/ipt6tables.

3. Next, disable and stop the firewalld service

systemctl disable firewalld
rm ‚/etc/systemd/system/basic.target.wants/firewalld.service‘
rm ‚/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service‘
# systemctl stop firewalld

4. Then start iptables services :

systemctl start iptables

systemctl start ip6tables

5. Enable iptables service to automatically start at boot :

# systemctl enable iptables
ln -s '/usr/lib/systemd/system/iptables.service' '/etc/systemd/system/basic.target.wants/iptables.service'
# systemctl enable ip6tables
ln -s '/usr/lib/systemd/system/ip6tables.service' '/etc/systemd/system/basic.target.wants/ip6tables.service'