大网数据广告活动
服务器运维问答

IPTables won't start automatically after reboot - Red Hat 7

· 52CE 我爱测

In Red Hat 7 I'm trying to force the IP tables service to start automatically after reboot. Currently, after every reboot I need to run the command: sudo systemctl start iptables I've tried setting sudo chkconfig iptables on but …

问题原文

原帖链接 · user2694306 · CC BY-SA 3.0

In Red Hat 7 I'm trying to force the IP tables service to start automatically after reboot. Currently, after every reboot I need to run the command:

sudo systemctl start iptables

I've tried setting

sudo chkconfig iptables on

but it isn't running.

In my file /etc/sysconfig/iptables-config I've set

IPTABLES_SAVE_ON_STOP="yes" IPTABLES_SAVE_ON_RESTART="yes"

Can someone let me know how to set this to start on reboot?

已采纳解答

原帖链接 · Koen van der Rijt · CC BY-SA 3.0

As per RHEL7/Centos7 there is no iptables service available in the default install. Instead they want you to use firewalld which is turned on by default. (see man firewall-cmd for more information on how to operate firewalld )

If you want to use iptables u need to install iptables-services and enable them with systemctl enable iptables. You will need to turn off firewalld with systemctl disable firewalld.

If there isn't a really specific reason to use iptables or chkconfig I would advise you not use them. Instead I would invest in learning how firewalld and systemctl works.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-06-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。