LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-06-2007, 02:08 PM   #1
apachenew
Member
 
Registered: Jul 2007
Posts: 30

Rep: Reputation: 15
iptables restart in Debian Etch


Hello,

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


Any suggestion?

Thanks.
 
Old 08-07-2007, 03:20 AM   #2
sarajevo
Member
 
Registered: Apr 2005
Distribution: Debian, OpenBSD,Fedora,RedHat
Posts: 228
Blog Entries: 1

Rep: Reputation: 31
Hi,

put all iptables rules to an file for example firewall.sh
copy firewall.sh in /etc/init.d/
do
update-rc.d firewall.sh defaults ( in /etc/init.d/ ).

Please see man update-rc.d I am not sure about above commmand.

Reboot ( it should works )

Regards

Sarajevo
 
Old 08-07-2007, 03:34 AM   #3
sarajevo
Member
 
Registered: Apr 2005
Distribution: Debian, OpenBSD,Fedora,RedHat
Posts: 228
Blog Entries: 1

Rep: Reputation: 31
... and take a look at



http://iptables-tutorial.frozentux.n...-tutorial.html

the best place for all questions related to iptables

Regards
 
Old 08-08-2007, 04:01 PM   #4
apachenew
Member
 
Registered: Jul 2007
Posts: 30

Original Poster
Rep: Reputation: 15
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
 
Old 08-09-2007, 06:14 AM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
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.

jlinkels
 
Old 09-10-2007, 01:03 AM   #6
nixonmohan
LQ Newbie
 
Registered: Jul 2007
Posts: 16

Rep: Reputation: 0
Hi,

I have firewall scripts in the following path : /etc/scripts/firewall.sh

I need to restart the firewall.sh service ...how can i do it

Can u please tell me the command to restart the firewall.sh service

Thanks
Nixon.M
 
Old 09-11-2007, 01:53 PM   #7
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
The firewall.sh is not a service. It is a collection of instructions to iptables what configuration to set.

If you run the file /etc/scripts/firewall.sh and the firewall.sh is a correct and valid script, iptables will be set up correctly.

The command to run is (as root)
/etc/scripts/firewall.sh

I hope you looked up the examples how to create such a script. If so, ther should be no problem.

jlinkels
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian Etch+Networking restart problem kirby76 Linux - Networking 2 05-08-2007 02:06 AM
update Debian testing etch RC1 to etch stable cccc Debian 11 01-08-2007 10:02 PM
Dual boot Debian Etch and XP with GRUB - Debian installed First - one HDD bence8810 Debian 11 01-07-2007 10:45 AM
how to restart iptables ? skate Linux - Networking 3 08-23-2006 02:04 AM
iptables restart bijuhpd Linux - Security 2 05-13-2005 07:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 11:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration