Apr 13

Disable firewalld and use iptables on CentOS or RHEL

When try to save iptable rules on latest RHEL  / CentOS version, an error similar to following will appear.
It is due to latest version no longer distributed with iptales, instead firewalld was introduced to manage iptables.  Even though firewalld provides more features, many sysadmins are preferred to use good old iptables.


# service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

To fix this, you need to install few packages, let’s look at how to bring back iptables to the latest Redhat / Centos. We are going to disable firewalld and use iptables instead on Centos.

1) Firstly, stop and mask firewalld service

systemctl stop firewalld
systemctl mask firewalld

2) Install iptables-services from yum command

yum install iptables-services

3) Enable the service at startup

systemctl enable iptables

4) Start the iptables

systemctl start iptables

5) Now it is ready to save, iptable rules using following command.

service iptables save

comment here if you have any doubts or questions, I’m always happy to assist you.

Links :- Fundamentals of Linux iptables

Leave Your Thought Here