加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 我的网站会在iptables重启期间停止吗?

发布时间:2020-12-13 17:18:57 所属栏目:Linux 来源:网络整理
导读:在CentOS 6系统中,通过以下命令在iptables重启期间是否会停止网站? $service iptables restart 解决方法 默认情况下,没有. /etc/init.d/iptables脚本在重新启动时执行以下操作: restart() { [ "x$IPTABLES_SAVE_ON_RESTART" = "xyes" ] save stop start}
在CentOS 6系统中,通过以下命令在iptables重启期间是否会停止网站?
$service iptables restart

解决方法

默认情况下,没有. /etc/init.d/iptables脚本在重新启动时执行以下操作:
restart() {
    [ "x$IPTABLES_SAVE_ON_RESTART" = "xyes" ] && save
    stop
    start
}

尽管存在保存现有规则的问题,但未修改的停止的效果是禁用所有规则:

[root@bill ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: mangle nat filte[  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@bill ~]# iptables -L -n -v
Chain INPUT (policy ACCEPT 0 packets,0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain FORWARD (policy ACCEPT 0 packets,0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 0 packets,0 bytes)
 pkts bytes target     prot opt in     out     source               destination

并假设(a)你要保存停止规则,你现有的规则是你想要的,或者(b)你没有保存规则停止,你的建议规则集在/ etc / sysconfig / iptables中在语法和功能上都是正确的,当开始将规则放回原位时,服务应该不间断地继续.

状态表不受停止防火墙规则的影响,因此在停止之前通过有状态规则允许通过的任何流量应该在启动后继续如此.但是,NAT规则会被暂停(暂时)删除,因此如果您使用NAT,则可能会受到重启的影响.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读