Script for he.net IPv6 Tunnelbroker

Hi everyone, i’ve updated the IPv6 Dynamic Wan Script out of the Mikrotik Wiki, cause it was not working, i think they changed the api @ Hurricane Elektrik

I was Inspired by:
https://www.tunnelbroker.net/forums/index.php?topic=1994.0
and:
http://wiki.mikrotik.com/wiki/Hurricane_Electric_IPv6_Tunnel_-_IPv4_Endpoint_updater


# Update Hurricane Electric IPv6 Tunnel Client IPv4 address

:local HEtunnelinterface "6to4-TunnelInterfaceName"
:local HEtunnelid "YourTunnelID"
:local HEuserid "YourUserID"
:local WANinterface "WAN-INTERFACE-NAME"
#Don't Use MD5! Paste your Password Plain Text
:local HEpass "yourPassword"
#No Need for Change below this line
:local HEupdatehost "ipv4.tunnelbroker.net"
:local HEupdatepath "/nic/update"

:local outputfile ("HE-" . $HEtunnelid . ".txt")

# Internal processing below...
# ----------------------------------
:local HEipv4addr

# Get WAN interface IP address
:set HEipv4addr [/ip address get [/ip address find interface=$WANinterface] address]
:set HEipv4addr [:pick [:tostr $HEipv4addr] 0 [:find [:tostr $HEipv4addr] "/"]]

:if ([:len $HEipv4addr] = 0) do={
   :log error ("Could not get IP for interface " . $WANinterface)
   :error ("Could not get IP for interface " . $WANinterface)
}

# Update the HEtunnelinterface with WAN IP
/interface 6to4 {
   :if ([get ($HEtunnelinterface) local-address] != $HEipv4addr) do={
      :log info ("Updating " . $HEtunnelinterface . " local-address with new IP " . $HEipv4addr . "...")
      set ($HEtunnelinterface) local-address=$HEipv4addr
   }
}

:log info ("Updating IPv6 Tunnel " . $HEtunnelid . " Client IPv4 address to new IP " . $HEipv4addr . "...")
/tool fetch mode=http \
                  host=($HEupdatehost) \
                  url=("http://" . $HEupdatehost . $HEupdatepath . \
                          "?username=" . $HEuserid . \
                          "&password=" . $HEpass . \
                          "&hostname=" . $HEtunnelid . \
                          "&myip=" . $HEipv4addr) \
                  dst-path=($outputfile)

:log info ([/file get ($outputfile) contents])
/file remove ($outputfile)

I Know, i only updated the script, and it’s not Perfect (no https!!!), but it worked for me :slight_smile:

(Script was testen on RB750 @ROS 5.20 with IPv6 )

can you tell what did not work? Maybe I can update article you are mentioning with your updated version?

i think the changed des syntax on https://ipv4.tunnelbroker.net/nic/update?username=&password=&hostname=<TUNNEL_ID>

Do you need to set a scheduler on this? If so, how often do you recommend?

Thanks,
Jason

i run this script every 15 Minutes!

i depens how ofen your ip changes!

The following lines has been changed from the script in MikroTik Wiki. The password must be specified in plain text instead of an md5 checksum.


:local HEupdatepath "/nic/update"



                          "?username=" . $HEuserid . \
                          "&password=" . $HEpass . \
                          "&hostname=" . $HEtunnelid . \
                          "&myip=" . $HEipv4addr) \

Original script from MikroTik Wiki.

http://wiki.mikrotik.com/wiki/Hurricane_Electric_IPv6_Tunnel_-_IPv4_Endpoint_updater

Janis,

Sorry to jump in on this old post, but it is definitely the only script that worked for my on v6.32 (v6.x), I tried both of them at the wiki with no luck.

I wanted to register at the wiki and copntribute but it’s not possible to open an account, but if you could update the wiki article with this script it’d be great.

the issue is

:local HEupdatehost "ipv4.tunnelbroker.net"
:local HEupdatepath "/nic/update"

Also you have to use the TunnelID and your account password.

Thanks

You don’t need to update the HE.NET side of the tunnel (on their web site) any more.

Only needed to update the local IP on the tunnel interface on your RB, and the tunnel will come up. HE somehow automatically detects the IP changed and updates their end without intervention.

unfortunately this is partially wrong. Tunnel will come up, BUT traffic from HE.net server will be routed to old IPv4 address.
without IPv4 update to HENET server, I am unable to receive ping response or anything else. maybe they had to rechange this to prevent abuse or security breach
they should require this, as you do not use username/password or VLAN to connect the servers.
Relays of Local ISPs (like Comcast) with local anycast address may not require configuration.
for your info