LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-29-2010, 12:37 AM   #1
linuxcoo
LQ Newbie
 
Registered: Mar 2010
Posts: 17

Rep: Reputation: 0
iptables questions


After I apply below iptables

iptables -A PREROUTING -t nat -p tcp --dport 26 -j REDIRECT --to-port 25

How can I cancel it?

Thank you
 
Old 03-29-2010, 01:20 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Delete the rule from the chain?
 
0 members found this post helpful.
Old 03-29-2010, 01:44 AM   #3
linuxcoo
LQ Newbie
 
Registered: Mar 2010
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by linuxlover.chaitanya View Post
Delete the rule from the chain?
You mean I just edit the iptables file(/etc/sysconfig/iptables
) ?

Actually, I don't see the iptables file in there. Can I apply that redirection before the iptables created? If a yes, the rule will be created and saved in the iptables, right?

Thank you so much
 
Old 03-29-2010, 01:46 AM   #4
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
No not delete the file but the rule that you want to. And if you have not saved the rule then it will automatically be removed once the service or system is rebooted.
 
0 members found this post helpful.
Old 03-29-2010, 04:05 AM   #5
hardcorelinux
Member
 
Registered: Jan 2005
Location: India
Distribution: RHEL,CentOS,SUSE,Solaris10
Posts: 183

Rep: Reputation: 31
First findout the line number and delete the rule using -D option

iptables -L -n --line-numbers | grep PREROUTING ( Here you will get the line number of the rule)

Then run

iptables -D PREROUTING <INSERT THE LINE NUMBER HERE>
 
1 members found this post helpful.
Old 03-29-2010, 04:06 AM   #6
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Come on linuxlover.chaitanya just don't give him a bone. At least point out to the all favorite man iptables if you don't want to serve him a full meal

As the -A option appends a rule to iptables the -D option deletes a rule. Just exchange the -A with a -D and leave the rest like it is.
You can also delete by rulenumber. Check out the man page for this. It just like you would insert with -I
 
  


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
iptables questions hattori.hanzo Linux - Networking 1 05-16-2008 08:31 AM
iptables questions FNC Linux - Security 3 07-12-2007 07:42 PM
iptables questions notsosmart Linux - Security 2 10-15-2006 01:39 PM
questions about iptables Paxmaster Linux - Security 1 07-13-2005 03:01 AM
iptables questions AZDAVE Linux - Security 2 03-25-2004 02:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:16 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration