«

»

Feb
13

Mikrotik – Mikrotik vs DynDNS

:global ddnsuser “login” :global ddnspass “password” :global ddnshost “testing.dyndns.org” :global ddnsip :global ddnslastip :if ([ :typeof $ ddnslastip ] = nil ) do={ :global ddnslastip “0″ } :global ddnsinterface :global ddnssystem (“mt-” . [/system package get system version] ) :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] }} :log info $ ddnsinterface :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 (“DynDNS: No ip address present on ” . $ ddnsinterface . “, please check.”) } else={ :if ($ ddnsip != $ ddnslastip) do={ :log info “DynDNS: Sending UPDATE!” /tool fetch address=members.dyndns.org src-path=”/nic/update?system=dyndns&hostname=$ ddnshost&myip=$ ddnsip&wildcard=no” user=$ ddnsuser password=$ ddnspass dst-path=(“/DynDNS.”.$ ddnshost) :delay 1 :local str [/file find name="DynDNS.$ ddnshost"]; /file remove $ str :global ddnslastip $ ddnsip }}

3 comments

No ping yet

  1. gites77 says:

    DynDNS has removed free offer. Would be great to see your method working against no-ip.com

  2. Sheriffooo says:

    It’s not my fault.

  3. sv2241 says:

    Script crashes in v5.12 !!!

Leave a Reply to gites77 Cancel reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>