init-script question: iptables and networking
Hello,
like many, I have an old box set up as gateway. Upon reboot, I'd like it
to load the appropriate iptables rules and set /proc/../ip_forward to 1.
Until now, I'm doing this by a self-made "init script" that will do just
that, but won't understand any of the usual start|stop|restart|[etc]
options. Not exactly a script, really.
Now I've stumbled over an actual existing script, /etc/init.d/iptables.
I just failed to see it until today.
Would it be 'smarter' or 'better policy' to employ this script instead
of my own pseodo-script? And, what does it actually do? I couldn't find
any docs, and reading the script itself I'm not sure whether I
understand it correctly -- I do however get a feeling as if my brain was
wildly spinning in my head. Just running the script and see what happens
doesn't seem to be a prudent approach as well.
Next, in /etc/init.d/networking I found the following:
> ip_forward () {
> if [ -e /proc/sys/net/ipv4/ip_forward ]; then
> echo -n "Enabling packet forwarding: "
> echo 1 > /proc/sys/net/ipv4/ip_forward
> echo "done."
> fi
I read this as "if .../ip_forward exists, set it to 1", however, this
doesn't work for me. This script seems easier to understand than the one
above, and I don't see anything that might have the power not to call
the above function -- it should be invoked every time the script is run,
but I have /proc/sys/net/ipv4/ip_forward = 0 after boot.
If somebody could enlighten me with regard to either script... please?
cu,
Schnobs
Reply to: