在Router OS上更新dnspod动态域名

RouterOS Aug 20, 2015

DNSPOD Token申请地址

在System的scheduler里新建一个项目,on-event里填入脚本:

:global ddnsip
:global ddnslastip
:global tid "xxxx"
:global tsn "xxxxxxxxxxx"
:global rhost "xxx.xxxx.xxx"
:global host [:pick $rhost ([:find $rhost "."]+1) [:len $rhost]]  
:global zhost [:pick $rhost 0 [:find $rhost "."]]  
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }
:global ddnsip [ /ip address get [/ip address find interface=CT_20Mbps] address ]
:if ([ :typeof $ddnsip ] = nil ) do={
   :log info ("DynDNS: No ip address present on " . $ddnsinterface . ", please check.")
} else={
  :if ($ddnsip != $ddnslastip) do={
    :log info "DNSPOD: Sending UPDATE!"
    /tool fetch url=("http://www.cat-home.org/dnspod/index.php\?tid=$tid&tsn=$tsn&ym=$host&zym=$zhost") mode=http keep-result=no
    :global ddnslastip $ddnsip
  }
}