RouerOS DDNS 设置方法
先到www.changeip.com填写注册申请,并添加一个域名。
并在RouterOS的调度程序中添加下列代码:
:log info "DDNS: Begin"
:global ddns-user "你的用户名"
:global ddns-pass "你的密码"
:global ddns-host "*1"
:global ddns-interface "外网拨号线路,比如(pppoe-out3)"
:global ddns-ip [ /ip address get [/ip address find interface=$ddns-interface] address ]
:if ([ :typeof $ddns-lastip ] = nil ) do={ :global ddns-lastip 0.0.0.0/0 }
:if ([ :typeof $ddns-ip ] = nil ) do={
:log info ("DDNS: No ip address present . " . $ddns-interface . ", please check.")
} else={
:if ($ddns-ip != $ddns-lastip) do={
:log info "DDNS: Sending Update!"
:log info [ /tool dns-update name=$ddns-host address=[:pick $ddns-ip 0 [:find $ddns-ip "/"] ] key-name=$ddns-user key=$ddns-pass ]
:global ddns-lastip $ddns-ip
} else={
:log info "DDNS: No change"
}
}
:log info "DDNS: End"