Skip to contentSkip to conversation

how to delete a piece of rule in iptables?

DISCUSSION bobo 4 participants 4 messages Dec 18, 2002 – Dec 19, 2002

lore
Share & tools
lore

bobo

author
#0 lore raw

i have insert some rules to iptables firewall.now,i would
like to delete it .
but i only know to use iptalbes -L to empty them.
but it lead to delete all the rules in it.
how to do ??

#1 lore raw

Hi,
you can use iptables -D or -X or -F. -D to delete a single rule, -X do detele a chain and -F to flush all rules from a chain. Refer to man 8 iptables for details and examples.

Marcello

Il mer, 2002-12-18 alle 13:30, bobo ha scritto:

Quoted 6 lines

i have insert some rules to iptables firewall.now,i would
like to delete it .
but i only know to use iptalbes -L to empty them.
but it lead to delete all the rules in it.
how to do ??

Signature · 1 line
Marcello Scacchetti <[email protected]>
#2 lore raw
In reply to bobo

Hello bobo,

Wednesday, December 18, 2002, 3:30:18 PM, you wrote:

b> i have insert some rules to iptables firewall.now,i would
b> like to delete it .
b> but i only know to use iptalbes -L to empty them. b> but it lead to delete all the rules in it. b> how to do ??

Try to use
iptables -D INPUT 1
this will delete rule 1 in input chain

Signature · 2 lines
Best regards,
 ITM                            mailto:[email protected]
#3 lore raw

Hello,

There is a option --line-numbers, which can be used with -L in iptables. Knowing the line/rule numbers ... u can later delete the specific rule.

Commands :

#iptables -nL --line-numbers ---> this will show you the rulenumbers

#iptables -D <chain-name> <rule-number>

Bye,
Narendra.

In the middle of difficulty..... lies Opportunity. (Albert Einstein)
--------------------------------------------------------------------
Narendra Prabhu. B Free Software at its product-ive best.
DeepRoot Linux http://www.deeproot.co.in
---- Server Appliances ----
---- Linux Support and Services ----
-------------------------------------------------------------------

Quoted 18 lines · ITM CS Ruslan O. Nesterov

Hello bobo,

Wednesday, December 18, 2002, 3:30:18 PM, you wrote:

b> i have insert some rules to iptables firewall.now,i would
b> like to delete it .
b> but i only know to use iptalbes -L to empty them. b> but it lead to delete all the rules in it. b> how to do ??

Try to use
iptables -D INPUT 1
this will delete rule 1 in input chain

--
Best regards,
ITM mailto:[email protected]