LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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, 07: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, 09:14 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,220

Rep: Reputation: 307Reputation: 307Reputation: 307Reputation: 307
-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 09: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 04:34 AM
IPTables interface option priyadarshan Linux - Security 6 11-11-2011 12:24 AM
Question about an iptables option kaplan71 Linux - Software 1 01-21-2009 05:18 PM
How to replace iptables by fwbuilder script ? marozsas Fedora 2 04-10-2006 08:40 AM
iptables-restore v1.2.11: Line 68 seems to have a -t table option. SupaDucta Linux - Networking 2 01-11-2006 05:38 AM


All times are GMT -5. The time now is 07:49 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration