LinuxQuestions.org
Review your favorite Linux distribution.
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 05-29-2008, 08:29 AM   #1
ralphuk100
LQ Newbie
 
Registered: Apr 2004
Posts: 15

Rep: Reputation: 0
restarting firewall loses my new rule


I want to open port 1055 so I did the following command:

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 1055 -j ACCEPT

Then I ran

iptables -L -n

to check the rule was there. Then I ran

/etc/init.d/firewall restart and my rule has gone...?

There is no man for firewall either.

What do I have to do to get this port opened permanently?

Thanks.
 
Old 05-29-2008, 09:04 AM   #2
kummiliim
Member
 
Registered: Mar 2007
Location: Tallinn, Estonia
Distribution: Slackware 12.0
Posts: 276

Rep: Reputation: 30
Your /etc/init.d/firewall script probably does a "iptables --flush" that removes all the rules. Edit the script and add your rule there so it's added on every boot. Firewall rules are kept in startup files afaik, at least I do that : ).
 
Old 05-29-2008, 10:00 AM   #3
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,053

Rep: Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881Reputation: 881
Quote:
Originally Posted by ralphuk100 View Post
There is no man for firewall either.
You tried 'man iptables' and that didn't work? Which Distro is this? Maybe you didn't install the 'extra documentation' or something?

Quote:
Edit the script and add your rule there so it's added on every boot. Firewall rules are kept in startup files afaik, at least I do that...
That works. You could also use iptables-save and iptables-restore (if you want to preserve counters) or run a script that just adds your rule to the ones that your distro runs by default. Or if your distro does something involved with firewall rules, then you might need a bit of thought to see how you co-operate with what it does (e.g., SuSE, where you might want to use Yast).

There are a number of ways of skinning this particular cat and you just have to choose the most appropriate one for your circumstances.
 
Old 05-29-2008, 10:29 AM   #4
ralphuk100
LQ Newbie
 
Registered: Apr 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks! I added the rule to the firewall script and it worked a treat
 
  


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
Firewall-Rule Net_Spy Linux - Networking 4 11-20-2007 12:06 PM
how to write this firewall rule ? naihe2010 Linux - Networking 1 01-15-2007 10:56 PM
funny new firewall rule tom_from_van Linux - Security 3 07-19-2005 12:39 PM
is this firewall rule safe? melinda_sayang Linux - Security 1 12-21-2004 08:44 AM
Need A Firewall Rule linuxboy69 Linux - Software 1 11-26-2003 05:29 PM


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