我的iptables中有这个规则:
sudo iptables -t nat -nvL --line-numbers
Chain PREROUTING (policy ACCEPT 14 packets, 1950 bytes)
num pkts bytes target prot opt in out source destination
Chain INPUT (policy ACCEPT 14 packets, 1950 bytes)
num pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 577 packets, 41182 bytes)
num pkts bytes target prot opt in out source destination
1 0 0 REDIRECT tcp -- * lo 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8090
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下方法删除它:
sudo iptables -D OUTPUT 1
Run Code Online (Sandbox Code Playgroud)
我得到了这个错误:
iptables: Index of deletion too big.
Run Code Online (Sandbox Code Playgroud)
所以经过网上搜索后,我发现应该可以删除链的所有规则,如下所示:
sudo iptables -F OUTPUT
Run Code Online (Sandbox Code Playgroud)
此命令的输出无效,但是当我重新运行sudo iptables -t nat -nvL --line-numbers命令以列出现有规则后,没有任何内容被删除.我错过了什么?
Bri*_*ine 17
您的规则是在表nat中定义的,因此您必须显式添加-t nat.
sudo iptables -D OUTPUT 1 -t nat
Run Code Online (Sandbox Code Playgroud)
如果您尚未指定表名,则默认操作将隐式使用"-t filter".
| 归档时间: |
|
| 查看次数: |
28048 次 |
| 最近记录: |