CentOS 版本 7 的 iptables 求助。

2017-06-28 16:09:34 +08:00
 iceecream

主机停止了 firewalld 服务,并未安装 IPtables-services 这个包。 停止 firewalld 服务时,iptables-save 输出为空,但是此时如果使用 iptables -A INPUT 添加一些规则,那么我发现这些规则仍然是生效的。即 iptables 服务没有开启时,iptables 规则也是生效的。 为什么会出现这种情况??

本人在 6 版本中调试 iptables 时,习惯在 crontab 里面添加定时停止 iptables 服务的命令,防止自己被关在门外。那么此法在 CentOS-7 中无法实现?

2753 次点击
所在节点    Linux
8 条回复
defunct9
2017-06-28 16:15:04 +08:00
iptables -A INPUT 会自动启用 iptables 服务
raysonx
2017-06-28 16:19:54 +08:00
iptables 其实并不是一个服务。CentOS 或者 RHEL 里面的所谓“ iptables 服务”只是帮你导入或者清空 iptables 表和链而已。
iceecream
2017-06-28 16:31:19 +08:00
@defunct9 不是,我并没有安装 iptables-services 这个包,所以并无此服务。
defunct9
2017-06-28 16:44:29 +08:00
不装?你真的没装吗,系统缺省自带的
ladeo
2017-06-28 16:45:30 +08:00
这个包是 epel 里的 自带应该没有
AntonChen
2017-06-28 16:49:16 +08:00
定时任务关闭?居然有这种操作,get
zent00
2017-06-28 17:16:43 +08:00
你用 iptables 命令是直接对 netfilter 进行了操作,当然能生效,所谓的 iptables-services 所做的仅仅是在该服务启动时加载你所配置的规则,服务停止时清除掉已经应用的规则。
sunqi0928
2017-06-28 18:39:55 +08:00
你先搞清楚两个概念:
iptables.x86_64 : Tools for managing Linux kernel packet filtering capabilities

iptables-services.x86_64 : iptables and ip6tables services for iptables

然后给你个文章看吧: https://blog.argcv.com/articles/3167.c

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/371708

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX