Jump to content

Iptables


niels

Recommended Posts

Hey everybody,

I'm having some issue on an older version of Iptables version 1.4.2

I'm using this command : iptables-restore < /etc/network/iptables.config

And the content of the iptables.config file is :

*filter
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT

-A INPUT -i lo -j ACCEPT
-A OUTPUT -o lo -j ACCEPT

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT --src x.x.x.x

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT --src x.x.x.x

-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT --src x.x.x.x
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j DROP

-A INPUT -j REJECT
-A FORWARD -j REJECT

COMMIT

I've used this exactly the same config for another server and there I did't got any troubles.

But now I got this output:

iptables-restore v1.4.2: no command specified

Error occurred at line: 16

Try `iptables-restore -h' or 'iptables-restore --help' for more information.

I already truncated the file line endings, commenting out some rules but still didn't work.

And it always throws the error/exception.

Strange part is I use the exact same file for another server and it doesn't complain about any errors or exceptions and it works fine.

Anybody had the same experience or anybody some advise ?

Thanks a lot in advance!

Link to comment
Share on other sites

What Linux distro are you using?

Link to comment
Share on other sites

What Linux distro are you using?

I'm using this version of debian:

Linux version 2.6.26-2-xen-amd64 (Debian 2.6.26-24) (dannf@debian.org) (gcc version 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)) #1 SMP Sun Jun 20 20:51:58 UTC 2010

Link to comment
Share on other sites

Is this the exact copy of the file you are using during your restore ? Just wondering what is on Line 16 that is causing problems ?

Yes it is, I'm using a ruby script to deploy several firewalls on different servers and a git repo to keep up with the changes.

But I also tried this one manually and I wasn't able to get it working.

Anybody a clue, seems that older servers can't handle the syntax.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...