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
(Script was testen on RB750 @ROS 5.20 with IPv6 )