|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
在Mikrotik论坛看到了changeip.com的sam写的一段关于多线情况下的动态域名更新脚本本,适合多线,多动态域名时使用,我现在没条件测
试其中的脚本,粗略翻译一下发布出来,希望有条件的可以测试一下:
注意事项:
1、此教本是BETA版本,不能保证100%正确运行,如果发现问题,可直接发邮件联系Support@ChangeIP.com
2、多线情况下的动态域名,最多可支持10线
3、如果你在changeip.com上已经申请了多个域名,为了能够实现多动态域名的更新,你需要把你所有已经注册的用户名发邮件到
Support@ChangeIP.com ,请他们为你设置好此项功能,不申请不能使用。
如果你觉得写邮件有点儿困难,我这里提供一个,你稍做修改就可以发送或者你自己写一个,诚恳一些,别忘了感谢一下就行了:
- Hi Sam:
- Pls enable my accounts below with inbound load balancing across multiple providers,thank you very much.
- Account1:
- Account2:
- Best Regards
- !!!!你的签名!!!!
复制代码
5、代码部份:
[code]# Dynamic DNS Update / Round Robin Edition
# Written by Sam Norris, ChangeIP.com
# Copyright ChangeIP.com 2005
# For support send mail to Support@ChangeIP.com
#
# Revision 0.10 beta - Initial script written (09/20/05)
# Revision 0.11 beta - Bypass list help thanks to STEN. (09/26/05)
#
# OVERVIEW: %
# This script will update a ChangeIP.com dynamic dns hostname
# with a set of ip addresses to accomplish inbound load balancing
# using round robin dns. When an ip address is no longer valid
# on the Mikrotik it will update the dynamic dns account to remove
# it therefore keeping incoming traffic from using it.
# %
# ENHANCED DDNS OFFERING! REQUIRED UPGRADE!
# This update script can only be used if your ChangeIP.com account
# has the "Dynamic DNS Round Robin Upgrade". This can be
# enabled by visiting http://www.ChangeIP.com/2.0/dns/roundrobin.aspx
# note: as of 09/25/05 you should email Support@ChangeIP.com to
# enable this. %
# %
# NOTES: %
# Inbound load balancing requires more than 1 WAN connection, each
# with about equal bandwidth performance. If one connection is a
# modem and the other is broadband you will probably kill the modem
# and cause intermittent connection to your servers. This service
# does not take into account how busy each WAN port is, it simply
# advertises all available IP addresses to the DNS system to allow
# and use connections from multiple internet providers. When an IP
# address on the Mikrotik router is no longer present or disabled a
# dynamic dns update will occur and new ip addresses will be served
# via DNS to the outside world. Detection, update, replication time
# should typically be less than 1 minute. IF THIS SCRIPT DOES NOT
# PRODUCE ANY OUTPUT PLEASE COPY AND PASTE IT AGAIN. THERE PROBABLY
# IS A LINE BREAK IN THE WRONG PLACE! PLEASE ASK MT FOR BETTER SCRIPT
# ERROR HANDLING. %
# %
# 变量部份:
# 注释
# 变量ddns-user: 你在ChangeIP.com上的用户名.
# 变量ddns-pass: ddns-user对应的密码.
# 变量ddns-host: 动态域名.
# 变量ddns-interfaces: 外线网卡名字,!!!!大小写敏感,切记!!!!!.
# 变量ddns-bypass: 更新时忽律的IP地址.
# %
# %
# %
# %
# %
# %
# % % %
# % % %
# % % %
# %
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 开始定义变量 ,可根据你外线的数量及名称修改相应部份
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:global ddns-user "用户名"
:global ddns-pass "密码"
:global ddns-host "域名"
:global ddns-interfaces "ether1,ether2,ether3,ether4,public,wan,wan1,outside,1-coxBiz"
:global ddns-bypass "10.0.0.0/8,172.16.0.0/12,192.168.0.0/16"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 脚本开始,以下无需修改(除非你会改 : ) )
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# %
# % % %
# % % %
# % % %
# %
# %
# %
# %
# %
:log debug "DDNS: Start"
:global ddns-valid-interfaces ""
# Gather list of valid interfaces
:foreach i in=[:toarray $ddns-interfaces] do={
:if ( [:toid [/interface find name=$i ] ] != nil ) do={
:log debug ("DDNS: Found Interface: " . $i)
:global ddns-valid-interfaces ($ddns-valid-interfaces . "," . $i )
}
}
:global ddns-valid-interfaces [:toarray $ddns-valid-interfaces]
:log debug ("DDNS: Valid interface list: " . $ddns-valid-interfaces )
# Now loop thru all interfaces and gather IP addresses.
:global ddns-ip ""
:foreach i in=[:toarray $ddns-valid-interfaces ] do={
:foreach ipaddr in=[/ip address find interface=$i disabled=no] do={
:local tmp [/ ip address get $ipaddr address]
:local tmp [:pick $tmp 0 [:find $tmp "/"] ]
:log debug ( "DDNS: Found IP: " . $tmp )
:set i 0
:foreach net in=[:toarray $ddns-bypass ] do={
:log info ( "DDNS: Is " . $tmp . " within network " . $net . " ? ")
:if ( ([:pick $net 0 [:find $net "/"]] & (255.255.255.255 |
|