当前位置:首页 > 原创教程 > RouterOS使用ChangeIP实现DDNS动态解析

RouterOS使用ChangeIP实现DDNS动态解析

原创教程 / 星之宇 / 2023-5-23 20:47 / 浏览:1712 / 评论:0

ChangeIP是一个提供免费二级域名和免费DNS域名解析服务的网站,跟花生壳之类的DDNS动态域名解析服务很像,但是ChangeP的限制少,更新快,域名后缀多。


下面主要讲讲RouterOS使用ChangeIP DDNS动态解析的方法

1、ChangeIP账号

注册并配置好二级域名。(这边不详细说明了,如果不明白的可以评论咨询)

ChangIP官网地址:https://www.changeip.com/accounts/cart.php?a=confproduct&i=0


2、RouterOS脚本

Winbox中,System -> Scheduler,新建计划任务,Interval设置为00:00:30(表示30秒运行次)。

:local user "changeip账号"
:local pass "changeip密码"
:local domain "申请的二级域名"
:local ether "宽带拨号名称"

#以下请勿修改
: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://nic.ChangeIP.com/nic/update\3Fip=" . $dnsip . "&hostname=" . $domain)
  :local result [/tool fetch url=$dnsurl user=$user password=$pass as-value output=user] 
  :set result [:pick ($result->"data") 0 3]
  :if ($result="200") do={
    :log info "DDNS: Updated with $dnsip Success."
    :set lastip $dnsip
  } else={
    :log info "DDNS: Update with $dnsip Failed."
  }
}

目前有 0 条评论

    • 昵称
    • 邮箱
    • 网址