mjqmjq 发表于 2012-3-24 09:55:17

谁有新版本的ros ddns 脚本

我现在的脚本以前在2.9.27 上用的。5.4版本的用不了

:global pptpname ("pptp-out")
:global hostip ("***.25u.com")
:global ddnsip [:tostr [:resolve $hostip] ]
:if ([ :typeof $ddnsip ] = nil ) do={ :global ddnsip "0" }
:global pptpip [ /interface pptp-client get connect-to]
:if ($ddnsip != $pptpip) do={
/interface pptp-client set connect-to=$ddnsip
:log info ("pptp:Change connect-to IP " . $pptpip . " to ". $ddnsip)
}

这个很好用,可是新版本用不了
这个可能是 4.0以前的版本可以用吧
希望高手帮改一下新版本的。非常感谢

xingyu612 发表于 2012-3-24 10:30:02

这是5.X的DDNS脚本/system script

add name=HomingBeacon policy=\

    ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive,api \

    source="# HomingBeacon Main Dynamic DNS Update Script\r\

    \n# Written by Sam Norris, ChangeIP.com\r\

    \n# 20100728 Tested on RouterOS 4.9\r\

    \n# 20110511 Tested on RouterOS 5.2\r\

    \n\r\

    \n# Set your specific ChangeIP.com preferences here.\r\

    \n:global ddnsuser \"USERID\"\r\

    \n:global ddnspass \"PASSWORD\"\r\

    \n:global ddnshost \"HOSTNAME.changeip.net\"\r\

    \n# Change ddnsport to 8245 to bypass proxy.\r\

    \n:local ddnsport 80\r\

    \n\r\

    \n# Do not edit anything below this line.You have been warned.\r\

    \n# Abusive updates to the system will cause firewall blocks.\r\

    \n\r\

    \n# Please be considerate and\r\

    \n# do not let this script run more than once per 3-5 minutes.\r\

    \n\r\

    \n:log info \"DDNS: Starting.\"\r\

    \n\r\

    \n# Initialize checkpoint\r\

    \n:global ddnscheckpoint\r\

    \n:if ([:typeof \$ddnscheckpoint] = \"time\") do={\r\

    \n\t:log info (\"DDNS: Last check was \" . ( - \$d\

    dnscheckpoint))\r\

    \n} else={\r\

    \n\t:log info \"DDNS: Cannot determine checkpoint, set now.\"\r\

    \n\t:global ddnscheckpoint ( - 1d )\r\

    \n}\r\

    \n\r\

    \n# Get the current IP\r\

    \n:if ( - \$ddnscheckpoint > [:totime 180s] || [/s\

    ystem clock get time] - \$ddnscheckpoint < [:totime 0s]) do={\r\

    \n   :log info \"DDNS: Performing remote IP detection.\"\r\

    \n   /tool fetch address=\"ip.changeip.com\" host=\"ip.changeip.com\" src-\

    path=(\"/\?\" . ) dst-path=\"ip.changeip.com.\

    txt\" mode=http port=\$ddnsport\r\

    \n   :global ddnscheckpoint \r\

    \n} else={\r\

    \n   :log info \"DDNS: Please be considerate and wait a few seconds longer\

    .\"\r\

    \n   :break\r\

    \n}\r\

    \n\r\

    \n# Parse the IP address received from fetch script.\r\

    \n\t:global ddnslastip\r\

    \n\t:local html \r\

    \n\t:local ddnsip [:pick \$html ([:find \$html \"<!--IPADDR=\"] + 11) [:fi\

    nd \$html \"-->\"] ]\r\

    \n\r\

    \n# Is it a valid IP and is it different than the last one\?\r\

    \n\t:if ([:typeof [:toip \$ddnsip]] = \"ip\" AND \$ddnsip != \$ddnslastip \

    ) do={\r\

    \n\t\t:log info \"DDNS: Sending UPDATE with \$ddnsip\"\r\

    \n\t\t:log info [/tool dns-update name=\$ddnshost address=\$ddnsip key-nam\

    e=\$ddnsuser key=\$ddnspass ]\r\

    \n\t\t:global ddnslastip \$ddnsip\r\

    \n\t} else={\r\

    \n\t\t:log info \"DDNS: No update required.\"\r\

    \n\t}\r\

    \n}\r\

    \n"



/system scheduler

add comment="ChangeIP.com Dynamic DNS Update" \

disabled=no \

interval=5m name=DynamicDNS \

on-event=HomingBeacon \

policy=read,write start-time=startup

fandl 发表于 2012-3-24 11:18:05

我碰到的:

5.12可用,升级到5.14,无法使用。卡在:resolve,无法解析(通过终端一条一条测试发现的)。

后来不死心,在虚拟机测试,发现没问题,那么就是升级后没有复位的问题了。

rockup 发表于 2012-3-24 11:21:23

:global ddnsuser "帐号"
:global ddnspass "密码"
:global ddnshost "XXXXXXX.ddns.info"
:global ddnsinterface "pppoe-out1"
:global ddnslastip

:global ddnsip [ /ip address get address ]
: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 [ /tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ]
   :global ddnslastip $ddnsip
   } else={
   :log info "DDNS: No change"
}
}
:log info "DDNS: End"

FreeBSD_shell 发表于 2012-4-16 14:26:48

怎么还用这些脚本,一条命令搞定的事,搞得这么麻烦!唉

风轻 发表于 2012-4-16 16:50:45

FreeBSD_shell 发表于 2012-4-16 14:26 static/image/common/back.gif
怎么还用这些脚本,一条命令搞定的事,搞得这么麻烦!唉

哪条命令?发出来嘛!

FreeBSD_shell 发表于 2012-4-16 21:23:51

风轻 发表于 2012-4-16 16:50 static/image/common/back.gif
哪条命令?发出来嘛!

/tool dns-update name="www.baidu.com" address127.0.0.255 key-name=user key=passwd

lxgit 发表于 2013-5-11 21:42:45

老大你们这个脚有点看不懂,能否请教一下。。

sealin 发表于 2013-5-12 08:21:00

FreeBSD_shell 发表于 2012-4-16 21:23 static/image/common/back.gif
/tool dns-update name="www.baidu.com" address127.0.0.255 key-name=user key=passwd

这条命令是没错
但是没有进行ip变动的比对
容易造成频繁发送ddns请求
如果ddns封了帐号就不好了

crc8 发表于 2013-5-16 10:02:56

sealin 发表于 2013-5-12 08:21 static/image/common/back.gif
这条命令是没错
但是没有进行ip变动的比对
容易造成频繁发送ddns请求


很想知道有没有用过这条命令而被封的.

9939781 发表于 2013-5-16 10:12:00

crc8 发表于 2013-5-16 10:02 static/image/common/back.gif
很想知道有没有用过这条命令而被封的.

大把的,没事就去更新DDNS,结局就是被封,而且是被封很久。

crc8 发表于 2013-5-16 10:18:14

9939781 发表于 2013-5-16 10:12 static/image/common/back.gif
大把的,没事就去更新DDNS,结局就是被封,而且是被封很久。

好吧.那我改为10小时更新一次了

liuqianguan 发表于 2013-5-16 11:08:56

一直用7楼的脚本,设置成20分钟更新一次,偶尔开不了,总体还是很好的,被封就再申请呗

FreeBSD_shell 发表于 2013-5-16 15:56:12

crc8 发表于 2013-5-16 10:02 static/image/common/back.gif
很想知道有没有用过这条命令而被封的.

一直在用,从未被封
wwwftp 都一直在用....都是10分钟更新一次

crc8 发表于 2013-5-17 08:23:47

FreeBSD_shell 发表于 2013-5-16 15:56 static/image/common/back.gif
一直在用,从未被封
wwwftp 都一直在用....都是10分钟更新一次

感谢反馈消息.
页: [1]
查看完整版本: 谁有新版本的ros ddns 脚本