Viitor_upstart/etc/event.d/routing
kueller 7b7f6e837b V961 Tree Umbau
git-svn-id: svn://svn.compuextreme.de/Viitor/V961/Viitor_upstart@4329 504e572c-2e33-0410-9681-be2bf7408885
2008-05-03 16:59:18 +00:00

48 lines
1.5 KiB
Plaintext

# rc - runlevel compatibility
#
# This task guesses what the "default runlevel" should be and starts the
# appropriate script.
start on started ifup
console logged
script
source /etc/init.d/functions
if [ ! -f /etc/sysconfig/net/notrouter ]; then
echo "Configuring System with routing allowed"
if [ -f /etc/sysconfig/net/gateways ]; then
sed -e "/^#/d" /etc/sysconfig/net/gateways | \
sed -e "/^ *$/d" >/tmp/gateways
exec 3</tmp/gateways
read <&3 TYPE NETWORK OPTION GW NETMASK
while [ $TYPE ]; do
if [ "$OPTION" == "dev" ]; then
echo -n "Adding device Route to $NETWORK with $NETMASK on $GW"
route add -$TYPE $NETWORK netmask $NETMASK dev $GW
evaluate_retval
fi
if [ "$OPTION" == "gw" ]; then
echo -n "Adding net Route to $NETWORK with $NETMASK and gw $GW"
route add -$TYPE $NETWORK netmask $NETMASK gw $GW
evaluate_retval
fi
read <&3 TYPE NETWORK OPTION GW NETMASK
done
exec 3>&-
rm /tmp/gateways
fi
if [ -f /etc/sysconfig/net/defaultrouter ]; then
echo -n "setting up defaultrouter `cat /etc/sysconfig/net/defaultrouter`"
$DEBUG route add default gw `cat /etc/sysconfig/net/defaultrouter`
evaluate_retval
fi
NUMIF=`ip -f inet addr show|grep inet|wc -l`
if [ $NUMIF -gt 2 ]; then
echo -n "Enable ip_forwarding"
echo "1" >/proc/sys/net/ipv4/ip_forward
evaluate_retval
fi
fi
end script