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

   Á¶È¸ 8815   Ãßõ 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 53/102
2019-11   3172   ÀÛÀº²¿¸¶
2019-11   6027   Andrew
2019-11   5016   tpp52
2019-11   7506   ³­È²¾¾
2019-11   7261   º£´ÏÅ×Áî
2019-11   4359   BlueApple
2019-11   7737   tpp52
2019-11   4163   ¹Ú¼öÇü
2019-11   6575   ¾Æ¸Â´Ù³»¿ì»ê
2019-11   34694   AZUREGOD
2019-11   4554   ¹Ú¼öÇü
2019-11   3667   ¶ËÆĸ®ÀÌ
2019-11   5677   À̴Ͻº
2019-11   11145   À̼±È£
2019-10   4910   µ¥µå¸¶¿ì½º
2019-10   7102   Å°¸®¿¡
2019-10   6094   ²¬±¸
2019-10   6441   ±×¸®Æù0
2019-10   7963   ¹Ú¼öÇü
2019-10   11249   ¹Ú¼öÇü