Sharing my IPv6 script for Hurricane Electric Tunnel Broker

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Author Message
ac1115
DD-WRT User


Joined: 10 Feb 2010
Posts: 53

PostPosted: Tue Nov 29, 2011 5:10    Post subject: Reply with quote
can you post output of "ip -6 route show"?
Sponsor
scottd09
DD-WRT Novice


Joined: 22 Nov 2011
Posts: 5

PostPosted: Tue Nov 29, 2011 5:24    Post subject: Reply with quote
ac1115 wrote:
can you post output of "ip -6 route show"?


I sent you a PM with it. I don't want to post my /64.
thespillmonkey
DD-WRT Novice


Joined: 29 Dec 2011
Posts: 1

PostPosted: Thu Dec 29, 2011 20:23    Post subject: Reply with quote
Hello all,

I have used my IPv6 tunnel on my stock firmware fine for months now. There is finally a stable version of DD-WRT for the e4200 router, and Ive made the switch.

Unfortunately, following the above script, after the router reboots, I do not have a WAN IP (ipv4) from my ISP.

Removing the script and rebooting brings it right back.

I'll continue to read all the posts and forums, and if I find anything, Ill remove this post, but I appreciate both the script and any help Smile

Thanks!

Running Firmware: DD-WRT v24-sp2 (12/12/11) big
Brainslayer build
naviathan
DD-WRT Novice


Joined: 28 May 2010
Posts: 10

PostPosted: Thu Jan 12, 2012 22:52    Post subject: Reply with quote
This doesn't work for me. I've followed the wiki entry to a "T" and although it looks like it's started the script I think the APIs for TunnelBroker need updating.

This is all I get in the ipv6.log. None of the other files are created.


HE IPv6 Script started

User added addresses cleaned/checked
Cron script created, sending endpoint update request to HE

Ok I have IPv6 support now. I had to change

Code:
echo -e wget -q "\042http://ipv4.tunnelbroker.net/ipv4_end.php?ip=AUTO&pass=$MD5PASS&apikey=$USERID&tid=$TUNNELID\042" -O $CRON_STATUS_LOG_FILE >> $CRON_JOB_FILE


to

Code:
echo -e wget -q "http://ipv4.tunnelbroker.net/ipv4_end.php?ip=AUTO&pass=$MD5PASS&apikey=$USERID&tid=$TUNNELID" -O $CRON_STATUS_LOG_FILE >> $CRON_JOB_FILE


However I still don't have IPv6 DNS support. The OpenDNS entries are being made into resolv.dnsmasq, however it doesn't seem to be using it.
naviathan
DD-WRT Novice


Joined: 28 May 2010
Posts: 10

PostPosted: Fri Jan 13, 2012 0:33    Post subject: Reply with quote
Ok, now I don't have IPv6 anymore. I'm back to where the ipv6.log file stops at
"Cron script created, sending endpoint update request to HE"

It's not generating radvd.conf settings, or anything else that happens beyond that point in the script. I can't find any errors or notes to tell me why.
ac1115
DD-WRT User


Joined: 10 Feb 2010
Posts: 53

PostPosted: Thu Mar 01, 2012 4:05    Post subject: Reply with quote
After a long time away from this. I've updated the script.

I've fixed the blocking issues that prevented the script from updating the endpoint. HE now requires the wan side be pingable inorder to verify the ip address. This will create an iptables rule that will allow the wan ip ping ONLY from the HE.net verification server. Everyone else will still be UNABLE to ping your wan ip, don't fear.

I also added the option to generate a wanup script that will automatically update both local and remote endpoints in case of wan status change.

Lots of little polishing throughout the script as well.

As always, I'll try to answer any questions as best I can. To the few that posted above, if you ever read this, try this new version and see if it helps.
naviathan
DD-WRT Novice


Joined: 28 May 2010
Posts: 10

PostPosted: Thu Mar 01, 2012 17:50    Post subject: Reply with quote
As much as your work is appreciated on this I ended up going with Tomato firmware since the IPv6 part is beyond simple to setup.
aoz1
DD-WRT Novice


Joined: 19 Jun 2012
Posts: 4

PostPosted: Tue Jun 19, 2012 14:17    Post subject: Reply with quote
ac1115,

I even dont't have idea regarding a global solution for your script. I mean average script user.

root@DD-WRT:~# netstat -an | grep ':::'
tcp 0 0 :::139 :::* LISTEN
tcp 0 0 :::53 :::* LISTEN
tcp 0 0 :::22 :::* LISTEN
tcp 0 0 :::23 :::* LISTEN
tcp 0 0 :::445 :::* LISTEN
udp 0 0 :::53 :::*
raw 0 0 :::58 :::* 58

I'm not happy when public samba, etc on my router will be publc worldwide over ipv6.... Smile
Try to think about it.
ac1115
DD-WRT User


Joined: 10 Feb 2010
Posts: 53

PostPosted: Tue Jun 19, 2012 17:16    Post subject: Reply with quote
well that would fall under ip6tables and would vary quite a bit network to network.

I don't think dd-wrt even has ip6tables. But if you want to add a section of the script that creates a few basic firewall rules, go for it.

this script is provided as-is.
iTTT
DD-WRT Novice


Joined: 26 Dec 2008
Posts: 15

PostPosted: Sat Jun 23, 2012 7:52    Post subject: Reply with quote
ac1115 wrote:
....


Hello ac1115,

first thanks for your details info about the IPv6 setting.

i used my WNDR3700 to follow up your setting and works very well last night.

And i like to set my router to reboot everyday at 6AM.

This morning i try to ping ipv6.google.com without luck. So i swich to HE webside, My dynamic IPv4 address is showing at HE webside.
Then i tried to reboot again, but still failed. But sometimes it will succeed.

nslookup as following:
Quote:
C:\Users\xxx>nslookup
DNS request timed out.
timeout was 2 seconds.
Default Server: UnKnown
Address: 2001:470:20::2


Sorry that i am newbie to community, Could you pls help to advise how to fix my problem?

Thanks in advance.
KingPin
DD-WRT Novice


Joined: 08 Jul 2012
Posts: 5

PostPosted: Sun Jul 08, 2012 16:21    Post subject: Reply with quote
thank you for this awesome tutorial, it works like a charm, for a while that is. after an indeterminate amount of time IPv6 goes away and I'm left with ipv4 only working on the lan computers. not sure what causes this, any pointers on where to look would be much appreciated, thank you.

steps :
setup this script
reboot router
ipv4 & v6 are working I can check my ipv6 IP and it shows on online ip checking sites.
wait a while(usually a few hours), go back to same site and now there's no more ipv6, I have tried to check using an IPv6 only site and there's just no ipv6 connectivity.


*Edit forgot to mention, there is still a vlid IPv6 address assigned to my adapter, so maybe the "tunnel" is collapsing somewhere or timing out maybe with lack of use?
ac1115
DD-WRT User


Joined: 10 Feb 2010
Posts: 53

PostPosted: Thu Jul 12, 2012 12:36    Post subject: Reply with quote
Sorry, I have switched to PfSense several months ago so I no longer have a dd-wrt box that I use. And as such I cannot effectively help troubleshoot or maintain the script with. if anyone else would like to take up the script, please feel free to do so.

kingpin, in your case I'd check the running processes list and see if radvd is still running. I'd also try running the startup script again. There is a way to pull the script from the nvram, or you can just copy and paste the script from webconfig into a new file and run it that say. see if that helps. try http://test-ipv6.com/ maybe the detailed results could give more insight.

iTTT: that's a very odd problem, rebooting the router should rerun the script in its entirely. if it worked the first time, it should work all successive times. I'm sorry, but I'm not sure in your case.
vk78
DD-WRT Novice


Joined: 11 Jul 2011
Posts: 11

PostPosted: Fri Oct 05, 2012 12:15    Post subject: Issues and my version of the same Reply with quote
Script works perfectly, on my ASUS N13U B1 running DD WRT Firmware: DD-WRT v24-sp2 (07/20/12) std. I get full IPv6 marks on the tests.

The only issue i have faced so far with the script is that if i do a hard reboot, the script does not work and i need to re enter the script and reboot again.

Apart from that, made one small change to the script ie instead of open dns, went for google dns & removed the logging.

Code:
#v1.4 Feb 29, 2012
#***************************
#Settings start here
#***************************

#basic connection settings
SERVER_IP4_ADDR="ENTER_VALUE_HERE"
CLIENT_IPV6_ADDR="ENTER_VALUE_HERE"
ROUTED_64_ADDR="ENTER_VALUE_HERE"

#account info to auto update endpoint
USERID="ENTER_VALUE_HERE"
PASSWD="ENTER_VALUE_HERE"
TUNNELID="ENTER_VALUE_HERE"

#####Optional/Advanced Settings######

#IPv6 Google DNS IPv6 Resolver
ENABLE_GDNS_IPV6_DNS=1

#HE's endpoint verificiation server ip to add to whitelist
HE_VERIFY_SERVER_IP="66.220.2.74"

#WAN IP Source settings
#Set below to 1 to use  internal NVRAM wan address instead of fetching it from a site
USE_NVRAM_WAN_ADDR_INSTEAD=1
WAN_IP_SOURCE_ADDR="http://automation.whatismyip.com/n09230945.asp"

#Enable this to generate a .wanup script to automatically update local tunnel endpoint address on wan change
ENABLE_WANUP_SCRIPT=1
WANUP_SCRIPT_FILE_PATH="/tmp/etc/config/tunnelUpdate.wanup"

#Generated files paths
CRON_JOB_FILE="/tmp/report.sh"
RADVD_CONFIG="/tmp/radvd.conf"

#***************************
#Settings end here
#***************************

echo "" >> $STARTUP_SCRIPT_LOG_FILE
echo "HE IPv6 Script started" >> $STARTUP_SCRIPT_LOG_FILE

insmod ipv6
sleep 10

#get a hash of the plaintext password
MD5PASSWD=`echo -n $PASSWD | md5sum | sed -e 's/  -//g'`
echo `date` >> $STARTUP_SCRIPT_LOG_FILE

#cut out the "/64" if user typed it in
ROUTED_64_ADDR=`echo $ROUTED_64_ADDR|cut -f1 -d/`
SERVER_IP4_ADDR=`echo $SERVER_IP4_ADDR|cut -f1 -d/`
CLIENT_IPV6_ADDR=`echo $CLIENT_IPV6_ADDR|cut -f1 -d/`
echo "User added addresses cleaned/checked" >> $STARTUP_SCRIPT_LOG_FILE

#get wan ip for our own use
if [ $USE_NVRAM_WAN_ADDR_INSTEAD -eq 1 ]
then
  echo "Fetching WAN IP from NVRAM" >> $STARTUP_SCRIPT_LOG_FILE
  WANIP=$(nvram get wan_ipaddr);
else
  echo "Fetching WAN IP from External Site: " $WAN_IP_SOURCE_ADDR >> $STARTUP_SCRIPT_LOG_FILE
  WANIP=`wget $WAN_IP_SOURCE_ADDR -O - 2>/dev/null`
fi

echo "External IP detected as:" $WANIP >> $STARTUP_SCRIPT_LOG_FILE
if [ -n $WANIP ]
then
echo "configuring tunnel" >> $STARTUP_SCRIPT_LOG_FILE


#update HE endpoint
#need to alllow wan ping or HE will not validate new endpoint
iptables -I INPUT 2 -s $HE_VERIFY_SERVER_IP -p icmp -j ACCEPT
echo -e wget -q "http://ipv4.tunnelbroker.net/ipv4_end.php?ip=$WANIP&pass=$MD5PASSWD&apikey=$USERID&tid=$TUNNELID" -O $CRON_STATUS_LOG_FILE  >>$CRON_JOB_FILE
chmod +x $CRON_JOB_FILE
echo "Cron script created, sending endpoint update request to HE" >> $STARTUP_SCRIPT_LOG_FILE
etime=`date +%s`
wget -q "http://ipv4.tunnelbroker.net/ipv4_end.php?ip=$WANIP&pass=$MD5PASSWD&apikey=$USERID&tid=$TUNNELID" -O /tmp/wget.tmp.$etime
cat /tmp/wget.tmp.$etime >> $STARTUP_SCRIPT_LOG_FILE
echo "" >> $STARTUP_SCRIPT_LOG_FILE
rm /tmp/wget.tmp.$etime


# The following commands are straight from HE's website
ip tunnel add he-ipv6 mode sit remote $SERVER_IP4_ADDR local $WANIP ttl 255
ip link set he-ipv6 up
ip addr add $CLIENT_IPV6_ADDR/64 dev he-ipv6
ip route add ::/0 dev he-ipv6
ip -f inet6 addr
TEMP_ADDR=`echo $ROUTED_64_ADDR'1'`

# These commands aren't on HE's website, but they're necessary for the tunnel to work
ip -6 addr add $TEMP_ADDR/64 dev br0
ip route add 2000::/3 dev he-ipv6

#Enable IPv6 forwarding
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding

# make sure to accept proto-41
iptables -I INPUT 2 -p ipv6 -i vlan1 -j ACCEPT

#make sure to not NAT proto-41
iptables -t nat -A POSTROUTING --proto ! 41 -o eth0 -j MASQUERADE
echo "creating radvd conf" >> $STARTUP_SCRIPT_LOG_FILE

if [ $ENABLE_GDNS_IPV6_DNS -eq 1 ]
then
  echo "Google DNS ipv6 enabled" >> $STARTUP_SCRIPT_LOG_FILE
  echo "nameserver 2001:4860:4860::8888" >> /tmp/resolv.dnsmasq
  echo "nameserver 2001:4860:4860::8844" >> /tmp/resolv.dnsmasq
fi

#generate wanup script
if [ $ENABLE_WANUP_SCRIPT -eq 1 ]
then
   echo "WANUP script being generated" >> $STARTUP_SCRIPT_LOG_FILE
   dirname $WANUP_SCRIPT_FILE_PATH  | xargs mkdir
   echo 'echo "WANUP script triggered on `date`" >>' $STARTUP_SCRIPT_LOG_FILE > $WANUP_SCRIPT_FILE_PATH
   if [ $USE_NVRAM_WAN_ADDR_INSTEAD -eq 1 ]
   then
      echo -e 'WANIP=$(nvram get wan_ipaddr);' >> $WANUP_SCRIPT_FILE_PATH
   else
      echo -e 'WANIP=`wget $WAN_IP_SOURCE_ADDR -O - 2>/dev/null`' >> $WANUP_SCRIPT_FILE_PATH
   fi
   echo -e wget -q 'http://ipv4.tunnelbroker.net/ipv4_end.php?ip=$WANIP'"&pass=$MD5PASSWD&apikey=$USERID&tid=$TUNNELID"  >> $WANUP_SCRIPT_FILE_PATH
   echo 'ip tunnel change he-ipv6 local $WANIP'>>  $WANUP_SCRIPT_FILE_PATH
   chmod +x $WANUP_SCRIPT_FILE_PATH
fi   

#creating radvd.conf
echo "#generated by startup script" > $RADVD_CONFIG
echo "interface br0 {" >> $RADVD_CONFIG
echo "AdvSendAdvert on;" >> $RADVD_CONFIG
echo "prefix "$ROUTED_64_ADDR"/64 {" >> $RADVD_CONFIG
echo "AdvOnLink on;" >> $RADVD_CONFIG
echo "AdvAutonomous on;" >> $RADVD_CONFIG
echo "AdvRouterAddr on;" >> $RADVD_CONFIG
echo "};" >> $RADVD_CONFIG
echo "};" >> $RADVD_CONFIG

echo "starting radvd" >> $STARTUP_SCRIPT_LOG_FILE
radvd -C $RADVD_CONFIG &
fi
vk78
DD-WRT Novice


Joined: 11 Jul 2011
Posts: 11

PostPosted: Thu Oct 11, 2012 3:06    Post subject: Gateway Issues Reply with quote
Using the above script and the older one has had me having payment gateway issues. After the details are sent, it gives me errors and so have stopped using it since here in india we follow a slightly differant payment system.
realdreams
DD-WRT Novice


Joined: 23 Feb 2010
Posts: 45

PostPosted: Mon Oct 15, 2012 0:34    Post subject: Reply with quote
As as Oct 14, 2012 tunnelbroker no longer supports http update.

install wget-ssl using ipkg, then replace all wget -q in the script with
/opt/bin/wget -q --no-check-certificate
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next Display posts from previous:    Page 7 of 8
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum