Community discussions

MikroTik App
 
tritsako
newbie
Topic Author
Posts: 35
Joined: Wed Aug 27, 2008 11:01 am

DDNS update on mikrotik V4.9

Thu Sep 09, 2010 8:11 pm

Hi to all,

search on the net for a DDNS script for Mikrotik v4.9, but I have'nt find something.
Does anybody know where / and how, can I find the script to update the DDNS (free dns provider dyndns)?

Thank you in advance.
Costas
 
kazanova
Member
Member
Posts: 406
Joined: Tue Sep 06, 2005 11:52 am

Re: DDNS update on mikrotik V4.9

Fri Sep 10, 2010 12:31 am

 
tritsako
newbie
Topic Author
Posts: 35
Joined: Wed Aug 27, 2008 11:01 am

Re: DDNS update on mikrotik V4.9

Sun Sep 12, 2010 12:53 pm

Thank you for your reply, I have already tried this script and it did not wotk and I don not know why...
 
kazanova
Member
Member
Posts: 406
Joined: Tue Sep 06, 2005 11:52 am

Re: DDNS update on mikrotik V4.9

Mon Sep 13, 2010 12:46 am

had you take a look to your log
i notice that script has log for each error
 
tritsako
newbie
Topic Author
Posts: 35
Joined: Wed Aug 27, 2008 11:01 am

Re: DDNS update on mikrotik V4.9

Tue Sep 14, 2010 11:06 pm

Yes, I know, I have found that the /tool fecth mode etc... the MT is looking for /tool flood ping !!! and not fecth.
Do you have any idea can I pass this?
I might have some more similar problems with the script.

Strange!!!

Thank you kazanova for your replies.
Kostas.
 
ditonet
Forum Veteran
Forum Veteran
Posts: 835
Joined: Mon Oct 19, 2009 12:52 am
Location: Europe/Poland/Konstancin-Jeziorna
Contact:

Re: DDNS update on mikrotik V4.9

Tue Sep 14, 2010 11:34 pm

Hi,

This works for me perfectly:
# Set needed variables
:local username "yourusername"
:local password "yourpassword"
:local hostname "yourdomain.dyndns.info"

:global previousIP

# print some debug info
# :log info ("dyndns-update: username = $username")
# :log info ("dyndns-update: password = $password")
:log info ("dyndns-update: hostname = $hostname")
:log info ("dyndns-update: previousIP = $previousIP")

# get the current IP address from the internet (in case of double-nat)
/blink duration=10s
/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 "dyndns-update: currentIP = $currentIP"

# Determine if dyndns update is needed
# more dyndns updater request details available at http://www.dyndns.com/developers/specs/syntax.html
:if ($currentIP != $previousIP) do={
    :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 ("dyndns-update: Dyndns update needed")
    :log info ("dyndns-update: Dyndns Update Result: ".$result)
    /blink duration=10s
} else={
    :log info ("dyndns-update: No dyndns update needed")
}

Regards, Grzegorz.
 
tritsako
newbie
Topic Author
Posts: 35
Joined: Wed Aug 27, 2008 11:01 am

Re: DDNS update on mikrotik V4.9

Wed Sep 15, 2010 6:26 am

Yes ditonet, it work for me too!!!!!

Thank you very much!!! I will try to find the diferrences with the scripts in mikrotik wiki that cause the script to do not runn correctly, and inform you.

Thank you all!
Costas

Who is online

Users browsing this forum: No registered users and 114 guests