Hurricane electric tunnel + radvd + ipv6 routing on openwrt (on a dynamic ipv4 address)
- All i needed was to install:
- the radvd daemon
- the ipv6 module for openwrt
The initscript:
#!/bin/sh /etc/rc.common
NAME=he6
PROG=/usr/sbin/ip
START=50
STOP=50
PIDCOUNT=0
EXTRA_COMMANDS="restart"
EXTRA_HELP=" restart: stop && start kthxbye"
USERID="randomUUIDfromHE" # your UserID (not your account name!)
MD5PASS="echo -n yourpass |md5" # your password as MD5, create with: echo -n 'yourpassword' | md5sum
GTUNID="GLOBALtunnelID" # your global tunnel ID
SERVER_IPv4_ADDRESS="remote ipv4 endpoint"
updatev4() {
if /usr/bin/wget -q -O - http://ipv4.tunnelbroker.net/ipv4_end.php\?ipv4b=AUTO\&pass=$MD5PASS\&user_id=$USERID\&tunnel_id=$GTUNID |egrep -q '(not valid)'; then
#|That IPv4 endpoint is already in use)'; then
return 1
fi
}
start() {
if updatev4; then
ip tunnel add he6 mode sit remote $SERVER_IPv4_ADDRESS ttl 255
ip link set he6 up
ip addr add you:r:client:ipv6::2/64 dev he6
ip route add ::/0 dev he6
ip route add you:r:routed:ipv6::/64 dev br-lan
ip addr add you:r:routed:ipv6::1 dev br-lan
ip -f inet6 addr
cp /var/resolv.conf.auto /tmp
echo "nameserver any:casted:recursive:dns:server" > /var/resolv.conf.auto
else
echo "Couldn't start he6 interface because the ipv4 endpoint couldn't be updated"
fi
}
stop() {
ip tunnel del he6
ip addr del you:r:routed:ipv6::1 dev br-lan
ip route del you:r:routed:ipv6::/64 dev br-lan
cp /tmp/resolv.conf.auto /var/
}
usage() {
echo "Usage: /etc/init.d/he6 (start|stop|restart)"
}
