1、基本作法:spa
一、申請DDNS帳號:.net
www.changeip.comblog
二、激活:到郵箱中激活dns
三、ROS用腳本更新:ip
:global ddnsuser "123456789@qq.com"
:global ddnspass "www.123"
:global ddnshost "wpjwyj.myddns.com"
:global ddnsinterface "ether2"
:global ddnslastipget
:global ddnsip [ /ip address get [/ip address find dynamic=yes interface=$ddnsinterface ] address ]
:if ( [:typeof $ddnslastip]="nothing" ) do={ :global ddnslastip 0.0.0.0/0 }
:if ( [:typeof $ddnsip]="nothing" ) do={
:log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")
} else={
:if ($ddnsip != $ddnslastip) do={
:log info "DDNS: Sending UPDATE!"
:log info [ /tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ]
:global ddnslastip $ddnsip
} else={
:log info "DDNS: No change"
}
}
ast
2、另類作法:class
一、一條語句就搞定:date
/tool dns-update name=wpjwyj.changeip.net address=127.0.0.255 key-name=wpjwyj key=123456im
二、127.0.0.255(只要是廣播地址就能夠)的做用:發送廣播,獲取當前WAN網口的IP。