其他分享
首页 > 其他分享> > ros-ddns-ChangeIP

ros-ddns-ChangeIP

作者:互联网

http://www.changeip.com/

:global ddnsuser "你的帐号"
:global ddnspass "你的密码"
:global ddnshost "你创建的域名.dnset.com"
:global ddnsinterface "你公网拨号的接口比如pppoe-out1"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# END OF USER DEFINED CONFIGURATION
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:global ddnssystem ("mt-" . [/system package get [/system package find name=system] version] )
:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
:global ddnslastip

:if ([:len [/interface find name=$ddnsinterface]] = 0 ) do={ :log info "DDNS: No interface named $ddnsinterface, please check configuration." }

: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 [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ] ]
:global ddnslastip $ddnsip

} else={

:log info "DDNS: No changes necessary."

}

}

标签:info,ChangeIP,log,ddnsinterface,global,ddns,address,ddnsip,ros
来源: https://www.cnblogs.com/itfat/p/14696933.html