mikrotik ¿¡¼­ dyndns ÀÚµ¿ IP ¾÷µ¥ÀÌÆ® ver 2

Leo   
   Á¶È¸ 7361   Ãßõ 0    

아래 dyndns 1088;ᇼ1; 업데1060;트 스크립트를 살1677; 0148;ǂ12;서
dyndns 에 2개1032; hostname 1012; መ1;/197;했1012;ǐ12; 2개 모.160; 업데1060;트 Ȣ16;도/197; Ȣ16;lj16; 스크립트를 만들Ǻ12; 봤습니다.

:local username "<dyndns id>";
:local password "<dyndns password>";
:local hostname { "first"="<dyndns hostname1>"; "second"="<dyndns hostname2>" }
:local inetinterface "ether1-gateway";
:local sysdate [/system clock get date];
:local systime [/system clock get time];
:local sysname [/system identity get name];

:local dyndnsForce;
:set dyndnsForce false;

# Print debug info
#:log info ("DynDNS: username = $username");
#:log info ("DynDNS: password = $password");
#:log info ("DynDNS: hostname1 = $hostname->first");
#:log info ("DynDNS: hostname2 = $hostname->second");

# Check if WAN interface is running
:if ([/interface get $inetinterface value-name=running]) do={

# Get the current IP on the WAN interface
&#160; &#160; :local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address];

# Strip the net mask off the IP address
&#160; &#160; :set currentIP [:pick $currentIP 0 [:find $currentIP "/"]];
&#160; &#160; :log info ("DynDNS: current WAN IP = $currentIP");

# do loop for all hostname
&#160; &#160; :foreach key,value in=$hostname do={

# Get resolved IP for hostname
&#160; &#160; &#160; &#160; :local resolvedIP [:resolve domain-name=$value server=8.8.8.8];
&#160; &#160; &#160; &#160; :log info ("DynDNS: resolved IP for $value = $resolvedIP");

# Determine if dyndns update is needed
&#160; &#160; &#160; &#160; :if (($currentIP != $resolvedIP) || ($dyndnsForce = true)) do={
&#160; &#160; &#160; &#160; &#160; &#160; :set dyndnsForce false;
&#160; &#160; &#160; &#160; &#160; &#160; /tool fetch user=$username password=$password url="http://members.dyndns.org/nic/update\?hostname=$value&myip=$currentIP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG" dst-path="/dyndns.txt";
&#160; &#160; &#160; &#160; &#160; &#160; :delay 1;
&#160; &#160; &#160; &#160; &#160; &#160; :local result [/file get dyndns.txt contents]
&#160; &#160; &#160; &#160; &#160; &#160; :log info ("DynDNS: update needed for $value")
&#160; &#160; &#160; &#160; &#160; &#160; :log info ("DynDNS: update result for $value = ".$result)
&#160; &#160; &#160; &#160; } else={
&#160; &#160; &#160; &#160; &#160; &#160; :log info ("DynDNS: no update needed for $value");
&#160; &#160; &#160; &#160; }

# end of loop for all hostname
&#160; &#160; }

# if WAN interface is not running
} else={
&#160; &#160; :log info ("DynDNS: $inetinterface is not currently running");
}

mikrotik 1004;/196; 스크립트 프/196;그ǖ16; 1676;lj16; ,163;도 1008;근 1116;0140;군요. :)


Á¦¸ñPage 95/96
2014-04   23989   s±èÁ¾È­z
2014-04   6703   ¼­¿ï»ç¶÷
2014-04   7033   ȸ¿øK
2014-04   10920   ȸ¿øK
2014-04   9363   ÀÌÅ¿í
2014-04   10513   MikroTikÀÌÁø
2014-03   7362   Leo
2014-03   8235   Leo
2014-03   7618   ȸ¿øK
2014-03   13421   ±è¿ë³²
2014-03   8018   ±è´ë¿ø
2014-03   7671   ¼ÛÁøÇö
2014-03   7116   ȸ¿øK
2014-03   8027   ȸ¿øK
2014-03   6927   ±èÁø¿µJK
2014-03   10048   s±èÁ¾È­z
2014-03   10139   ¹Ú¹®Çü
2014-03   13797   ¹éµÎ¼º
2014-02   11529   ¼­¿ï»ç¶÷
2014-02   24695   ¿¹»ó¾Æºü