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

Leo   
   Á¶È¸ 7506   Ãßõ 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 74/102
2017-09   15097   °í·Î´Ù
2017-09   10957   Ƽ¸ð´Â±Í¿©¿ö
2017-09   12194   »ì¹Ù
2017-09   10236   ±èÀºÈ£
2017-09   10410   gen81
2017-09   11805   ÆÄÅ°¶ó
2017-08   14995   »ý¸ÆÁÖ
2017-08   10365   ¹öÇÁ¿£Áö´Ï¡¦
2017-08   10025   ³¶¸¸°í³ÉÀÌ
2017-08   11178   »ý¸ÆÁÖ
2017-08   12641   »ø¸®
2017-08   11830   lovin09
2017-08   15711   À¯µ¿ÈÆ
2017-08   13448   Ƽ¸ð´Â±Í¿©¿ö
2017-08   17655   ÇÏÀÌÇÏÀÌ
2017-07   31482   Ȧ¸¯0o0
2017-07   12717   Ȧ¸¯0o0
2017-07   18965   Àß»ì¾Æº¸¼¼
2017-07   12292   ºü½Ã¿Â
2017-07   12370   NGC