I also have the script for dyn IPv6 updates.
Script name=easyDNSv6, owner=admin, policy=ftp,read,write,policy,test
# Copyright by: Gregory Sloop under the GPL3, (see: http://www.gnu.org/licenses/gpl.html)
# Written by: Gregory Sloop <gregs@sloop.net> last modified, Mar 25 2012 , v1.0.5
# Modified by: Marco Maske <root@boldsuck.de> last modified, Jan 01 2022 , v1.1.1e
# EasyDNS dynamic-dns IPv6 update script
########################
# Set needed variables #
########################
# EasyDNS account username, dynamic token & hostname.
# NOTE: Dynamic tokens must be entered in place of your account password, as many updaters only use clear text.
# EasyDNS only allow the use of the token to avoid exposing your password.
:local username "your-username"
:local dyntoken "your-dyntoken"
:local hostname "your.domain.net"
# Which interface are we checking?
:local Interface "bridge-local"
# The file name where the last recorded IPv6 will be stored,
# as well as the file name of the easyDNS response.
:local vLastIPv6FileName "easydns-lastipv6.txt"
:local vEasyDNSv6ResponseFile "easydns-v6resp.txt"
############################
# END Set needed variables #
############################
:local currentIPv6
:local previousIPv6
:local vlocalurl
:local vIPv6Changed false
:local easyDNSv6result
:local result
# Check for file existance,
# if not create it...
# We need to do this before we try to read or write to files.
:local check [/file find name=$vLastIPv6FileName]
:if ( $check = "" ) do= {
/file print file=$vLastIPv6FileName
:delay 2
/file set [/file find name=$vLastIPv6FileName] contents=""
}
# Get the last saved IPv6 from the file.
:set previousIPv6 [/file get $vLastIPv6FileName contents]
# Print some debug info.
#:log info ("easyDNS: Username = $username")
#:log info ("easyDNS: Dynamictoken = $dyntoken")
#:log info ("easyDNS: Hostname = $hostname")
:log info ("easyDNS: Interface = $Interface")
:log info ("easyDNS: PreviousIPv6 = $previousIPv6")
# This code gets the current IPv6 from the interface.
# The interface we're checking should be set above.
#############################
# Test in console:
# :put [/ipv6 address get [find interface=bridge-local !link-local] address]
#############################
# Get the IPv6 from the interface, which includes a prefix.
:set currentIPv6 [/ipv6 address get [find interface=$Interface !link-local] address]
# Remove prefix from IPv6 address.
:set currentIPv6 [:pick [:tostr $currentIPv6 ] 0 [:find [:tostr $currentIPv6 ] "/"]]
:log info $currentIPv6
# Determine if easyDNS update is needed.
# More easyDNS updater request details:
# https://cp.easydns.com/support/dynamic/ and https://kb.easydns.com/knowledge/dynamic-dns/
#
# Update if the currentIPv6 isn't equal to previousIPv6.
:if (($currentIPv6 != $previousIPv6)) do={
:log info ("easyDNS: Hostname = $hostname")
:log info ("easyDNS: CurrentIPv6 = $currentIPv6 ==> PreviousIPv6 = $previousIPv6")
:set vlocalurl ("https://" . "$username" . ":" . "$dyntoken" . "@" . "api.cp.easydns.com" . "/dyn/tomato.php?hostname=" . "$hostname" . "&myip=" . "$currentIPv6")
#
# https://username:dyntoken@api.cp.easydns.com/dyn/tomato.php?hostname=example.com&myip=10.0.0.2 => txt response
# dynsite.php, ez-ipupdate.php, tomato.php => All have the same 3-line txt response.
# https://username:dyntoken@api.cp.easydns.com/dyn/generic.php?hostname=example.com&myip=10.0.0.2 => html response
#
/tool fetch mode=https url=$vlocalurl dst-path=$vEasyDNSv6ResponseFile
:set result [/file get $vEasyDNSv6ResponseFile contents]
:set vIPv6Changed true
} else={
:log info ("easyDNS: No update needed.")
}
# Get the result status code and pull it out for use.
# If IPv6Changed = true
# Get result code
# Check easyDNS result
# if NOERROR or OK then
# :set previousIPv6 $currentIPv6
# /file set [/file find name=$vLastIPv6FileName] contents="$currentIPv6"
# also post the result to the log file
# else NOACCESS, NOSERVICE, ILLEGAL INPUT, TOO_FREQ or TOOSOON
# post to log file
# Don't update previousIPv6 or vLastIPv6FileName file.
:if ($vIPv6Changed=true) do={
:set result [/file get $vEasyDNSv6ResponseFile contents]
:local endLoc [:find $result "\n" -1]
:set easyDNSv6result [:pick $result -1 ($endLoc)]
:put $easyDNSv6result
:if ( ($easyDNSv6result = "NOERROR") || ($easyDNSv6result = "OK") ) do={
:set previousIPv6 $currentIPv6
:log info ("easyDNS: Update IPv6 needed...")
:log info ("easyDNS: Update result: ".$result)
/file set [/file find name=$vLastIPv6FileName] contents="$currentIPv6"
} else={
:log info ("easyDNS: Update IPv6 needed...")
:log info ("easyDNS: Update FAILED")
:log info ("easyDNS: Update result: ".$result)
}
}
/system scheduler
add interval=29m name=easyDNSv6 on-event="system script run easyDNSv6" policy=ftp,read,write,policy,test start-time=startup