error in /etc/sysconfig/iptables

Bailey Kong bailey@afc.tgpsolutions.com
Mon, 14 Jan 2002 16:13:29 -0800 (PST)


There are a 2 ways you could go about this, the first way, is to load your
script from another location like /home/user and
do /etc/rc.d/init.d/iptables save
and that will saving it to /etc/sysconfig/iptables in the format they want
it and to put the ip_forward at "1" everytime you boot, in /etc/sysctl.conf
there's this line

net.ipv4.ip_forward = 0

just change the 0 to 1 and saving the file.

the second method is to edit the /etc/rc.d/init.d/iptables

   for i in $chains; do iptables -t $i -Z; done

            echo $"Applying iptables firewall rules: "

                # comment out
                #grep -v "^[[:space:]]*#" $IPTABLES_CONFIG | grep -v '^
[[:space:]]*$' | /sbin/iptables-restore -c && \
                # manually add in
                exec $IPTABLES_CONFIG && \
                    success $"Applying iptables firewall rules" || \

comment out the grep line, and add the exec $IPTABLES_CONF && \
save the file and you should be all set

Best Regards
Bailey

> Aditya Kulkarni <freedomink.org@samba.org> wrote:
>> i get an error when i place my iptables rule in
>> /etc/sysconfig/iptables.
>
>
>> The script runs perfectly ,but when i want to put all rules in
>> /etc/sysconfig/iptables .....i get core dumps when i restart the
>> iptables service
>
> This is because RedHat's /etc/sysconfig/iptables should not contain a
> script but the output from iptables-save.
>
> Cheers,
> Juri
>
> --
> Juri Haberland  <juri@koschikode.com>