我想从文件恢复iptables规则时遇到此错误。

iptables-restore v1.4.21: The -t option (seen in line 5) cannot be used in iptables-restore.

Error occurred at line: 5
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

有我的iptables:
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-t nat -A POSTROUTING -o eth0 -j MASQUERADE
-A FORWARD -i eth0 -o lxcbr0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i lxcbr0 -o eth0 -j ACCEPT
COMMIT

没有-t选项,我将无法做到。

最佳答案

我解决了:

*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [1:76]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT
*filter
:INPUT ACCEPT [95:5492]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [48:3648]
-A FORWARD -i eth0 -o lxcbr0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i lxcbr0 -o eth0 -j ACCEPT
COMMIT

关于linux - -t选项不能在iptables-restore中使用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/35272615/

10-15 00:09