找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 8399|回复: 12

[脚本] 从5.12升级到5.14以后就悲剧了.

[复制链接]
发表于 2012-4-16 13:17:34 | 显示全部楼层 |阅读模式

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

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

×
ros 5.12的DDNS还可以用,升级到5.14后就不能用了.附DDNS脚本


# HomingBeacon Main Dynamic DNS Update Script
# Written by Sam Norris, ChangeIP.com
# 20100728 Tested on routeros 4.9
# 20110511 Tested on RouterOS 5.2

# Set your specific ChangeIP.com preferences here.
:global ddnsuser "hnlt001"
:global ddnspass "*****"
:global ddnshost "*****.mrface.com"
# Change ddnsport to 8245 to bypass proxy.
:local ddnsport 80

# Do not edit anything below this line.  You have been warned.
# Abusive updates to the system will cause firewall blocks.

# Please be considerate and
# do not let this script run more than once per 3-5 minutes.

:log info "DDNS: Starting."

# Initialize checkpoint
:global ddnscheckpoint
:if ([:typeof $ddnscheckpoint] = "time") do={
        :log info ("DDNS: Last check was " . ([/system clock get time] - $ddnscheckpoint))
} else={
        :log info "DDNS: Cannot determine checkpoint, set now."
        :global ddnscheckpoint ( [/system clock get time] - 1d )
}

# Get the current IP
:if ([/system clock get time] - $ddnscheckpoint > [:totime 180s] || [/system clock get time] - $ddnscheckpoint < [:totime 0s]) do={
   :log info "DDNS: Performing remote IP detection."
   /tool fetch address="ip.changeip.com" host="ip.changeip.com" src-path=("/?" . [/int eth get 0 mac-address ]) dst-path="ip.changeip.com.txt" mode=http port=$ddnsport
   :global ddnscheckpoint [/system clock get time]
} else={
   :log info "DDNS: Please be considerate and wait a few seconds longer."
   :break
}

# Parse the IP address received from fetch script.
        :global ddnslastip
        :local html [/file get "ip.changeip.com.txt" contents]
        :local ddnsip [:pick $html ([:find $html "<!--IPADDR="] + 11) [:find $html "-->"] ]

# Is it a valid IP and is it different than the last one?
        :if ([:typeof [:toip $ddnsip]] = "ip" AND $ddnsip != $ddnslastip ) do={
                :log info "DDNS: Sending UPDATE with $ddnsip"
                :log info [/tool dns-update name=$ddnshost address=$ddnsip key-name=$ddnsuser key=$ddnspass ]
                :global ddnslastip $ddnsip
        } else={
                :log info "DDNS: No update required."
        }
}
routeros
发表于 2012-4-16 13:25:43 | 显示全部楼层
ros 5.xDDNS changeip最新脚本!适合ADSL多线,掉线自动切换IP!
  1. Open a terminal window and paste both scripts below.
  2. Then using the script window change the UserID, Password, and hostname.

  3. /system script
  4. add name=HomingBeacon policy=\
  5.     ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \
  6.     source="# HomingBeacon Main Dynamic DNS Update Script\r\
  7.     \n# Written by Sam Norris, ChangeIP.com\r\
  8.     \n# 20100728 Tested on RouterOS 4.9\r\
  9.     \n# 20110511 Tested on RouterOS 5.2\r\
  10.     \n\r\
  11.     \n# Set your specific ChangeIP.com preferences here.\r\
  12.     \n:global ddnsuser "用户ID"\r\
  13.     \n:global ddnspass "密码"\r\
  14.     \n:global ddnshost "域名HOSTNAME.changeip.net"\r\
  15.     \n# Change ddnsport to 8245 to bypass proxy.\r\
  16.     \n:local ddnsport 80\r\
  17.     \n\r\
  18.     \n# Do not edit anything below this line.  You have been warned.\r\
  19.     \n# Abusive updates to the system will cause firewall blocks.\r\
  20.     \n\r\
  21.     \n# Please be considerate and\r\
  22.     \n# do not let this script run more than once per 3-5 minutes.\r\
  23.     \n\r\
  24.     \n:log info "DDNS: Starting."\r\
  25.     \n\r\
  26.     \n# Initialize checkpoint\r\
  27.     \n:global ddnscheckpoint\r\
  28.     \n:if ([:typeof \$ddnscheckpoint] = "time") do={\r\
  29.     \n\t:log info ("DDNS: Last check was " . ([/system clock get time] - \$d\
  30.     dnscheckpoint))\r\
  31.     \n} else={\r\
  32.     \n\t:log info "DDNS: Cannot determine checkpoint, set now."\r\
  33.     \n\t:global ddnscheckpoint ( [/system clock get time] - 1d )\r\
  34.     \n}\r\
  35.     \n\r\
  36.     \n# Get the current IP\r\
  37.     \n:if ([/system clock get time] - \$ddnscheckpoint > [:totime 180s] || [/s\
  38.     ystem clock get time] - \$ddnscheckpoint < [:totime 0s]) do={\r\
  39.     \n   :log info "DDNS: Performing remote IP detection."\r\
  40.     \n   /tool fetch address="ip.changeip.com" host="ip.changeip.com" src-\
  41.     path=("/\?" . [/int eth get 0 mac-address ]) dst-path="ip.changeip.com.\
  42.     txt" mode=http port=\$ddnsport\r\
  43.     \n   :global ddnscheckpoint [/system clock get time]\r\
  44.     \n} else={\r\
  45.     \n   :log info "DDNS: Please be considerate and wait a few seconds longer\
  46.     ."\r\
  47.     \n   :break\r\
  48.     \n}\r\
  49.     \n\r\
  50.     \n# Parse the IP address received from fetch script.\r\
  51.     \n\t:global ddnslastip\r\
  52.     \n\t:local html [/file get "ip.changeip.com.txt" contents]\r\
  53.     \n\t:local ddnsip [:pick \$html ([:find \$html "<!--IPADDR="] + 11) [:fi\
  54.     nd \$html "-->"] ]\r\
  55.     \n\r\
  56.     \n# Is it a valid IP and is it different than the last one\?\r\
  57.     \n\t:if ([:typeof [:toip \$ddnsip]] = "ip" AND \$ddnsip != \$ddnslastip \
  58.     ) do={\r\
  59.     \n\t\t:log info "DDNS: Sending UPDATE with \$ddnsip"\r\
  60.     \n\t\t:log info [/tool dns-update name=\$ddnshost address=\$ddnsip key-nam\
  61.     e=\$ddnsuser key=\$ddnspass ]\r\
  62.     \n\t\t:global ddnslastip \$ddnsip\r\
  63.     \n\t} else={\r\
  64.     \n\t\t:log info "DDNS: No update required."\r\
  65.     \n\t}\r\
  66.     \n}\r\
  67.     \n"

  68. /system scheduler
  69. add comment="ChangeIP.com Dynamic DNS Update" \
  70.   disabled=no \
  71.   interval=5m name=DynamicDNS \
  72.   on-event=HomingBeacon \
  73.   policy=read,write start-time=startup
复制代码
routeros
回复

使用道具 举报

发表于 2012-4-16 13:26:29 | 显示全部楼层
我现在就是用的5.14版本!
routeros
回复

使用道具 举报

 楼主| 发表于 2012-4-16 13:27:41 | 显示全部楼层
routeros
回复

使用道具 举报

发表于 2012-4-16 13:29:50 | 显示全部楼层
双线ADSL  PPPOE,可以DDNS
routeros
回复

使用道具 举报

 楼主| 发表于 2012-4-16 13:35:30 | 显示全部楼层
xingyu612 发表于 2012-4-16 13:29
双线ADSL  PPPOE,可以DDNS

你的DDNS脚本,是不是只能在外网不同网关下才能使用,如果外线同网关就不能使用,能否亮出来参考参考
routeros
回复

使用道具 举报

发表于 2012-4-16 13:35:41 | 显示全部楼层
靠,现在还有人用这脚本!用了3.30以上的都不用这些了,都是一条命令搞定
实在很无语
routeros
回复

使用道具 举报

发表于 2012-4-16 13:37:05 | 显示全部楼层
DDNS 掉线自动切换都是一条命令就搞定的事情,还搞得那么麻烦
看来你们都不去了解新功能
我有时连接PCC都直接在路由上动了!
routeros
回复

使用道具 举报

 楼主| 发表于 2012-4-16 13:38:56 | 显示全部楼层
FreeBSD_shell 发表于 2012-4-16 13:35
靠,现在还有人用这脚本!用了3.30以上的都不用这些了,都是一条命令搞定
实在很无语

不知道啥命令,能否给指点一下,这边环境,多线PPPOE,外线网关地址相同.
routeros
回复

使用道具 举报

发表于 2012-4-16 13:42:51 | 显示全部楼层
你可以到我的帖子里面找一下!里面有一些快速设置的脚本与命令
不用你这里这样设置得这么麻烦
routeros
回复

使用道具 举报

 楼主| 发表于 2012-4-16 13:45:15 | 显示全部楼层
FreeBSD_shell 发表于 2012-4-16 13:42
你可以到我的帖子里面找一下!里面有一些快速设置的脚本与命令
不用你这里这样设置得这么麻烦

好,谢谢了.
routeros
回复

使用道具 举报

发表于 2012-10-23 22:35:38 | 显示全部楼层
貌似直接 一句就搞定了? /tool dns-update name=域名 address=127.0.0.255 key-name=账号 key=密码
routeros
回复

使用道具 举报

发表于 2012-10-23 22:36:18 | 显示全部楼层
xingyu612 发表于 2012-4-16 13:25
ros 5.xDDNS changeip最新脚本!适合ADSL多线,掉线自动切换IP!

/tool dns-update name=域名 address=127.0.0.255 key-name=账号 key=密码
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 01:03 , Processed in 0.099605 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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