LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   restarting firewall loses my new rule (https://www.linuxquestions.org/questions/linux-newbie-8/restarting-firewall-loses-my-new-rule-645573/)

ralphuk100 05-29-2008 07:29 AM

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.

kummiliim 05-29-2008 08:04 AM

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 : ).

salasi 05-29-2008 09:00 AM

Quote:

Originally Posted by ralphuk100 (Post 3168051)
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.

ralphuk100 05-29-2008 09:29 AM

Thanks! I added the rule to the firewall script and it worked a treat :D


All times are GMT -5. The time now is 11:42 AM.