加入收藏 | 设为首页 | 会员中心 | 我要投稿 威海站长网 (https://www.0631zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

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

发布时间:2020-12-25 04:45:37 所属栏目:Linux 来源:网络整理
导读:我有一个链附加了许多规则,如: :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

我有一个链附加了许多规则,如:

> :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.

(编辑:威海站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读