1

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.

3
  • 2
    Are you using iptables-persistent or the scripts described in the wiki? What happens when you run your scripts?
    – adric
    Apr 16, 2012 at 19:57
  • I ran apt-get install iptables-persistent and followed the steps in the wiki (no, I did not use any scripts). Is there any additional configuration involved in iptables-persistent?
    – Eleeist
    Apr 16, 2012 at 20:04
  • 1
    For the record, I suggest you look at something like firehol, ufw, shorewall, or some other iptables front end. Creating a really strong set of rules by hand can get pretty difficult.
    – Zoredache
    Apr 16, 2012 at 21:21

1 Answer 1

5

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.

5
  • Let's go with the iptables-persistent method. I pasted my rules into /etc/iptables/rules.v4 and ran iptables-save > /etc/iptables/rules.v4. The iptables did not update. I tried to restart iptables-persistent and also do a reboot, but the iptables -L stays empty.
    – Eleeist
    Apr 16, 2012 at 20:50
  • The command iptables-save > /etc/iptables/rules.v4 would over-write anything you pasted into /etc/iptables/rules.v4. Are you sure you didn't mean to do a restore?
    – Zoredache
    Apr 16, 2012 at 21:11
  • @Christopher, BTW are you sure the file isn't /etc/iptables/rules instead of rules.v4? Is the v4 a wheeze thing perhaps, the iptables-persistent on squeeze seems to use a file named rules.
    – Zoredache
    Apr 16, 2012 at 21:16
  • @Zoredache - Good point. rules.v4 is what the wheezy (testing) and sid (unstable) packages are using. /etc/iptables/rules is what the squeeze (stable) package looks to be using. I'll update the answer info to note the differences. Apr 16, 2012 at 21:44
  • I have done the same for rules (pasted my rules in there and saved using iptables-save > /etc/iptables/rules). Now I rebooted my machine and the changes did not save. Any more ideas? :)
    – Eleeist
    Apr 18, 2012 at 8:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .