LinuxQuestions.org
Visit Jeremy's Blog.
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 05-10-2013, 08:46 AM   #1
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Rep: Reputation: 12
How to use the -R[replace] option of the iptables.


Hi,

I am not able find a simple example of use of -R option of iptables.
what I got is ,it is possible to replace a previous rule to some other position.but how to do this.

e.g
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP all -- 10.0.0.2 anywhere
DROP all -- 10.0.0.24 anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

I need the rule 2 to be the first one so ,how I will do that.

Kindly tell any answer regarding this.

Thanks
 
Old 05-10-2013, 10:14 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
-R option is for replacing rules, not for moving it. You want to make delete and then insert in proper position, like:
Code:
iptables -D INPUT 1
iptables -I INPUT 2 -s 10.0.0.2 -j DROP
#or
iptables -A INPUT -s 10.0.0.2 -j DROP
As these are probably only temporary, you need to change position of these rules in your firewall configuration file, where they are loaded at boot.

Last edited by eSelix; 05-10-2013 at 10:18 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Iptables error, unknown option --state leftism Linux - Networking 1 11-03-2012 05:34 AM
IPTables interface option priyadarshan Linux - Security 6 11-11-2011 01:24 AM
Question about an iptables option kaplan71 Linux - Software 1 01-21-2009 06:18 PM
How to replace iptables by fwbuilder script ? marozsas Fedora 2 04-10-2006 09:40 AM
iptables-restore v1.2.11: Line 68 seems to have a -t table option. SupaDucta Linux - Networking 2 01-11-2006 06:38 AM

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

All times are GMT -5. The time now is 11:02 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