DebianThis forum is for the discussion of Debian Linux.
Notices
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.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to setup iptables on Debian Etch.
I added all the rule I need and now trying to find an easy way to start/stop iptables.
On Debian Etch 4.0, where is oldinitdscript.gz ?
I don't think it's there anymore. I checked /usr/share/doc/iptables/examples/ and examples/ doesn't exist.
So instead, I did iptables-save > iptables in /etc/network/if-up.d/ and chmod 700 and tried restarting it and I get:
/etc/network/if-up.d/iptables: line 2: *filter: command not found
/etc/network/if-up.d/iptables: line 3: :INPUT: command not found
/etc/network/if-up.d/iptables: line 4: :FORWARD: command not found
/etc/network/if-up.d/iptables: line 5: :OUTPUT: command not found
/etc/network/if-up.d/iptables: line 6: -A: command not found
/etc/network/if-up.d/iptables: line 7: -A: command not found
/etc/network/if-up.d/iptables: line 8: -A: command not found
/etc/network/if-up.d/iptables: line 9: COMMIT: command not found
Thanks for the info.
I did what you suggested and it seems to work however, when I run the firewall.sh, it generates these errors saying command not found.
So I added #!/bin/sh to the top of the firewall.sh but still same thing.
Anyway, it's no big deal as long as it's working...
/etc/init.d/iptables.sh: line 3: *filter: command not found
/etc/init.d/iptables.sh: line 4: :INPUT: command not found
/etc/init.d/iptables.sh: line 5: :FORWARD: command not found
/etc/init.d/iptables.sh: line 6: :OUTPUT: command not found
/etc/init.d/iptables.sh: line 7: -A: command not found
/etc/init.d/iptables.sh: line 8: -A: command not found
/etc/init.d/iptables.sh: line 9: -A: command not found
/etc/init.d/iptables.sh: line 10: -A: command not found
/etc/init.d/iptables.sh: line 11: -A: command not found
/etc/init.d/iptables.sh: line 12: -A: command not found
/etc/init.d/iptables.sh: line 13: -A: command not found
/etc/init.d/iptables.sh: line 14: -A: command not found
/etc/init.d/iptables.sh: line 15: -A: command not found
/etc/init.d/iptables.sh: line 16: -A: command not found
/etc/init.d/iptables.sh: line 17: -A: command not found
/etc/init.d/iptables.sh: line 18: -A: command not found
/etc/init.d/iptables.sh: line 19: -A: command not found
/etc/init.d/iptables.sh: line 20: -A: command not found
/etc/init.d/iptables.sh: line 21: COMMIT: command not found
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Apparently the contents of the file is not correct. It was created as the output of "iptables -save". That is not a correct bash script. What you only can do with that file is to load it back into iptables with "iptables -load".
You should create a file containing bash commands which call iptables with the correct parameters. What you then actually do is clean out all iptables settings, and give iptables instructions to build a firewall from scratch. That is something different from loading a iptables configuration.
There are plenty of examples on the Internet about building such files.
Where you put the firewall.sh file now is correct.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.