iptables-restore command failing on new Debian 6 server

Hi all. Very much a student admin here. Per the "Securing Your Server" guide in the Linode Library, I'm attempting to firm up my new Debian 6 install.

When I run 'sudo iptables-restore < /etc/iptables.firewall.rules' I receive the following output (I get the same output if I enter the command as root without sudo):

FATAL: Module ip_tables not found.
'ptables-restore v1.4.8: iptables-restore: unable to initialize table 'filter

Error occurred at line: 1
Try `iptables-restore -h' or 'iptables-restore --help' for more information.

I've googled this content quite a bit, as well as searching these forums for what appear to be the distinguishing snippets of the error message, but unfortunately I'm not finding anything that speaks directly to my situation (as far as I can tell).

The iptables package is up to date, according to apt-get.

In spite of the error message, the first line in /etc/iptables.firewall.rules is definitely '*filter' (NOT " 'filter ").

The output of 'sudo iptables -L' is normal (according to the guide):

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Any thoughts on the matter would be most welcome. Thanks!

5 Replies

Module iptables isn't loaded (FATAL error message). Try "sudo modprobe iptables" and try again with "sudo iptables-restore < /etc/iptables.firewall.rules"

Okay, executed 'sudo modprobe ip_tables' with the following result:

FATAL: Module ip_tables not found.

This is probably going to painfully illustrate my ignorance, but I understand iptables-restore to be part and parcel of the iptables package, which is clearly installed and enabled on my system. How is it that I've got iptables running, but there's a critical portion of the package missing from a clean install? Surely I'm not the first person to run into this - I'm following the beginnner's guides step by step.

The ip_tables functionality is compiled statically into the Linode kernel. Modprobe fails because you don't need to load a module. Somehow, iptables-restore isn't properly detecting that this capability is in the kernel.

Your options include getting this fixed as a bug, using the stock Debian kernel, or using a different tool to manage firewall rules.

Sorry, Thought I had a solution, but misunderstood your problem.

/Martin

I encountered the same error as the original poster. I'm posting my (easy) solution here for others. I am using Ubuntu 12.04LTS, but I don't think that matters.

This problem often happens if iptables.firewall.rules was created on another system. For example, I created the file in Windows and then SFTP'ed it to my Linux server. This will not work.

The solution is to create the file from scratch using your Linux machine:

sudo nano /etc/iptables.firewall.rules

If you are using Putty, you can still copy-and-paste text from a Windows web browser into Putty's nano session and it will work.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct