linux – 使用所有规则删除iptables链

前端之家收集整理的这篇文章主要介绍了linux – 使用所有规则删除iptables链前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个链附加了许多规则,如:
> :i_XXXXX_i - [0:0]
> -A INPUT -s 282.202.203.83/32 -j i_XXXXX_i 
> -A INPUT -s 222.202.62.253/32 -j i_XXXXX_i 
> -A INPUT -s 222.202.60.62/32 -j i_XXXXX_i 
> -A INPUT -s 224.93.27.235/32 -j i_XXXXX_i 
> -A OUTPUT -d 282.202.203.83/32 -j i_XXXXX_i 
> -A OUTPUT -d 222.202.62.253/32 -j i_XXXXX_i 
> -A OUTPUT -d 222.202.60.62/32 -j i_XXXXX_i 
> -A OUTPUT -d 224.93.27.235/32 -j i_XXXXX_i

当我尝试删除此链时:

iptables -X XXXX

但得到了错误(尝试iptables -F XXXXX之前):

iptables: Too many links.

是否有一种简单的方法可以通过一次命令删除链?

解决方法

当带有’-j CHAINTODELETE’的规则引用它们时,您无法删除链.弄清楚什么是引用您的链(链接),并删除它.另外,冲洗然后杀死.

-F,–flush [chain]

Flush the selected chain (all the chains in the table if none is given). This is equivalent to deleting all the rules one by one.

-X,–delete-chain [chain]

Delete the optional user-defined chain specified. There must be no references to the chain. If there are,you must delete or replace the referring rules before the chain can be deleted. The chain must be empty,i.e. not contain any rules. If no argument is given,it will attempt to delete every non-builtin chain in the table.

原文链接:https://www.f2er.com/linux/402952.html

猜你在找的Linux相关文章