找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3985|回复: 1

[脚本] ADSL DDNS自动更新脚本!

[复制链接]
发表于 2007-7-1 18:40:47 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
# jul/01/2007 18:46:37 by routeros 2.9.27
# software id = 2WP1-T9T
#
/ system script

add name="ddnsInit" source="\n:log info \"ddnsInit: Creating Dynamic DNS \
    update system.\"\n:global u \"账户\"\n:global p \"密码\"\n:global n \
    \"cnfug\"\n:global z \"25u.com\"\n:global dialInterface \[/interface \
    pppoe-client get pppoe-out name\]\n:log info \(\"find dial interface: \" . \
    \$dialInterface\)\n:global ac \[/ip address get \[/ip address find \
    interface=\$dialInterface\] address\]\n:global a \[:pick \$ac 0 \[:find \
    \$ac \"/\"\]\]\n" policy=ftp,reboot,read,write,policy,test,winbox,password
add name="ddnsSendUpdate" source="\n:log info \(\"ddnsSendUpdate: External IP \
    Address is \" . \$a\)\n/tool dns-update name=\$n zone=\$z address=\$a \
    key-name=\$u key=\$p\n
\n/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="\n:if \(\[/system scheduler get ddnsJob \
    run-count\]<=1\) do={\n/system script run ddnsInit\n/system script run \
    ddnsSendUpdate\n/system scheduler enable ddnsRetry\n}\n:global temp \
    \$ac\n:global b \[/ip address get \[/ip address find \
    interface=\$dialInterface\] address\]\n:if \(\$temp != \$b\) do={\n:global \
    ac \$b\n:global a \[:pick \$ac 0 \[:find \$ac \"/\"\]\]\n:log info \
    \(\"ddnsCheck: Found new IP address: \" . \$a\)\n/system script run \
    ddnsSendUpdate\n}\n" \
    policy=ftp,reboot,read,write,policy,test,winbox,password
add name="ddnsReset" source="\n/system scheduler remove ddnsJob\n/system \
    scheduler add name=ddnsJob interval=30s on-event=ddnsCheck\n:global \
    u\n:global p\n:global n\n:global z\n:global dhcpInterface\n:global \
    a\n:global ac\n:global b\n:global temp\n" \
    policy=ftp,reboot,read,write,policy,test,winbox,password
add name="ddnsApp" source="\n:if \(\(\[:resolve \(\$n . \".\" . \$z\)\]\) != \
    \$a\) do={\n/system script run ddnsSendUpdate\n}\n" \
    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=30m comment="" disabled=no
add name="ddnsJob" on-event=ddnsCheck start-date=jul/01/2007 \
    start-time=18:14:29 interval=30s comment="" disabled=no


如果出现ddns error timeout ,让这个IP 204.16.170.0/24通过就行了 另外注意红色部分
上面的代码绝对没有任何问题~

[ 本帖最后由 cnfug 于 2007-7-1 18:58 编辑 ]
routeros
发表于 2007-7-2 16:50:12 | 显示全部楼层
太复杂了,ddns用得到这么复杂么?
帮你顶先
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-12-23 12:32 , Processed in 0.040545 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表