In this tutorial we will show you how to install and enable an iptables firewall on CentOS 7 Linux.
First, need to disable and remove firewalld firewall. Type Following commands:

sudo systemctl stop firewalld.service
sudo systemctl disable firewalld.service
yum remove firewalld -y

Install iptables firewall on CentOS 7

To install Iptables package type following command:

yum install iptables-service -y

After install iptables firewall, set the iptables service to start automatically with system booting up:

systemctl enable iptables
Install iptables on CentOS 7

Install iptables on CentOS 7

if you want to use command “/etc/init.d/iptables save” to save the firewall policy , you need to update the iptables init script. issue the following command:

cp /usr/libexec/iptables/iptables.init /etc/init.d/iptables

now you can use “/etc/init.d/iptables save ” command.

/etc/init.d/iptables save

That’s been all!