Skip to main content
 首页 » 博文目录 » RouterOS

changeip动态域名解析

2019年01月17日2790百度已收录

 

:global ddnsuser “用户名”

:global ddnspass “密码”
:global ddnshost “申请的二级域名”
:global ddnsip
:global ddnsipfn
:global ddnslastip [:tostr [:resolve $ddnshost] ]
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip “0” }
:global ddnsinterface “adsl”
:global ddnssystem (“mt-” . [/system package get system version] )
:local int
:local ddnsipfn [ /ip address get [/ip address find interface=$ddnsinterface ] address ]
:global ddnsip [:pick $ddnsipfn 0 [:find $ddnsipfn “/” ] ]
:if ([ :typeof $ddnsip ] = nil ) do={
:log info (“DDNS: No ip address present on ” . $ddnsinterface . “, please check.”)
} else={
:if ($ddnsip != $ddnslastip) do={
:log info “DDNS: Sending UPDATE!”
:log info [ :put [/tool dns-update name=$ddnshost address=$ddnsip key-name=$ddnsuser key=$ddnspass ] ]
:global ddnslastip $ddnsip
} else={
:log info “DDNS: No update required.”
}
}

红色部分别忘记改成自己的了


评论列表暂无评论
发表评论
新浪微博
微信