Help need :) How to delete all rules in chain ?

Aleksandar Milivojevic amilivojevic at pbl.ca
Tue Sep 28 22:14:05 CEST 2004


Abylai Ospan wrote:
> Hello, all !
> 
> May be this question in FAQ but I can't find it ;-( I have 3 (or more)
> identical rules in one (for example - INPUT) chain.
> If I do command:
> iptables -D FORWARD -s 10.0.0.10 -d 10.0.0.20 -j ACCEPT 
> 
> the first rule is deleted only. Is there any command line option to
> remove all identical rules in one chain ?

No such options.  But nothing prevents you from doing it in loop:

while iptables -D FORWARD insert options here -j ACCEPT 2>/dev/null
do
    : # do nothing
done

Just don't call me script kiddie ;-)

-- 
Aleksandar Milivojevic <amilivojevic at pbl.ca>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7



More information about the netfilter mailing list