November 24, 2024, 02:06:15 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: IPTABLES Firewall  (Read 5268 times)

Offline Saif

  • Linux Noob !
  • *
  • Posts: 10
IPTABLES Firewall
« 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

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
IPTABLES Firewall
« Reply #1 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
:)

Offline Saif

  • Linux Noob !
  • *
  • Posts: 10
IPTABLES Firewall
« Reply #2 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