pcc多线PPPOE拔号,灰太狼版主帮我修改的自动寻找默认端口5.X的DDNS
本帖最后由 kzyfl 于 2012-3-1 12:40 编辑原来在3.30下十分好用,就是在5.12版下不能用了,升级到5.12和以前的3.30版的ROS的设置都完全一样,就是DDNS用不了,以下是灰太狼版主帮我修改后的5.12版的DDNS脚本。个人感觉灰太狼版主改的也没错,就是在5.12下用不了,不知道为什么,希望高手能给指点指点。
:global ddnsuser "用户名"
:global ddnspass "密码"
:global ddnshost "二级域名"
:global ddnsinterface gateway]
:set ddnsinterface interface]
:global ddnslastip
:put $ddnsinterface
:global ddnsip [ /ip address get address ]
:if ( [:typeof $ddnslastip]="nothing" ) do={ :global ddnslastip0.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 $ddnsip0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ]
:global ddnslastip $ddnsip
}
}
以下是以前论坛上可用的3.30脚本。
:global ddnsuser "用户名"
:global ddnspass "密码"
:global ddnshost "二级域名"
:global ddnsinterface interface]
: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
}
}
本帖最后由 host2318 于 2012-3-1 14:41 编辑
v5.x
:global ddnsinterface gateway]
:set ddnsinterface interface]
v3.x
:global ddnsinterface interface]
3.30下ip route菜单内有 interface 列
5.X取消了那一列内容。所以获取不到interface这个参数,而版主改为获取网关地址,再通过网关地址拿到ip address菜单内的interface
思路灵活,运用巧妙。之前折腾过,也没弄出来自动的
适用于所有环境,实在是方便! 本帖最后由 kzyfl 于 2012-3-2 00:15 编辑
host2318 发表于 2012-3-1 14:38 static/image/common/back.gif
v5.x
:global ddnsinterface gateway]
:set ddn ...
适应所有环境,就是不适应我这边环境,我这边是很多PPPOE拔号的IP地址的网关地址一样。
host2318 发表于 2012-3-1 14:38 static/image/common/back.gif
v5.x
:global ddnsinterface gateway]
:set ddn ...
我试过了,多IP,网关不重的话,可以正常DDNS,如果多IP,网关重复的话,总是DDNS不成功。 本帖最后由 host2318 于 2012-3-2 09:53 编辑
kzyfl 发表于 2012-3-2 00:16 static/image/common/back.gif
我试过了,多IP,网关不重的话,可以正常DDNS,如果多IP,网关重复的话,总是DDNS不成功。
那就试试changeip给的脚本吧。也是全自动,也不用你选择什么的。工作原理不同了
http://www.changeip.com/mikrotik/
# 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 "user"
:global ddnspass "password"
:global ddnshost "MyRouterHostname.example.org"
# 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 " . ( - $ddnscheckpoint))
} else={
:log info "DDNS: Cannot determine checkpoint, set now."
:global ddnscheckpoint ( - 1d )
}
# Get the current IP
:if ( - $ddnscheckpoint > [:totime 180s] || - $ddnscheckpoint < [:totime 0s]) do={
:log info "DDNS: Performing remote IP detection."
/tool fetch address="ip.changeip.com" host="ip.changeip.com" src-path=("/?" . ) dst-path="ip.changeip.com.txt" mode=http port=$ddnsport
:global ddnscheckpoint
} 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
: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
:global ddnslastip $ddnsip
} else={
:log info "DDNS: No update required."
}
}
host2318 发表于 2012-3-2 09:52 static/image/common/back.gif
那就试试changeip给的脚本吧。也是全自动,也不用你选择什么的。工作原理不同了
http://www.changeip. ...
这个脚本很不错,问题解决。 不错 解决5x的 ddns!
页:
[1]