Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Network Troublshooting => Linux Servers Support => Topic started by: Saif on August 21, 2004, 03:09:48 AM

Title: IPTABLES Firewall
Post by: Saif on August 21, 2004, 03:09:48 AM
Hi all,
I have created a iptables firewall file named 'firewall"  in /etc/rc.d and changed its mode to 711. In rc.local I have put 'sh /etc/rc.d/firewall'  but unfortunately the file is not being executed during restart.

When i run, sh firewall I get error message. But when I put the iptables one by one, all the rules are accepted.

Can any one help me. Thanks in advance

Saif
Title: IPTABLES Firewall
Post by: Ricky on August 21, 2004, 10:11:24 AM
well.. do it like this..
Code: [Select]
chmod 755 /etc/rc.d/firewall
and put only following in your rc.local
Code: [Select]
/etc/rc.d/fireall
:)
Title: IPTABLES Firewall
Post by: Saif on August 22, 2004, 05:27:52 PM
Ricky
Sorry..I tried with your solution but it is not working. Please see the text inside that file(firewall). It is like this:

#!/bin/sh
IPTABLES=/sbin/iptables

$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD

....... and bla bla bla

Then I did followings:
1. #chmod 755 firewall
2. #vi /etc/rc.d/rc.local
/etc/rc.d/firwall

Please note that I can run it if I put the commands
 sh /etc/rc.d/firewall
But none of the chains are accepted.

Now when i put the same chain directly it accepts all

I do not know why and where I am making a mistake.

Please help

With thanks and regards
Saif