重启后 IPTables 不会自动启动 - Red Hat 7

use*_*306 1 redhat centos systemctl

在 Red Hat 7 中,我试图强制 IP 表服务在重新启动后自动启动。目前,每次重新启动后,我都需要运行以下命令:

sudo systemctl start iptables

我试过设置

sudo chkconfig iptables on

但它没有运行。

在我的文件中/etc/sysconfig/iptables-config我已经设置

IPTABLES_SAVE_ON_STOP="yes" IPTABLES_SAVE_ON_RESTART="yes"

有人可以让我知道如何将其设置为在重新启动时启动吗?

Koe*_*ijt 5

根据 RHEL7/Centos7,默认安装中没有可用的 iptables 服务。相反,他们希望您使用firewalld默认情况下打开的功能。(man firewall-cmd有关如何操作 firewalld 的更多信息,请参见)

如果你想使用 iptables,你需要安装iptables-services并启用它们systemctl enable iptables。您需要使用systemctl disable firewalld.

如果没有使用 iptables 或 chkconfig 的真正具体原因,我建议您不要使用它们。相反,我会投资于学习 firewalld 和 systemctl 的工作原理。