Press "Enter" to skip to content

iptables delete some rules form a chain

以下两条命令均可用

iptables -t nat -L PREROUTING --line-numbers | grep RULE_NAME | cut -d" " -f 1 | xargs iptables -t nat -D PREROUTING

for i in $(iptables -t nat -nvL PREROUTING --line-numbers | grep RULE_NAME | grep ^[0-9] | awk '{ print $1 }' | tac); do iptables -t nat -D PREROUTING $i; done
发表评论

您的电子邮箱地址不会被公开。