QuickCode: Setting up IPV6 on your mac using tunnelbroker
November 15, 2010 | No Comments | networking, quickcode
1) Sign up for an account at tunnelbroker.com (also known as HE)
2) Using the tunnel broker website create a new tunnel and make a note of the settings it assigns you.
3)create a file with the following as its contents….
#!/bin/bash######################################################################## Update the HE (Hurricane Electric) ipv6-tunnel######################################################################## Interface to use: en1 = Airport, en0 = EthernetMYIF=”en1″# leave as isIPCACHE=”/Library/Caches/ipv6scriptIP”HEUSER=3da0676a512baf3294f7eb923f115beaHEPASS=1eb2c32ab1c2616725fadab3554e0c5bHETUNNEL=81743HETUNEND=216.66.80.26HEYOUR6END=2001:470:1f08:1062::2HETHEIR6END=2001:470:1f08:1062::1HEPREFIX=64HEMY64IP=2001:470:1f08:1062::3######################################################################## Config end######################################################################## sometimes this script will get executed twice at the same time, not good, so:if [ -f $IPCACHE.lock ] ; thenecho A copy already running!exit 0elsetouch $IPCACHE.lockfi# This is faster if your router sets a dyndns entry:#NEW_IP=`dig mycomp.myvnc.com|grep “^mycomp”| grep -Eo “\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>”`NEW_IP=`curl -s “http://www.networksecuritytoolkit.org/nst/cgi-bin/ip.cgi”`# Wait for the network…while [ ! -n "$NEW_IP" ]dosleep 10#NEW_IP=`dig mycomp.myvnc.com|grep “^mycomp”| grep -Eo “\<[[:digit:]]{1,3}(\.[[:digit:]]{1,3}){3}\>”`NEW_IP=`curl -s “http://www.networksecuritytoolkit.org/nst/cgi-bin/ip.cgi”`doneOLD_IP=`cat $IPCACHE`if [ "$NEW_IP" = "$OLD_IP" ] ; thenCURCONF=`ifconfig |grep $HETUNEND`if [ -n "$CURCONF" ] ; thenecho Nothing to dorm $IPCACHE.lockexit 0fifiecho -n $NEW_IP > $IPCACHE# if you need to use your public ip address, use LOCAL_IP=$NEW_IP insteadLOCAL_IP=`ifconfig $MYIF |grep -E ‘inet.[0-9]‘ | grep -v ’127.0.0.1′ | awk ‘{ print $2}’`# let’s delete a pre-existing gif0, ignore any errorsifconfig gif0 deletetunnelifconfig gif0 downifconfig gif0 inet6 delete $HEYOUR6ENDifconfig gif0 inet6 delete $HEMY64IProute delete -inet6 default -interface gif0# update the tunnelcurl -k -s “https://ipv4.tunnelbroker.net/ipv4_end.php?ipv4b=$NEW_IP&pass=$HEPASS&user_id=$HEUSER&tunnel_id=$HETUNNEL”echo ” “sleep 1ifconfig gif0 tunnel $LOCAL_IP $HETUNENDifconfig gif0 inet6 $HEMY64IP/64 aliasifconfig gif0 inet6 $HEYOUR6END $HETHEIR6END prefixlen /$HEPREFIXroute -n add -inet6 default $HETHEIR6ENDrm $IPCACHE.lockexit 0
4) Fill in these details in the above script…
HEUSER= Your userhash from the top of the tunnelbroker login page.
HEPASS= type echo <Your HE password>|md5 to get this value.
HETUNNEL= The tunnel Id assigned to you from tunnelbroker.
HETUNEND=The IPV4 server address supplied by tunnelbroker.
HEYOUR6END=Your IPV6 address as assigned by tunnelbroker.
HETHEIR6END=tunnelbroker’s IPV6 address.
HEPREFIX= this is always 64 unless your doing some advanced configuration which is beyond the scope of this post.
5) chmod the script +x
6) type ./<scriptname> to create your tunnel, If all has gone well you should be able to see ipv6.google.com
7) Enjoy.
Full Credit goes to http://pugio.net/2009/01/enable-ipv6-on-mac-os-x-the-tu.html for the creation of the above script, His tutorial is much better than mine, I’ve just tried to make it a little shorter for the more ‘tech savvy’ and inpatient among us.






