iptables-restore:第1行失败的消息

我正在尝试将iptables更改为以下内容

Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere REJECT all -- anywhere 127.0.0.0/8 reject-with icmp-port-unreachable ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED ACCEPT tcp -- anywhere anywhere tcp dpt:www ACCEPT tcp -- anywhere anywhere tcp dpt:https ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:30000 ACCEPT icmp -- anywhere anywhere icmp echo-request LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix `iptables denied: ' REJECT all -- anywhere anywhere reject-with icmp-port-unreachable Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- anywhere anywhere reject-with icmp-port-unreachable Chain OUTPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- anywhere anywhere 

当我运行/ sbin / iptables-restore </etc/iptables.up.rules命令时,我收到以下消息:

iptables-restore:第1行失败

任何人都可以给我任何build议做什么? 谢谢

你已经发布的是iptables -L的输出, iptables -L的有效格式。 你想要做的就是使用iptables-save来获得格式正确的规则集的副本。

你能告诉我们什么在/etc/iptables.up.rules的第一行吗? 看起来这个文件被覆盖为不是从/ sbin / iptables-save的格式。

另一种select是你需要使用sudo执行恢复命令。