gre.sh
#!/bin/sh
# for FreeBSD
REMOTE_IPV4=<PEER_IPV4_ADDRESS>
LOCAL_IPV4=<YOUR_LOCAL_IPV4_ADDRESS>
REMOTE_IPV6=<PEER_TUNNEL_IF_IPV6_ADDRESS>
LOCAL_IPV6=<YOUR_TUNNEL_IF_IPV6_ADDRESS>
TUN=gre0 # fixme
case "$@" in
start)
ifconfig $TUN create
ifconfig $TUN tunnel $LOCAL_IPV4 $REMOTE_IPV4 link0
ifconfig $TUN inet6 $LOCAL_IPV6/64
ifconfig $TUN up
;;
stop)
ifconfig $TUN destroy
;;
show)
ifconfig
;;
ping)
ping6 -I $TUN $REMOTE_IPV6
;;
*)
echo "$0 [start|stop|show|ping]"
esac