ipchains

X4Nt3R1UM

Member
Apr 25, 2003
58
0
0
on a fresh installed RH Linux 7.1, i have appended rules to my ipchains and execute "ipchains-save > /etc/ipchains.rules" to save the newly appended rules. Upon rebooting nothing is saved, (nothing is appended!).
What could be my problem?

please help

x4nt3r1um
 

MrYogi

Platinum Member
Mar 15, 2003
2,680
0
0
ripped from somewhere

Making Rules Permanent
Your current firewall setup is stored in the kernel, and thus will be lost on reboot. I recommend using the `ipchains-save' and `ipchains-restore' scripts to make your rules permanent. To do this, set up your rules, then run (as root):


# ipchains-save > /etc/ipchains.rules
#

Create a script like the following:


#! /bin/sh
# Script to control packet filtering.

# If no rules, do nothing.
[ -f /etc/ipchains.rules ] || exit 0

case "$1" in
start)
echo -n "Turning on packet filtering:"
/sbin/ipchains-restore < /etc/ipchains.rules || exit 1
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "."
;;
stop)
echo -n "Turning off packet filtering:"
echo 0 > /proc/sys/net/ipv4/ip_forward
/sbin/ipchains -F
/sbin/ipchains -X
/sbin/ipchains -P input ACCEPT
/sbin/ipchains -P output ACCEPT
/sbin/ipchains -P forward ACCEPT
echo "."
;;
*)
echo "Usage: /etc/init.d/packetfilter {start|stop}"
exit 1
;;
esac

exit 0