活到老学到老  

记录遇到问题的点点滴滴。

Saving IPTABLES Rules on CentOS 7

7年前发布  · 1316 次阅读
  iptables 

Most administrators are using to using the “service iptables save” command to save firewall rules on RHEL5 and RHEL6 servers. With CentOS 7 and Red Hat Enterprise Linux 7 (as well as more-recent versions of Fedora), this command is no longer enabled by default. Instead, Red Hat has enabled `firewalld` by default. To enable the old IPTABLES save mechanisms, just perform the following steps:

First, stop and mask the firewalld service:

systemctl stop firewalld
systemctl mask firewalld

Next, install the iptables-services package and enable the service to start at boot:

yum install iptables-services
systemctl enable iptables

Then, saving the firewall rules can be done using either of the following two commands:

service iptables save
/usr/libexec/iptables/iptables.init save