LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-12-2004, 11:32 AM   #1
mchitrakar
Member
 
Registered: Mar 2004
Posts: 93
Blog Entries: 1

Rep: Reputation: 15
IPTABLES trap


dear buddies,

Well I have here a configured Iptables...but now I added 2 new lines
to this table by : "iptables -t nat...." and this has created a problemo..
guys,, is there a way to restore my previous configuration...and what shud i do so that i dont redo such mistakes..i.e do i know to create a backup of iptables before tweaking??? if yes, then please illuminate me how??
 
Old 11-12-2004, 12:01 PM   #2
Boby
Member
 
Registered: Feb 2004
Posts: 781

Rep: Reputation: Disabled
Hi!

I'm not that big guru in security and iptables. When I wrote my firewall, I created a file called "firewall.sh" and wrote there all iptables commands. Then I run the script ./firewall.sh and it writes everything for me. To make changes, I edit the file and run it again, so I don't have to write everything again.

Boby
 
Old 11-15-2004, 11:48 AM   #3
mchitrakar
Member
 
Registered: Mar 2004
Posts: 93

Original Poster
Blog Entries: 1

Rep: Reputation: 15
oh..thanks....i wish i had done the same...can i now remove my previous lines...by re-writing the correct lines..in firewall.sh...that is...will new entry remove my previous entries....???
 
Old 11-15-2004, 05:29 PM   #4
Boby
Member
 
Registered: Feb 2004
Posts: 781

Rep: Reputation: Disabled
Put this code at the beginning:
Code:
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
This will delete your previous firewall.

On each run of the script it will delete the old one and build a fresh one.

Hope this helpes!
Boby
 
Old 11-17-2004, 04:01 AM   #5
mchitrakar
Member
 
Registered: Mar 2004
Posts: 93

Original Poster
Blog Entries: 1

Rep: Reputation: 15
yeah...thnks but...

dear pal,

thnks, but i was wondering if only last 2 entries can be removed...and keeping the old lines before that intact. By the way..how to read the entries in this table?? pls. do reply.
 
Old 11-17-2004, 05:50 AM   #6
geniarse
Member
 
Registered: May 2003
Location: UK
Distribution: Gentoo
Posts: 141

Rep: Reputation: 15
This is possible, first find the rule numbers for the 2 entries you want to delete. do this with:
Code:
iptables -L
count the line number of the 2 rules, this is there rule number, easy

Now delete them with:
Code:
iptables -D nat 7
where natis the table anme and 7 is the rule number.
 
  


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
how to send snmp trap & recieve trap in C program minil Programming 3 07-10-2010 09:22 AM
Kernel trap (Fatal trap 12) m!k@EL *BSD 4 09-05-2007 11:58 PM
trap command for c? onnyloh Programming 3 09-13-2004 04:06 AM
trap signals AMMullan Programming 3 10-19-2003 04:31 PM
specific-trap? PTBmilo Linux - Security 6 05-26-2003 03:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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