FreeDNS提供最多5个子域的免费DNS托管。 您可以设置一个域名,例如staryu.mooo.com,并将其指向您想要的任何IP。
下面主要讲讲RouterOS使用FreeDNS DDNS动态解析的方法
1、FreeDNS账号
注册并配置好二级域名。(这边不详细说明了,如果不明白的可以评论咨询)
FreeDNS官网地址:https://freedns.afraid.org
2、RouterOS脚本1
Dynamic DNS -> Direct URL,找到自动更新DDNS链接,自动使用来源IP作为记录。RouterOS定时任务设置,System -> Scheduler,新建计划任务,Interval设置为00:00:30(表示30秒运行次)。
/tool fetch url="FreeDNS更新链接"
3、RouterOS脚本2(建议)
RouterOS定时任务设置,System -> Scheduler,新建计划任务,Interval设置为00:00:30(表示30秒运行次)。
:local user "FreeDNS账号"
:local pass "FreeDNS密码"
:local domain "申请的二级域名"
:local ether "pppoe拨号名称"
#以下请勿修改
:local dnsip [/ip address get [/ip address find interface=$ether] address]
:set dnsip [:pick $dnsip 0 [:find $dnsip "/"]]
:global lastip
:if ($lastip!=$dnsip) do={
:local dnsurl "https://freedns.afraid.org/nic/update?hostname=$domain&myip=$dnsip"
:local result [/tool fetch url=$dnsurl user=$user password=$pass as-value output=user]
:set result [:pick ($result->"data") 0 7]
:if ($result="Updated") do={
:log info "DDNS: Updated with $dnsip Success."
:set lastip $dnsip
} else={
:log info "DDNS: Update with $dnsip Failed."
}
}
目前有 0 条评论