Community discussions

MikroTik App
 
boretto
newbie
Topic Author
Posts: 29
Joined: Sat Oct 24, 2009 12:25 pm

DynDNS script runs on x86, powerpc, mipsle but not on mipsbe

Tue Aug 24, 2010 12:58 am

Hi, could somebody help me on this?

I'm able to run successfully the below dyndns script (is a modified version from "freeloader" MKT forum user) on various platforms :
- x86
- PowerPC (RB800)
- Mipsle (RB131)
but I'm unable to run an exact copy of this on Mipsbe boards (RB450G, RB750G, etc....)

Does anybody know is there are diferences on scripting syntax between platforms???
I'm sure the problem is on the fetch command, cause script stop run at this point, but it is an exact copy of the script wich runs perfectly on the others platforms... I'm crazy with this... I tryed even diferents RouterOS versions on Mipsbe boards w/o success...


# Set needed variables
:local UN "yourusername"
:local PW "yourpassword"
:local hostname "youhostname.dnsalias.net"
:local ddnsinterface "PPPoE1"

:global previousIP
:local fullIP [/ip address get [/ip address find interface=$ddnsinterface] address];
:local endloc [:find $fullIP "/" -1];
:local currentIP [:pick $fullIP $fullIP $endloc];

# Determine if dyndns update is needed and execute
:if ($currentIP != $previousIP) do={
:set previousIP $currentIP
/tool fetch user=$UN password=$PW mode=http address="members.dyndns.org" src-path="/nic/update?hostname=$hostname&myip=$currentIP" dst-path="dyndns.txt"
:log info ("Dyndns Update: New IP=".[$currentIP])
} else={
:log info ("Dyndns Update: No update needed")
}
 
whoknew
Member Candidate
Member Candidate
Posts: 153
Joined: Wed Oct 13, 2010 8:51 pm

Re: DynDNS script runs on x86, powerpc, mipsle but not on mi

Wed Oct 13, 2010 8:56 pm

# Set needed variables
:local username "USERNAME FOR DYNDNS HERE"
:local password "PASSWORD FOR DYNDNS HERE"
:local hostname "dydns.org ADDRESS HERE"

:global dyndnsForce
: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)
/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) || ($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 ("dyndns-update: Dyndns update needed")
:log info ("dyndns-update: Dyndns Update Result: ".$result)
:put ("Dyndns Update Result: ".$result)
} else={
:log info ("dyndns-update: No dyndns update needed")
}
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: DynDNS script runs on x86, powerpc, mipsle but not on mi

Mon Oct 18, 2010 1:44 pm

make sure you are running same RouterOS version on all devices.

Who is online

Users browsing this forum: alexantao and 25 guests