[SOLVED] Problem saving iptables rules in Ubuntu 8.10
Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have been trying to save some modifications to my iptables rules and have been observing some interesting, but frustrating, behavior. Any help/advice is very appreciated.
What am I trying to do: open up a port using iptables.
What have I done:
-created an iptables backup with iptables-save, modified it, used iptables-restore
-modified /etc/network/interface to contain pre-up iptables-restore and post-down iptables-save statement
-modified /etc/network/-if-pre-up.d/iptables to conatin shell command to use iptables-restore
The problem: When I log out of my ssh session, iptables goes back to what it was without the statement to open up the port I want to.
When I log in again, use iptables-restore and use iptables -L -v I can see that the necessary statements are in the iptables rules.
Once again when I log out, the rules get changed, the port gets shut down. I have tried doing this in a screen session and detaching from it and then closing down my ssh session, yet no success.
What can I do to make sure iptables does not restore to original state after I log out?
Thanks for the reply. Yes, you are right, the system I inherited is pretty old! I will be upgrading it :-)
The interesting thing is when I use iptables-restore to load in the modified iptables rules, and do iptables -L -v everything is as it should be, ports are open etc.. as soon as I logout of the ssh session, port shuts down. Again, when I log in, usin iptables -L -v, the modified entry loaded via iptables-restore is no longer there!
Did you check the user's (account with which you are logging) .bash_logout. If not then check it out. It might be possible that you have set some instructions related to iptables there and probably forgot about them.
Great!!! Good to hear that you got it sorted. I thought of it because some administrator use this as failsafe. Suppose they set up a rule to block ssh and what if they will log out and then not able to ssh back into the machine.
Usually they do remove after testing but in your case it appears that someone forgot to remove after testing :-)