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.