@
briancao 我 DDNS 用的是脚本实现的,我共享出来给大家吧。
:local ednsuser "用户名"
:local ednspass "密码"
:local ednshost "
xxxxx.3322.org"
:local ednsinterface "pppoe-out1"
:local members "
http://members.3322.net/dyndns/update?system=dyndns"
: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
:delay 2
:local result [/file get $ednshost contents]
:log info ($ednshost . " " .$result)
/file remove $ednshost;
}
}
记得把脚本调成定时执行即可。时间不宜太频繁,会触发 3322 站点的黑名单机制。建议在 1 小时以上的间隔时间。