rendered paste body#! /bin/sh
# tunnel This script starts ip tunneling...
#
# chkconfig 23457 01 99
# description: Starts and stops tunneling. \
TUNDEVICE=sf
LOCAL_HOST=blablabla
REMOTE_HOST=blablabla
TUNDEV_LOCAL_IP=blablabla
TUNDEV_PTP_IP=blablabla
REMOTE_NET=blablabla
case "$1" in
start)
echo -n "Starting tunnel for $TUNDEVICE..."
/sbin/modprobe ip_gre
/sbin/ip tunl add $TUNDEVICE mode gre remote $REMOTE_HOST local $LOCAL_HOST ttl 32
/sbin/ifconfig $TUNDEVICE $TUNDEV_LOCAL_IP pointopoint $TUNDEV_PTP_IP
/sbin/route add -net $REMOTE_NET dev $TUNDEVICE
echo "done."
;;
stop)
echo -n "Stopping ip tunneling for $TUNDEVICE..."
/sbin/route del -net $REMOTE_NET dev $TUNDEVICE
/sbin/ifconfig $TUNDEVICE down
/sbin/ip tunl del $TUNDEVICE
/sbin/rmmod ip_gre
echo "done."
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage $1 (start|stop|restart)"
exit 1
esac
exit 0