/etc/network/if-pre-up.d/iptables 腳本使 eth 介面在 debian jessie 中消失?

/etc/network/if-pre-up.d/iptables 腳本使 eth 介面在 debian jessie 中消失?

我需要在 iptables 中的虛擬機器上啟用 NAT。我跟著官方 debian 指令 配置它:

首先,我建立了包含以下內容的 /etc/iptables.rules 檔案: *nat -A POSTROUTING -s 192.168.0.0/16 -o eth0 -j SNAT --to-source 46.4.120.218 COMMIT

我手動使用後iptables-restore < /etc/iptables.rules,nat 規則添加得很好,一切正常

但是,當我嘗試透過/etc/network/if-pre-up.d/iptables具有以下內容的檔案自動載入 iptables 規則時,eth 介面消失(我只能透過 ifconfig 看到環回介面):

 #!/bin/sh
 /sbin/iptables-restore < /etc/iptables.rules

我嘗試在 debian wheezy 上做同樣的事情,這很有效。在 debian jessie 中這不起作用。是我的錯誤,還是bug?

PS 我嘗試將 iptables 腳本移動到if-up.d資料夾,在這種情況下存在 eth 接口,但不應用 iptables 規則。

相關內容