:global count 2
#这里是定义的为adsl拔号的数目
:global runid
:global status
:global ddnsinterface "pppoe-out"
#这里定义通用的adsl名次,这里为pppoe-outl这样的形式
:set runid ("a")
:for i from=1 to=$count do={
:set status [/interface get [/interface find name=("pppoe-out" . $i) ] running ]
:if ($status=true) do={:set runid ($runid . $i )
}
}
:set runid [:pick $runid 1 2]
#获得第一条已经连接的adsl
:set ddnsinterface ($ddnsinterface . $runid)
:global ddnsuser "changeip账号"
:global ddnspass "changeip密码"
:global ddnshost "申请的域名"
:global ddnsip
:global ddnsipfn
:global ddnslastip [:tostr [:resolve $ddnshost] ]
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }
:global ddnssystem ("mt-" . [/system package get system version] )
:local ddnsipfn [ /ip address get [/ip address find interface=$ddnsinterface ] address ]
:global ddnsip [:pick $ddnsipfn 0 [:find $ddnsipfn "/" ] ]
:if ([ :typeof $ddnsip ] = nil ) do={
:log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")
} else={
:if ($ddnsip != $ddnslastip) do={
:log warning ("发送DDNS更新!" . "接口为:" . $ddnsinterface)
:log info [ :put [/tool dns-update name=$ddnshost address=$ddnsip key-name=$ddnsuser key=$ddnspass ] ]
:global ddnslastip $ddnsip
} else={
:log info "DDNS: No update required."
}
}
按照注释来改就可以了
<div style="font-family: "lucida Grande', Verdana; font-size: 12px; line-height: 20px; background-color: rgb(255, 255, 255);">