DDNS动态域名脚本-ROS RouterOS 中设置 3322 公云

3322域名申请:http://www.pubyun.com/
#将以下脚本加计划每3分钟执行一次即可:

:local ednsuser "登陆用户名"
:local ednspass "登陆密码"
:local ednshost "申请到的域名"
:local ednsinterface "接口名,例:pppoe-out2"
:local members "http://members.3322.org/dyndns/update?system=dyndns"
#:local members "http://members.dyndns.org/nic/update?"
:local status
:local status [/interface get [/interface find name=$ednsinterface] running]
:if ($status!=false) do={
:local ednslastip [:resolve $ednshost]
:if ([ :typeof $ednslastip ] = nil ) do={ :local ednslastip "0" }
:local ednsiph [ /ip address get [/ip address find interface=$ednsinterface ] address ]
:local ednsip [:pick $ednsiph 0 [:find $ednsiph "/"]]
:local ednsstr "&hostname=$ednshost&myip=$ednsip"
:if ($ednslastip != $ednsip) do={/tool fetch url=($members . $ednsstr) mode=http user=$ednsuser password=$ednspass dst-path=$ednshost
:delay 2
:local result [/file get $ednshost contents]
:log info ($ednshost . " " .$result)
/file remove $ednshost ;
}
}

如果无法解析,请核对DNS相关设置:
3322-2


支持版本:ROS3.x,4.x,5.x