#! /bin/sh

. /etc/rc.d/init.d/functions

PATH=/usr/ipv6/sbin:/usr/ipv6/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
export PATH

case "$1" in
  start)
	# enable forwarding
	echo 1 >/proc/sys/net/ipv6/ipv6_forwarding 

	# get IPv6-over-IPv4 tunnels up (enables automatic tunneling to 0::0/96)
	ifconfig sit0 up

	# configure the local interface
	ifconfig eth0  add 5F03:1200:A40B:6400:64FF::9290:5CCB/80
	route -A inet6 add 5F03:1200:A40B:6400:64FF::0/80 dev eth0

	# if you're on the 6bone you can setup tunnels like shown below.
	# every ifconfig sit0 tunnel 0::<other-tunnel-endpoint-ip>
	# creates a new sit interface. they're named sequentially (sit1,
	# sit2, sit3 and so on)

	# setup a tunnel to davem (5f00:2e00:8006:9e00:0000:0000:0000:002b)
		ifconfig sit0 tunnel ::128.6.155.43
		ifconfig sit1 up
		route -A inet6 add 5f00::0/8 gw fe80::128.6.155.43 dev sit1

	# setup a tunnel to karl (5f04:d700:c643:2100:21ff:0080:29ee:0cbc)
		ifconfig sit0 tunnel ::198.67.33.5
		ifconfig sit2 up
		route -A inet6 add 5F04:D700:C643:2100::0/64 gw fe80::198.67.33.5 dev sit2
	# static routes which hopefull will disappear with RIPng/radvd (to GooseYard)
		route -A inet6 add 5F1E:F500:C7D9:0500::0/64 gw fe80::198.67.33.5 dev sit2

	# setup a tunnel to pp (5f06:df00:c39c:eb00:eb37:0000:c016:e0e9)
		ifconfig sit0 tunnel ::195.156.235.49
		ifconfig sit3 up
		route -A inet6 add 5f06:df00:c39c:eb00::0/64 gw fe80::195.156.235.49 dev sit3

	# setup a tunnel to mint (5f0b:0f00:82f0:c000:ffff:0000:4404:1ab8)
		ifconfig sit0 tunnel ::130.240.192.52
		ifconfig sit4 up
		route -A inet6 add 5f0b:0f00:82f0:c000::0/64 gw fe80::130.240.192.52 dev sit4


# start IPv6 inetd here instead of init
/usr/inet6/bin/inetd /usr/inet6/etc/inetd6.conf


# start router advertisement daemon
#	radvd

    ;;
  stop)
#	killproc radvd
	ifconfig sit0 down
    ;;
  *)
    echo "Usage: /etc/init.d/ipv6 {start|stop}"
    exit 1
esac
