Community discussions

 
macrob86
just joined
Topic Author
Posts: 2
Joined: Mon Mar 25, 2013 11:46 am

Ddns on RB750 OS 5.11

Mon Mar 25, 2013 11:55 am

I´ve tried more than 10 scripts to DDNS but I did not get to do work. I tried scritp for Dyndns and change ip.
If anyone has a script that work well on RB 750, OS 5.11, please send me.
 
nmaton
Frequent Visitor
Frequent Visitor
Posts: 72
Joined: Fri Feb 18, 2011 12:31 am

Re: Ddns on RB750 OS 5.11

Mon Mar 25, 2013 11:19 pm

This script works :
Just don't forget to put a scheduler to run it after xx minutes, hours.

------- START COPYING AFTER THIS LINE -------
#DYNDNS SCRIPT ROUTEROS !!!
#INSERT THIS IN THE SYSTEM SCRIPTS
#

# Set needed variables
:local username "username"
:local password "password"
:local hostname "yourdyndnsname.dyndns.org"

:global dyndnsForce
:global previousIP

# print some debug info
:log info ("UpdateDynDNS: username = $username")
: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="/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 "</body>" -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 DynDNS!
:set dyndnsForce true

# Determine if dyndns update is needed
# more dyndns updater request details available at http://www.dyndns.com/developers/specs/syntax.html
:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
:set dyndnsForce false
:set previousIP $currentIP
/tool fetch user=$username password=$password mode=http address="members.dyndns.org" src-path="/nic/update?hostname=$hostname&myip=$currentIP" dst-path="/dyndns.txt"
:local result [/file get dyndns.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")
}

------- STOP COPYING BEFORE THIS LINE -------
Nicolas Maton
nicolasmaton@gmail.com

CCNA/ CCDA
MTCNA / MTCTCE

Available for Mikrotik Consulting
 
macrob86
just joined
Topic Author
Posts: 2
Joined: Mon Mar 25, 2013 11:46 am

Re: Ddns on RB750 OS 5.11

Tue Mar 26, 2013 9:21 pm

Very good. Thank you very much.
Works well.

If you have the changeip scrip too. Please send me.

Regards.

Who is online

Users browsing this forum: No registered users and 14 guests