如何在Ubuntu上暂时停止iptables

我在/ etc / network / interfaces中使用IPTABLES

pre-up iptables-restore /etc/firewall.txt 

我尝试在Ubuntu上search/etc/init.d/iptables这样的东西,但似乎并不存在。所以如果我必须暂时停止IPTABLE以便系统pipe理员工作,那么我该怎么做?

iptables不是一个服务,而是一个内核的设施。 这就是为什么你不能阻止它。

如果你需要快速停止iptables,这是我的build议:

  1. configuration你的iptables完成。

  2. 首先保存configuration: iptables-save > /etc/iptables.conf

  3. 刷新iptables,并将其configuration为“打开”:

    • 所有政策设置为接受
    • configuration所有必要的NAT以使您的系统pipe理员能够正常工作
    • 如果在mangle表中使用基于策略的路由,也可以根据需要进行configuration
  4. 保存“打开”规则集: iptables-save > /etc/open-iptables.conf

现在,只要你需要快速“禁用”iptables,就可以:

cat /etc/open-iptables.conf | iptables-restore cat /etc/open-iptables.conf | iptables-restore

之后,使用以下命令重新启用iptables:

cat /etc/iptables.conf | iptables-restore

iptables-restore < /etc/open-iptables.conf也可能工作;但是我读过其他地方, 有时它不工作)