Community discussions

MikroTik App
 
Sl33py
newbie
Topic Author
Posts: 25
Joined: Mon Jan 20, 2014 2:37 pm

DynDyns with 2 WAN

Thu Apr 28, 2016 10:28 pm

Hello
I subnet my network in 2 via ip range and each one goes out its own WAN port with a pppoe connection.
They do fail over if one link goes down but my dyndns script only updates on its own pppoe connection

I want it to update the fail over wan ip in case it does, I have tried ddclient on two different linux servers i have but i get a lot of time out errors, is there a way I can to it with the mikrotik or query the mikrotik for the external ip almost like checkip.dyndns.com?

Below is my current dyndns script, I have one for each pppoe conntection

global ddnsuser "XXX"
:global ddnspass "XXX"
:global theinterface "pppoe-har"
:global ddnshost XXX.dyndns.org
:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:if ([ :typeof $ipfresh ] = nil ) do={
:log info ("DynDNS: No ip address on $theinterface .")
} else={
:for i from=( [:len $ipfresh] - 1) to=0 do={
:if ( [:pick $ipfresh $i] = "/") do={
:set ipfresh [:pick $ipfresh 0 $i];
}
}

:if ($ipddns != $ipfresh) do={
:log info ("DynDNS: IP-DynDNS = $ipddns")
:log info ("DynDNS: IP-Fresh = $ipfresh")
:log info "DynDNS: Update IP needed, Sending UPDATE...!"
:global str "/nic/update\?hostname=$ddnshost&myip=$ipfresh&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"
/tool fetch address=members.dyndns.org src-path=$str mode=http user=$ddnsuser \
password=$ddnspass dst-path=("/DynDNS.".$ddnshost)
:delay 1
:global str [/file find name="DynDNS.$ddnshost"];
/file remove $str
:global ipddns $ipfresh
:log info "DynDNS: IP updated to $ipfresh!"
}
 
Sl33py
newbie
Topic Author
Posts: 25
Joined: Mon Jan 20, 2014 2:37 pm

Re: DynDyns with 2 WAN

Sat Jun 18, 2016 2:05 pm

Can any one assist with this script please. I wan to change it so that it checks that :global theinterface "pppoe-har" is reachable if not then check :global theinterface "pppoe-har2"

Who is online

Users browsing this forum: Google [Bot] and 99 guests