Debian – Difficulty in setting permanent iptables on Debian

debiandebian-squeezeiptables

I have problem setting permanent iptables on Debian 6 Squeeze.

I am working on a brand new instance of a server, freshly created, updated and upgraded to latest version.

Here is the tutorial I followed multiple times:

http://wiki.debian.org/iptables

I am doing all operations as root user.

After completing all the steps in the tutorial and rebooting server, the iptables are reset to default state ie. allow everything in and out.

My aim is to set them "for good", so they won't reset every time the system reboots.

I would appreciate any kind of help.

Thanks.

Best Answer

Ok, first a clarification, did you use the instructions from the Debian Wiki, or did you use the iptables-persistent package? They operate via different mechanisms. The Wiki page is basically describing a manually way of accomplishing what iptables-peristent does.

If you installed iptables-persistent, did you put your iptables rules in the file /etc/iptables/rules.v4 (as described in the iptables-persistent documentation)? If not, that's probably your issue. Try configuring your iptables rules the way you want them, and then run either:

iptables-save > /etc/iptables/rules.v4

or

/etc/init.d/iptables-persistent save

If you didn't use iptables-persistent, but copied the changes required by the Debian Wiki page, you'll need to show us the modifications you made to the files, the if-pre-up script you added, etc.

UPDATE: The iptables-persistent information above is for the package in wheezy (testing) and sid (unstable). For squeeze (stable), the file should be /etc/iptables/rules. Unfortunately, I don't have an easily accessible squeeze/stable based box, so I can't look closer at iptables-persistent on it right now.