LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-14-2012, 11:29 AM   #1
kiloman
LQ Newbie
 
Registered: Mar 2011
Posts: 2

Rep: Reputation: 0
Delete rule from iptables


Hi,

Is there a way so I can delete a rule in iptables without specifying the whole rule specification?

for example, I want to add the following rule:
Code:
iptables -A TEST-CHAIN -s 1.1.1.1 -j ACCEPT -m mac --mac-source 11:11:11:11:11:11 -m comment --comment "B0909"
And when I want to delete the rule I hoped I could do something like this, but clearly this doesn't work:
Code:
iptables -D TEST-CHAIN -s 1.1.1.1 -j ACCEPT -m mac --mac-source 11:11:11:11:11:11
I know I can use a script to retrieve the line number where there is a match on ip and mac and then delete it that way, but I really hoped that there was a more easy way to do this.
 
Old 01-14-2012, 11:51 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
You can delete only by number or by full match. It will be useful to have possibility of deleting partialy matched rules, but other side, rules are usualy seldom altered by hand, on the fly. For example they are assigned by some script at bootup, where they should be edited.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables: rule with RETURN target just after a rule with ACCEPT target Nerox Linux - Networking 6 09-04-2011 03:33 PM
iptables rule kim_bcs Linux - Security 1 01-28-2011 09:34 AM
Iptables rule psix Linux - Security 3 11-08-2010 01:50 AM
change samba's default delete rule? iesaunders Linux - Server 4 04-21-2007 11:52 AM
iptables delete rule Fredde87 Linux - Newbie 6 11-03-2006 09:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration