#!/bin/sh # # SIXXS ipv6 startup script for WRT54G # # external IP (Your IPv4) EXTIP=`/sbin/ifconfig vlan1 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'` # My tunnel endpoint (Your IPv6) MYTUNNELIP="2001:4978:f:32::2" #My subnet prefix (Subnet Prefix) SUBNET="2001:abc:abc:cba::" # Sixxs tunnel endpoint (PoP IPv6) SIXXSTUNNELIP="2001:4978:f:32::1" # Sixxs POP IPv4 (PoP IPv4) SIXXS4="216.14.98.22" # create tunnel echo "- Creating SIXXS tunnel... ${EXTIP} <--> ${SIXXS4}" /usr/sbin/ip tunnel add sixxs mode sit local ${EXTIP} remote ${SIXXS4} # bring tunnel interface up explicitly echo "- Bringing sixxs device up..." /usr/sbin/ip link set sixxs up # fix MTU and TTL echo "- Fixing MTU and TTL of sixxs device..." /usr/sbin/ip link set mtu 1280 dev sixxs /usr/sbin/ip tunnel change sixxs ttl 64 # Add virthost IPs before adding tunnel IP # ... # configure IPv6 endpoint on the tunnel echo "- Configuring my IPv6 tunnel endpoint..." /usr/sbin/ip -6 addr add ${MYTUNNELIP}/64 dev sixxs # default route echo "- Adding default route through SIXXS..." /usr/sbin/ip -6 ro add default via ${SIXXSTUNNELIP} dev sixxs # add a /64 network from the /60 prefix to br0 #echo "- Setting up Subnet ..." #/usr/sbin/ip -6 addr add ${SUBNET}/64 dev br0 # start router advertisement daemon echo "- Starting radvd..." /sbin/radvd -C /tmp/smbshare/etc/radvd.conf echo "---- end IPv6 setup ----" sleep 5 WANIP=$(ip -4 addr show dev vlan1 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1) if [ -n "$WANIP" ] then V6PREFIX=$(printf '2002:%02x%02x:%02x%02x' $(echo $WANIP | tr . ' ')) ip tunnel add tun6to4 mode sit ttl 255 remote any local $WANIP ip link set tun6to4 mtu 1280 ip link set tun6to4 up ip addr add $V6PREFIX:0::1/16 dev tun6to4 ip addr add $V6PREFIX:1::1/64 dev br0 ip -6 route add 2000::/3 via ::192.88.99.1 dev tun6to4 kill -HUP $(cat /var/run/radvd.pid) fi