Problem with script in RouterOS3.17

Hello everybody,

I had a script working in 3.15… for some reason i was required to upgrade to 3.17 to get load balancing…

Now i have two active gateways (from what i gater this might be the problem) and the same script is not working.

Where should i make a change to get it back up?

from what i understand i have to give the script wich interface to look for the ip to change… but don have the slightest clue of where should i put that.

:log info “Begin myDDNS update”

Define User Variables

:global ddnsuser “myddnsuser”
:global ddnspass “myddnspass”
:global ddnshost “myddns.myddns.com

Define Global Variables

:global ddnsip
:global ddnslastip
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip “0” }

:global ddnsinterface <<<<<<< Does it go here??? What is the right way???
:global ddnssystem (“mt-” . [/system package get system version] )

Define Local Variables

:local int

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]
}
}

Grab the current IP address on that interface.

:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ]

Did we get an IP address to compare?

:if ([ :typeof $ddnsip ] = nil ) do={
:log info ("DDNS: No ip address present on " . $ddnsinterface . “, please check.”)
} else={

:if ($ddnsip != $ddnslastip) do={

:log info “DDNS: Sending UPDATE!”
:log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip “/”] ] key-name=$ddnsuser key=$ddnspass ] ]
:global ddnslastip $ddnsip

} else={
:log info “DDNS: No update required.”
}

}

:log info “myddns update script finished succesfully”

End of script



Thank you very much for any help you can provide…

Nemecio.

I guess since I provided this script I need to debug it : ) The thought on this version was to detect the default gateway and determine the interface name from the routing table. Let me load this up on a 3.19 router and test and get back to you.

I truly appreciate the help… the version for 2.9 was great (because i could tell it what interfase to update), and I honestly do not understand much about scripting (or routerOS that is,) and have had a system working like a charm with all the information i have managed to gather from this forum.

Thanks to people like you who do not mind sharing their knowledge. (wish there where more poeple like that in my country)