DDNS Host Mikrotik Router

Allgemeine Fragen zu Problemen. Keine Fehlerberichte oder Feature-Anfragen

Moderator: Securepoint

Antworten
mwrouter
Beiträge: 1
Registriert: Mo 08.05.2017, 21:27

DDNS Host Mikrotik Router

Beitrag von mwrouter »

Hallo,
ich suche ein Skript für den Mikrotik Router. Mein derzeitiges weist dem Host keine IP zu:

Code: Alles auswählen

# Set needed variables
:local username "user"
:local password "passwort"
:local hostname "hostname.spdns.de"
:global dyndnsForce
:global previousIP
# print some debug info
:log info ("UpdateDynDNS: username = $username“)
:log info ("UpdateDynDNS: password = $password“)
:log info ("UpdateDynDNS: hostname = $hostname“)
:log info ("UpdateDynDNS: previousIP = $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=“/spdns.checkip.html“
#:delay 1
:local result [/file get spdns.checkip.html contents]
# parse the current IP result
:local resultLen [:len $result]
:local startLoc [:find $result ": " -1]
#:local startLoc [:find $result „<IP>“ -1]
#:set startLoc ($startLoc + 4)
:set startLoc ($startLoc + 2)
:local endLoc [:find $result "</body>" -1]
#:local endLoc [:find $result „</IP>“ -1]
:local currentIP [:pick $result $startLoc $endLoc]
:log info "UpdateDynDNS: currentIP = $currentIP"
# Remove the # on next line to force an update every single time – useful for debugging,
# but you could end up getting blacklisted by SPDNS!
#:set dyndnsForce true
:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
    :set dyndnsForce false
    :set previousIP $currentIP
#    :log info „$currentIP or $previousIP“
    /tool fetch user=$username password=$password mode=http address=“spdns.de“ src-path=“nic/update?hostname=$hostname&myip=$currentIP“
    dst-path=“/spdns-log.txt“
    #http://spdns.de/nic/update?hostname=$domain&myip=$IP&user=$username&pass=$password“
    #:delay 1
    :local result [/file get spdns-log.txt contents]
    :log info („UpdateDynDNS: Dyndns update needed“)
    :log info („UpdateDynDNS: Dyndns Update Result: „.$result)
    :put ("Dyndns Update Result: ".$result)
} else={
    :log info („UpdateDynDNS: No dyndns update needed“)
}
Vielen Dank für Tipps

Antworten