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

   Á¶È¸ 8814   Ãßõ 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 46/102
2020-05   6102   ÀÛÀºÁöÇý
2020-05   4984   Mazinga
2020-05   5205   Elsaphaba
2020-05   5361   »õ¾ÓÁã
2020-05   4308   Á׸²Ä¥Çö
2020-05   3339   Elsaphaba
2020-05   7241   Elsaphaba
2020-05   3659   ½½±â·Î¿î»ýÈ°
2020-05   3333   Á¶½º¹Ù
2020-05   3944   ½¦µµ¿ì´Ð
2020-05   4692   ¹ÎÁöÆÄÆÄ
2020-05   4642   Elsaphaba
2020-05   6388   »õ·Î¿îÂ÷¿ø
2020-05   8039   ¹Îµ¹À̶û°¡ÀÚ
2020-05   3487   ºÒ¾Ë¿Õ
2020-05   6544   Elsaphaba
2020-04   3881   ¹Ú°Ç
2020-04   2686   RIGIDBODY
2020-04   3291   RIGIDBODY
2020-04   3718   negativete