Starting CentOS/RHEL 7, iptables is replaced with firewalld. In some cases, you may want to use old good iptables instead of firewalld on your CentOS/RHEL 7 or 8 system. This post outlines the steps required to carry out the conversion.
1. Install iptables services package:
# /usr/bin/yum install iptables-services
2. Stop firewalld service:
# /usr/bin/systemctl stop firewalld
3. Mask firewalld service (Masking will make it impossible to start firewalld service):
# /usr/bin/systemctl mask firewalld
4. Start iptables service:
# /usr/bin/systemctl start iptables
5. Check the status of iptable service:
# /usr/bin/systemctl status iptables ● iptables.service - IPv4 firewall with iptables Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled) Active: active (exited) since Fri 2019-12-13 14:39:38 IST; 1min 49s ago ...
6. Enable the iptables to start on boot:
# /usr/bin/systemctl enable iptables
7. List your iptables rules:
# /usr/sbin/iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT icmp -- anywhere anywhere ACCEPT all -- anywhere anywhere ...