Hi,
I am using the Dyndns script and this works fine, but I have a problem. I have added this script to the schedule, but It doesn’t work.
I don’t know why it does not work. If you can give and answer.
Thanks in advance.
Hi,
I am using the Dyndns script and this works fine, but I have a problem. I have added this script to the schedule, but It doesn’t work.
I don’t know why it does not work. If you can give and answer.
Thanks in advance.
Yukado, please put exactly the script you are using.
I too would like a version that works with OpenDNS. Anyone tried this yet?
You should type into On Event: "/system script run “script_name”
How to make the script update 2 pppoe interface?
Same user. 2 host name, 2 pppoe.
I have the same situation like you.
You should make 2 scripts and add them to the scheduler.
In each script you have the pppoe1 connection and respectively the pppoe2 connection.
Hello,
I have the same problem… I would like to update the pppoe-out1 interface, but this is not the default gateway.
I have solved easily how to fetch the right IP with:
:global ddnsinterface "pppoe-out1"
if ([:typeof $ddnsinterface] = nil) do={
# Loop thru interfaces and look for ones containing
# default gateways without routing-marks
:foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes] do={
:if ([:typeof [/ip route get $int routing-mark]] != str) do={
:global ddnsinterface [/ip route get $int interface]
}
}
}
But the http request goes through the default gateway therefore the dyndns.org takes that IP and not the pppoe-out1 interface.
Is there any way to route mark this request?
Thank you in advance.
Regards,
Z
modified version of script on the forum working in 5.x
# Set needed variables
:local username "USERNAME"
:local password "PASSWORD"
:local hostname "HOSTNAME"
: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="/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 http://www.dyndns.com/developers/specs/syntax.html
: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="members.dyndns.org" src-path="nic/update?system=dyndns&hostname=$hostname&myip=$currentIP&wildcard=no" 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")
}
I have the script running successfully with one Internet facing interface.
I added a 2nd Internet link now the script picks the IP address second
one instead of the first one. I checked in the script there is no where
to specify the interface to check so how do i add it?
# Set needed variables
:local username "xxxxxx"
:local password "xxxxxx"
:local hostname "xxxx.xxx.com"
:global systemname [/system identity get name]
:if ($systemname = "Site1" ) do= {
:set hostname "yourdomain1.dyndns.org"
}
:if ($systemname = "Site2" ) do= {
:set hostname "yourdomain2.dyndns.org"
}
:if ($systemname = "Site3" ) do= {
:set hostname "yourdomain3.dyndns.org"
}
: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="/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 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")
}
Look on this forum or wiki, there are different versions of this script that get their IP adress by different means (static interface name specification, etc).
Is it possible to avoid disk writes if no update is required?
So avoiding this part:
/tool fetch mode=http address=“checkip.dyndns.org” src-path=“/” dst-path=“/dyndns.checkip.html”
:local result [/file get dyndns.checkip.html contents]
thanks a lot,
Jeroen
Sure, if the public IP is configured right on the router you can just check the interface IP directly. The fetch only happens in case you’re behind NAT and need to update a public IP you can’t access locally directly.
I found this snippet to get the IP however, it makes the script halt although the console does not indicate an error.
:foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes ] do={
:if ([:typeof [/ip route get $int routing-mark ]] != str ) do={
:global ddnsinterface [/ip route get $int interface]
}
}
A log statement (see below) before this snippet works, a log statement just after does not.
:log info "UpdateDynDNS TEST TEST TEST: currentIP = TEST A"
I’m going to try and mend it, but why does it halt the script when there are no errors? I’m not a profiecient programmer I’m afraid:)
I’m happy to report I’ve got a working script now (source code below). However, When forcing an update DynDns reports “nochg 84.194.xxx.xxx”
And thus it does not update the “Last Updated” timer, which may cause the account to expire. Anyone found a way around this?
# Set needed variables
:local username "YOUR_USERNAME"
:local password "YOUR_PASSWORD"
:local hostname "YOUR_HOSTNAME"
:global systemname [/system identity get name]
:if ($systemname = "Site1" ) do= {
:set hostname "yourdomain1.dyndns.org"
}
:if ($systemname = "Site2" ) do= {
:set hostname "yourdomain2.dyndns.org"
}
:if ($systemname = "Site3" ) do= {
:set hostname "yourdomain3.dyndns.org"
}
: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")
# CAUTION: YOU NEED TO SELECT THE INTERFACE WHICH HAS YOUR PUBLIC IP. Here this is interface number=1
:local network [/ip address get number=1 address]
#:log info (" network is $network")
:local length [:len $network]
#:log info ("length is $length")
:local currentIP [:pick $network 0 ($length-3)]
:log info ("UpdateDynDNS: fetched IP address is $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 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 Result: ".$result)
:put ("Dyndns Update Result: ".$result)
} else={
:log info ("UpdateDynDNS: No dyndns update needed")
}
I currently have two RB450G devices. One will be used as a SSTP server and the other as a SSTP client.
I have used a script from a mikrotik wiki page using DDNS service from DYNDNS.org:
# Set needed variables
:local username "username"
:local password "password"
:local hostname "blahblahblah.dyndns.org"
: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="/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 http://www.dyndns.com/developers/specs/syntax.html
: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="members.dyndns.org" \
src-path="nic/update?system=dyndns&hostname=$hostname&myip=$currentIP&wildcard=no" \
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")
The script works great for my Dynamic IP SSTP server. However my Static SSTP client resolves the server Host name to IP address when applied and it does not update when the Dynamic IP of my SSTP server changes. I need to know how I can update the IP address of my Dynamic IP SSTP server into the address field for my SSTP client settings.
Is there a Guru out there that can help me. I can’t imagine I’m the first person looking for an answer to this question.
Thank you
I have a interesting situation.
have one router/Mikrotik with multiple Dynamic connections.
1 DSL and one 1 Wireless.
one is set as primary and one is set as secondary.
Uses the dyndns script to update the dns for the router.
I would like to test to confirm that both interfaces are actually connected.
I would like to see about getting the dynamic dns script to test via a forced interface opposed to the default routed interfaces.
currently the line in the script shows as
/tool fetch mode=http address=“checkip.dyndns.org” src-path=“/” dst-path=“/dyndns.checkip.html”
is their a way to tell the fetch command to use a particular interface?
such as
/tool fetch interface= eth1 mode=http address=“checkip.dyndns.org” src-path=“/” dst-path=“/dyndns.checkip.html”
any Ideas?
@Cris@usai.net:
Ugly workaround: add a temporary specific route to dyndns.org?
I would propose a clean workaround in one of 2 ways:
An, yes, Normis, I know - not planned, no time for this, no real neccesity, but still - please, pretty please.
I am working on a udp ddns update client for routeros that hopefully will make everyones lives easier. Will just be tied to the MAC / serial of the units and calls home with a lightweight udp packet. You then come to our site (ChangeIP.com) to tell us which units are yours and then you can tie them all together in your account.
Sam
routed MNDP (CDP)?.. O_o