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

Leo   
   Á¶È¸ 7457   Ãßõ 1    

안녕하세요.

그동안 계속 벼르다가 이제야 조금 짬이 생겨서 올려봅니다.
dynamic  DNS 서비스를 어디를 할까 고민을 해봤는데, 그래도 큰 업체가 낫지 싶어서 dyndns.com 을 사용하고 있습니다.
큰 업체다 보니 자료 찾기가 수월하기도 하구요.
mikrotik 에서 dyndns 에 자동으로 업데이트 하는 스크립트를 찾아보면 아래 사이트 링크가 뜹니다.
그런데 문제는 이 내용이 매우 오래된 내용이라 실제로 적용해보면 잘 안됩니다.
제가 사용하는 버전은 mikrotik routerOS v6.10 이고 하드웨어는 RB450G 입니다.

그래서 아래 쓰레드를 열심히 뒤졌습니다. 저같은 분들이 많더군요.

그리고 몇번의 시행착오 결과.. 아래와 같은 스크립트를 작동시키는데 성공했습니다.
:local username "<dyndns user id>";
:local password "<dyndns password>";
:local hostname "<dyndns registered address>";
: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 true;

# Print debug info
#:log info ("DynDNS: username = $username");
#:log info ("DynDNS: password = $password");
#:log info ("DynDNS: hostname = $hostname");

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

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

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

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

# Determine if dyndns update is needed
 :if (($currentIP != $resolvedIP) || ($dyndnsForce = true)) do={
  :set dyndnsForce false;
 /tool fetch  user=$username password=$password url="http://eurodyndns.org/update/?hostname=$hostname&myip=$currentIP" dst-path="/eurodns.txt";
  :delay 1;
  :local result [/file get dyndns.txt contents]
  :log info ("DynDNS: Update needed")
  :log info ("DynDNS: Update Result: ".$result)
} else={
  :log info ("DynDNS: No update needed");
}
} else={
    :log info ("DynDNS: $inetinterface is not currently running");
}

위 스크립트를 /system script 에 DynDNS 라는 이름으로 저장해 두고,  10분마다 한번씩 자동 실행하도록 아래 명령을 넣습니다.
/system scheduler add name=DynDNS interval=00:10 on-event="/system script run DynDns\r\n"
/log print 해보면 해당 명령이 잘 실행되는 걸 볼 수 있습니다.
참고하세요. :)



´ë´ÜÇϽʴϴÙ..
¹éÁø¼® 2014-03
¼öÁ¤»çÇ×ÀÌ Àֳ׿ä. »ó±â
/tool fetch  user=$username password=$password url="http://eurodyndns.org/update/?hostname=$hostname&myip=$currentIP" dst-path="/eurodns.txt";
ºÎºÐÀ» ¾Æ·¡¿Í °°ÀÌ ¼öÁ¤ÇØÁÖ½Ã´Â°Ô ÁÁÀ» µí ÇÕ´Ï´Ù.
/tool fetch user=$username password=$password url="http://members.dyndns.org/nic/update\?hostname=$hostname&myip=$currentIP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG" dst-path="/dyndns.txt";

ÇÙ½ÉÀº ? ¾Õ¿¡ \ ¸¦ ºÙÀÌ´Â °Í°ú, dst-path="/dyndns.txt" ÀÔ´Ï´Ù.
ÀÌ·¸°Ô ÇØ¾ß log °¡ Á¦´ë·Î ÂïÈ÷´Â±º¿ä.


Á¦¸ñPage 69/102
2018-03   11987   ±èÀºÈ£
2018-03   11736   ³ª¹ð
2018-03   7732   ±èÀºÈ£
2018-03   16907   ĵÀ§µå
2018-03   13699   ¹Ú°Ç
2018-03   8528   ȸ¿øK
2018-03   8666   ȸ¿øK
2018-03   13279   ¹Ú°Ç
2018-03   9192   ¶õƼ¾Æ
2018-03   8630   ¶õƼ¾Æ
2018-03   9073   °üÁß
2018-03   11365   俬
2018-03   9018   ±è½Â¼ö1449
2018-03   9105   »õÃÑ
2018-03   5749   »õÃÑ
2018-03   7064   ¹öÇÁ¿£Áö´Ï¡¦
2018-03   7076   lovin09
2018-03   8844   ȸ¿øK
2018-03   8749   ¹öÇÁ¿£Áö´Ï¡¦
2018-02   8212   niagara