Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save BrioNetworks/1ff772c64589c1334f6ac36b9606b151 to your computer and use it in GitHub Desktop.
Save BrioNetworks/1ff772c64589c1334f6ac36b9606b151 to your computer and use it in GitHub Desktop.

Revisions

  1. @adit-sa adit-sa revised this gist Jul 6, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Script Mikrotik Dynamic IP dengan www.dynu.com
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # www.adityasaputra.com

    :global ddnsuser "Usernam Dynu.com"
    :global ddnspass "Password Dynu.com"
    :global theinterface "Interface"
  2. @adit-sa adit-sa created this gist Jul 6, 2016.
    29 changes: 29 additions & 0 deletions Script Mikrotik Dynamic IP dengan www.dynu.com
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    :global ddnsuser "Usernam Dynu.com"
    :global ddnspass "Password Dynu.com"
    :global theinterface "Interface"
    :global ddnshost "domain.dynu.com"
    :global ipddns [:resolve $ddnshost];
    :global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
    :if ([ :typeof $ipfresh ] = nil ) do={
    :log info ("dynu: 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 ("dynu: IP-dynu = $ipddns")
    :log info ("dynu: IP-Fresh = $ipfresh")
    :log info "dynu: Update IP needed, Sending UPDATE...!"
    :global str "/nic/update?hostname=$ddnshost&myip=$ipfresh"
    /tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost)
    :delay 1
    :global str [/file find name="Dynu.$ddnshost"];
    /file remove $str
    :global ipddns $ipfresh
    :log info "dynu: IP updated to $ipfresh!"
    } else={
    :log info "dynu: dont need changes";
    }
    }