All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Help need :) How to delete all rules in chain ?
  2004-09-28 19:48 Help need :) How to delete all rules in chain ? Abylai Ospan
@ 2004-09-28 15:57 ` Jason Opperisano
  2004-09-28 23:29   ` Abylai Ospan
  2004-09-28 19:26 ` Juan Hernandez
  2004-09-28 20:14 ` Aleksandar Milivojevic
  2 siblings, 1 reply; 8+ messages in thread
From: Jason Opperisano @ 2004-09-28 15:57 UTC (permalink / raw)
  To: netfilter

On Tue, 2004-09-28 at 15:48, 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 ?
> 
> wbr, Abylai

AFAIK, there is no way to make "-D" delete multiple, identical rules. 
if you have that rule in there multiple times, hit <up-arrow><enter> a
few times until you get:

  iptables: Bad rule (does a matching rule exist in that chain?)

if you use a script to flush/reload rules, you normally won't run into
this situation.

-j

-- 
Jason Opperisano <opie@817west.com>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help need :) How to delete all rules in chain ?
  2004-09-28 19:48 Help need :) How to delete all rules in chain ? Abylai Ospan
  2004-09-28 15:57 ` Jason Opperisano
@ 2004-09-28 19:26 ` Juan Hernandez
  2004-09-28 19:28   ` Alexis
  2004-09-28 23:28   ` Abylai Ospan
  2004-09-28 20:14 ` Aleksandar Milivojevic
  2 siblings, 2 replies; 8+ messages in thread
From: Juan Hernandez @ 2004-09-28 19:26 UTC (permalink / raw)
  To: netfilter

iptables -F
On Tue, 2004-09-28 at 15:48, 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 ?
> 
> wbr, Abylai
> 
-- 

Juan Hernandez, RHCE SCSA
.knxTech C.A.
CC Los Chaguaramos, Ofc 16-10B      |  Tel: (58) 212-6624745
Los Chaguaramos, Caracas-Venezuela  |  Mobile: (58) 412-5821882

Programmin' Python is like sugar... Sweet ;)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: Help need :) How to delete all rules in chain ?
  2004-09-28 19:26 ` Juan Hernandez
@ 2004-09-28 19:28   ` Alexis
  2004-09-28 23:28   ` Abylai Ospan
  1 sibling, 0 replies; 8+ messages in thread
From: Alexis @ 2004-09-28 19:28 UTC (permalink / raw)
  To: 'Juan Hernandez', netfilter

It will delete all rules in a chain!!!
 

> -----Mensaje original-----
> De: netfilter-bounces@lists.netfilter.org 
> [mailto:netfilter-bounces@lists.netfilter.org] En nombre de 
> Juan Hernandez
> Enviado el: Martes, 28 de Septiembre de 2004 16:26
> Para: netfilter@lists.netfilter.org
> Asunto: Re: Help need :) How to delete all rules in chain ?
> 
> iptables -F
> On Tue, 2004-09-28 at 15:48, 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 ?
> > 
> > wbr, Abylai
> > 
> -- 
> 
> Juan Hernandez, RHCE SCSA
> .knxTech C.A.
> CC Los Chaguaramos, Ofc 16-10B      |  Tel: (58) 212-6624745
> Los Chaguaramos, Caracas-Venezuela  |  Mobile: (58) 412-5821882
> 
> Programmin' Python is like sugar... Sweet ;)
> 
> 
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Help need :) How to delete all rules in chain ?
@ 2004-09-28 19:48 Abylai Ospan
  2004-09-28 15:57 ` Jason Opperisano
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Abylai Ospan @ 2004-09-28 19:48 UTC (permalink / raw)
  To: netfilter

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 ?

wbr, Abylai



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help need :) How to delete all rules in chain ?
  2004-09-28 19:48 Help need :) How to delete all rules in chain ? Abylai Ospan
  2004-09-28 15:57 ` Jason Opperisano
  2004-09-28 19:26 ` Juan Hernandez
@ 2004-09-28 20:14 ` Aleksandar Milivojevic
  2 siblings, 0 replies; 8+ messages in thread
From: Aleksandar Milivojevic @ 2004-09-28 20:14 UTC (permalink / raw)
  To: netfilter

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@pbl.ca>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help need :) How to delete all rules in chain ?
  2004-09-28 23:28   ` Abylai Ospan
@ 2004-09-28 20:38     ` Nick Taylor
  0 siblings, 0 replies; 8+ messages in thread
From: Nick Taylor @ 2004-09-28 20:38 UTC (permalink / raw)
  To: Abylai Ospan; +Cc: netfilter, Juan Hernandez

> > > 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 ?
> > >
> > iptables -F
> >
> oh, no :) I don't need delete all rules in chain :) I need to delete
> identical rules specified by rule.
>
Er, maybe this is a silly question, but how is it that your firewall
chain ended up with three copies of the same rule?  Maybe it's easier to
prevent this from happening in the first place?  Does a second or third
copy of a rule have any use to you?  As far as I can think this would only
make sense in non-terminating rules (like LOG) and rules which match
against something internal to netfilter, like -m mark.  Maybe you could
provide more info on the source and content of the rules?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help need :) How to delete all rules in chain ?
  2004-09-28 19:26 ` Juan Hernandez
  2004-09-28 19:28   ` Alexis
@ 2004-09-28 23:28   ` Abylai Ospan
  2004-09-28 20:38     ` Nick Taylor
  1 sibling, 1 reply; 8+ messages in thread
From: Abylai Ospan @ 2004-09-28 23:28 UTC (permalink / raw)
  To: Juan Hernandez; +Cc: netfilter

> iptables -F

oh, no :) I don't need delete all rules in chain :) I need to delete
identical rules specified by rule.

> On Tue, 2004-09-28 at 15:48, 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 ?
> > 
wbr, Abylai




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Help need :) How to delete all rules in chain ?
  2004-09-28 15:57 ` Jason Opperisano
@ 2004-09-28 23:29   ` Abylai Ospan
  0 siblings, 0 replies; 8+ messages in thread
From: Abylai Ospan @ 2004-09-28 23:29 UTC (permalink / raw)
  To: Jason Opperisano; +Cc: netfilter

thanks for replay :) 
I see this way already, but it need to make some help scripts which not
estetical :)

> On Tue, 2004-09-28 at 15:48, 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 ?
> > 
> > wbr, Abylai
> 
> AFAIK, there is no way to make "-D" delete multiple, identical rules. 
> if you have that rule in there multiple times, hit <up-arrow><enter> a
> few times until you get:
> 
>   iptables: Bad rule (does a matching rule exist in that chain?)
> 
> if you use a script to flush/reload rules, you normally won't run into
> this situation.
> 
> -j
-- 
С уважением,
Абылай
Компания NetUP



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-09-28 23:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-28 19:48 Help need :) How to delete all rules in chain ? Abylai Ospan
2004-09-28 15:57 ` Jason Opperisano
2004-09-28 23:29   ` Abylai Ospan
2004-09-28 19:26 ` Juan Hernandez
2004-09-28 19:28   ` Alexis
2004-09-28 23:28   ` Abylai Ospan
2004-09-28 20:38     ` Nick Taylor
2004-09-28 20:14 ` Aleksandar Milivojevic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.