# DynDNS automatic DNS updates # User account info of DynDNS :global maticuser "user name" :global maticpass "password" :global matichost "host name" # No more changes need :global previousIP # Print values for debug :log info "DynDNS: Updating dynamic IP on DNS for host $matichost" #:log info "DynDNS: User $maticuser y Pass $maticpass" :log info "DynDNS: Last IP $previousIP" # get the current IP address from the internet (in case of double-nat) /tool fetch mode=http address="checkip.dyndns.org" src-path="/" dst-path="/dyndns.checkip.html" :local result [/file get dyndns.checkip.html contents] # parse the current IP result :local resultLen [:len $result] :local startLoc [:find $result ": " -1] :set startLoc ($startLoc + 2) :local endLoc [:find $result "" -1] :global currentIP [:pick $result $startLoc $endLoc] :log info "DynDNS: IP actual $currentIP" # Touching the string passed to fetch command on "src-path" option :local str "/nic/update?hostname=$matichost&myip=$currentIP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG" :if ($currentIP != $previousIP) do={ :log info "DynDNS: Update need" :set previousIP $currentIP :log info "DynDNS: Sending update $currentIP" :log info [ :put [/tool fetch host=MT user=$maticuser password=$maticpass mode=http address="updates.DynDNS.com" src-path=$str dst-path=$matichost]] :log info "DynDNS: Host $matichost updated on DynDNS with IP $currentIP" } else={ :log info "DynDNS: Previous IP $previousIP and current $currentIP equal, no update need" } } ******************************************************************************* add name=DynDNS interval=00:15 on