6in4 IPv6-Tunnel + Subnet Debian init.d Script

Aus Wiki Net6.AT
Wechseln zu: Navigation, Suche
#! /bin/sh
### BEGIN INIT INFO
# Provides:          ipv6
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: IPv6 startup script
# Description:       IPv6 startup Script
### END INIT INFO

LOCAL="YOUR-IPv4"
REMOTE="TB-IPv4"
REMOTE6="aaaa:bbbb:cccc:bbbb::2"
SUBNET="aaaa:bbbb:cccc:aaaa" # without ::/48, ::1/48 etc..
DEV="IPv6"

case "$1" in
  start)
    echo "Starting script IPv6.."

    ip t a $DEV mode sit local $LOCAL remote $REMOTE ttl 64
    ip l s $DEV up
    ip a a $REMOTE6/64 dev $DEV
    ip a a $SUBNET::1/48 dev $DEV
    ip a a $SUBNET::2/48 dev $DEV
    ip a a $SUBNET::3/48 dev $DEV
;;
stop)
    echo "Stopping script IPv6.."
    
        ip tu de $DEV
;;
  *)
    echo "Usage: /etc/init.d/ipv6 {start|stop}"
    exit 1
    ;;
esac

exit 0