In this article, you will learn How To Install IPtables On CentOS 8/7 RHEL 8/7.
FirewallD provides a dynamically managed firewall with support for network/firewall zones that define the trust level of network connections or interfaces.
Starting from CentOS 7, iptables replaced by default with FirewallD.
Anyways we can disable the FirewallD and install iptables.
Make sure if you can login with a root, or other user with sudo privileges.
Disable the FirewallD
Before installing the iptables we need to stop, disable and mask the firewalld service.
Stop the firewalld service:
sudo systemctl stop firewalld
Disable the firewalld service on boot:
sudo systemctl disable firewalld
Mask the firewalld:
sudo systemctl mask --now firewalld
After the firewalld disabling, we we can install iptables with yum or dnf package manager.
sudo yum install iptables-services -y
Start and Enable IPtables on Boot
After iptables successfully installation start the iptables:
sudo systemctl start iptables
Then enable iptables on system boot:
sudo systemctl enable iptables
To check the status of the iptables service run:
sudo systemctl status iptables
IPtables Rules File Location
In CentOS 8/7 iptables stores rules configuration in /etc/sysconfig/iptables and /etc/sysconfig/ip6tables directories.
In this tutorial, you lust learned how to disable the firewalld, and Install iptables On CentOS 8/7 RHEL 8/7, and enable iptables service.