Hurricane Electric DDNS Script

In case somebody uses the HE.net DNS service that recently added DDNS support here’s the script I use.
Just check your ROS supports fetch url parameter.

# Update Hurricane Electric DDNS IPv4 address


:local ddnshost "dyndnshost"
:local key "key"
:local updatehost "dyn.dns.he.net"
:local WANinterface "If"
:local outputfile ("HE_DDNS" . ".txt")

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

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

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

:log info ("Updating DDNS IPv4 address" . " Client IPv4 address to new IP " . $ipv4addr . "...")

/tool fetch url="http://$ddnshost:$key@$updatehost/nic/update?hostname=$ddnshost&myip=$ipv4addr" dst-path=$outputfile
										
:log info ([/file get ($outputfile) contents])
/file remove ($outputfile)

You can add this script in wiki so that everyone who needs it can find it easily.

I added the page on wiki: http://wiki.mikrotik.com/wiki/Dynamic_DNS_Update_Script_for_Hurricane_Electric_DNS
It’s also listed under scripting category.

Enjoy