/ system script
add name="ddnsInit" source="
:log info "ddnsInit: Creating Dynamic DNS
update system."
:global u " 你的账号 "
:global p " 你的密码 "
:global n
" 你的账号 "
:global z "25u.com"
:global dialInterface [/interface
pppoe-client get pppoe-out name]
:log info ("find dial interface: " .
$dialInterface)
:global ac [/ip address get [/ip address find
interface=$dialInterface] address]
:global a [:pick $ac 0 [:find
$ac "/"]]
" policy=ftp,reboot,read,write,policy,test,winbox,password
add name="ddnsSendUpdate" source="
:log info ("ddnsSendUpdate: External IP
Address is " . $a)
/tool dns-update name=$n zone=$z address=$a
/ip fir nat set[/ip firewall nat find
comment="ADSL"] dst-address=$a"
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="ddnsCheck" source="
:if ([/system scheduler get ddnsJob
run-count]<=1) do={
/system script run ddnsInit
/system script run
ddnsSendUpdate
/system scheduler enable ddnsRetry
}
:global temp
$ac
:global b [/ip address get [/ip address find
interface=$dialInterface] address]
:if ($temp != $b) do={
:global
ac $b
:global a [:pick $ac 0 [:find $ac "/"]]
:log info
("ddnsCheck: Found new IP address: " . $a)
/system script run
ddnsSendUpdate
}
"
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="ddnsReset" source="
/system scheduler remove ddnsJob
/system
scheduler add name=ddnsJob interval=30s on-event=ddnsCheck
:global
u
:global p
:global n
:global z
:global dhcpInterface
:global
a
:global ac
:global b
:global temp
"
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="ddnsApp" source="
:if (([:resolve ($n . "." . $z)]) !=
$a) do={
/system script run ddnsSendUpdate
}
"
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adslnat" source=":global ddns-interface [/interface find
:global ddns-ip [/ip address get [/ip address find
/ip firewall nat set[/ip e] address ]
firewall nat find comment="ADSL"] dst-address=$ddns-ip"
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="DDNS2" source=":log info "ddnsInit: Creating Dynamic DNS update
:global n " 密码 "
:global dialInterface [/interface
:log info ("find dial interface: "
:global ac [/ip address get [/ip address find
:global a [:pick $ac 0 [:find ess]
" $ac "/"]]
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="arp" source=":foreach i in [/ip arp find dynamic yes] do={/ip arp
add copy-from $i}"
policy=ftp,reboot,read,write,policy,test,winbox,password
/ system scheduler
add name="ddnsRetry" on-event=ddnsApp start-date=apr/03/2007
start-time=23:28:22 interval=1h comment="" disabled=yes
add name="ddnsJob" on-event=ddnsCheck start-date=nov/13/2008
start-time=22:05:24 interval=30s comment="" disabled=yes