[Mikrotik] DNSZi DDNS ¾÷µ¥ÀÌÆ® ½ºÅ©¸³Æ®

   Á¶È¸ 9575   Ãßõ 2    

DDNS_Update_DNSZi_v1.1.txt (1.9K), Down : 18, 2016-10

기존에 올라와 있던 

미크로틱의 DNSZi.com으로의 DDNS 설정 자료가 재대로 작동이 안되서 

IP -> Cloud에 있는 mynetname.net의 DDNS 기능을
DNSZi에서 CNAME으로 연동 시켰는데...
nslookup으로 보니 DDNS 주소가 보여서 
수정 및 테스트 후 올려봅니다.


스크립트 권한은 최소 read, write, policy, test 권한이 필요합니다.

다중 도메인 설정 기능도 해보려고 했는데, 
스킬이 딸려서 해당 기능추가는 못했습니다만 한 스케줄러에 여러개의 스크립트를 돌리시면 될 듯 합니다;

실제 적용 확인은
처음 스크립트를 한번 돌리시면 Environment 탭에
Name값 previousIP의 Value 값을 보시면 현재 공인 IP값이 있습니다.
해당 값과 DNSZi.com에서 저장된 값도 수정해주신 다음,
다시 스크립트를 돌리시면 기존의 공인 IP값으로 양쪽 모두 복구되는 것을 확인할 수 있습니다.


p.s
테스트 장비는
CRS125-24G-1S-RM Routerboard v3.24 & Package v6.30.2 입니다.
RB450G도 굴러다니고는 있는데... 
아마 별 문제 없이 잘 작동할 겁니다^^;


changlog 
v1.0 - 최초 배포
v1.1 - 로그표시 내용 수정


########## DNSZi update script v1.1 By Nightowl.kr ##########


#-------------Change Values in this section to match your setup-------------

:local userID "myUserId";
:local authCode "myAuthCode";
:local domain "mydomain";
:local Arecord "mydomain's A-recode";
:local gatewayInterface "ether1-gateway";
:local roundlobin "";

#---------------------------------------------------------------------------


:global previousIP;

# When WAN interface online
:if ([/interface find where name=$gatewayInterface running=yes] != "") do={

### Get the current IP on the interface
     :local currentIPaddress [/ip address get [find interface="$gatewayInterface"] address];

###### Strip the netmask off the IP address
     :for i from=( [:len $currentIPaddress] - 1) to=0 do={
            :if ( [:pick $currentIPaddress  $i] = "/") do={
                 :set currentIPaddress [:pick $currentIPaddress 0 $i];
    
            }
     }
     :local currentIP $currentIPaddress;
 
### When DDNS IP not equal
     :if ($currentIP != $previousIP) do={
          :log info "DNSZi: [$Arecord.$domain] Current IP($currentIP) is not equal to previous IP($previousIP), update needed";
          :set previousIP $currentIP;

###### The update URL.
###### Note the "\3F" is hex for question mark (?). 
###### Required since ? is a special character in commands.
          :log info "DNSZi: [$Arecord.$domain] updated!"

### When DDNS IP equal
     } else={
          :log info "DNSZi: [$Arecord.$domain] Previous IP($previousIP) is equal to current IP, no update needed";
     }

# When WAN interface offline
} else={
     :log error "DNSZi: [$Arecord.$domain] Interface($gatewayInterface) is not currently running, so therefore will not update.";
}

±è¼±µ¿ 2015-08
°¨»çÇÕ´Ï´Ù. ÀÌÀü¿¡ ´Ù¸¥ºÐÀÌ ¿Ã·ÁÁּ˴ø ½ºÅ©¸³Æ®´Â dns ÁÖ¼Ò¿Í ip ¸¦ È®ÀÎÇÏ¿© ´Ù¸¥Á¡À» ¾Ë¾Æ¿À·Á°í ÇÒ¶§ ¹®Á¦°¡ ÀÖ¾ú°Åµç¿ä ¤¾¤¾

Àú´Â ±×³É 5ºÐ¸¶´Ù °­Á¦ ¾÷µ¥ÀÌÆ® ÇϰíÀÖ¾ú½À´Ï´Ù.  ¿Ã·ÁÁֽнºÅ©¸³Æ® Àß »ç¿ëÇϰڽÀ´Ï´Ù.
¹Ú¿Ï°æ 2015-10
°¨»çÇÕ´Ï´Ù. ±âÁ¸¿¡ ¾²´ø°Ô °©Àڱ⠾ȵǼ­ ÀÌ»óÇÏ´Ù°í »ý°¢Çϰí ÀÖ¾ú´Âµ¥... Àß »ç¿ëÇϰڽÀ´Ï´Ù.


Á¦¸ñPage 98/107
2017-07   15298   ÇϾá°í´Ï
2018-01   15305   ¼­¿ï»ç¶÷
2022-11   15325   JHKWAK
2016-12   15354   °ø¹é±â
2022-10   15375   ¾öû³­x
2018-01   15410   TeslaLAB
2023-04   15413   ³É³É¸Ç
2015-09   15438   º°À̵Ǿî
2023-05   15468   hooneydev
2023-08   15500   ŰËÀÌ
2017-03   15529   ¿À¸ð
2017-12   15584   ´À³¦
2018-04   15610   Á¤ÀǼ®
2023-05   15683   ¼ÛÁøÈ«
2015-05   15701   Jjun
2022-12   15708   ¾ÆÀÚºÎ
2016-11   15722   ȸ¿øK
2022-12   15729   Kogi99
2021-12   15735   Mazinga
2016-06   15745   ÄÄÁö±â