[]
动态域名更新的实现方法
一、首先说明,本篇受“情灭缘尽”转帖的脚本启发,其发布的原始脚本如下:# Dynamic DNS Update Script v1.1
# ------------------------------
# This script will perform automatic dynamic dns updates on the Mikrotik
# router platform.(http://www.mikrotik.com/)Since Mikrotik does not
# support sending http requests we have created a smtp -> ddns proxy service
# which will take the http URL querystring used for a dynamic dns update and
# process it via email.
# ------------------------------
# Written by Sam Norris, ChangeIP.com
# 7/31/04 - Created script.
# 12/9/04 - Made some values dynamic (smtp server, dhcp interface)
# ------------------------------
#
# Instructions:
# There are a few variables down below that you need to configure for your
# specific setup.Please modify the variables in the 'ddnsInit' script to
# reflect your specific information, ie userid, password, hostname to update.
#
# Blow away any existing script code, if necessary.
/system scheduler remove ddnsJob
/system script remove ddnsCheck
/system script remove ddnsInit
/system script remove ddnsReset
/system script remove ddnsSendUpdate
# Setup global variables needed to keep track of changing IP address.
/system script add name="ddnsInit" source={
:log message="ddnsInit: Creating Dynamic DNS update system."
# ENTER YOUR CHANGEIP.COM USER ID HERE.
:global u
:set u "USERID"
# ENTER YOUR CHANGEIP.COM PASSWORD HERE.
:global p
:set p "PASSWORD"
:global s
:set s "Mikrotik"
# ENTER THE TARGET HOSTNAME TO UPDATE, *1 is Set 1.
:global h
:set h "*1"
:global dhcpInterface
:set dhcpInterface [ /ip dhcp-client get interface ]
:log message=("ddnsInit: Found dhcp interface " . $dhcpInterface )
# EMAIL PROXY ADDRESS - DO NOT CHANGE FOR PRODUCTION.
:global ddnsProxyEmail
:set ddnsProxyEmail "ddnsUpdate@ChangeIP.com"
# ENTER YOUR EMAIL ADDRESS FOR CONFIRMATIONS.
:global ddnsFromEmail
:set ddnsFromEmail "youremail@domain.tld"
# SMTP DDNS PROXY SERVER - CHANGE ONLY IF NECESSARY (port 25 blocked?)
:global ddnsSmtpServer
:set ddnsSmtpServer [:resolve smtp.changeip.com]
:global a
:set a [ \
/ip address get \
\
address \
]
}
/system script add name="ddnsCheck" source={
:if ( 看了 就顶 阅! 好贴当然要顶!! 问一下楼主,命令交互界面是不是就是ROS中的类似DOS那个界面呀 oct/05/2005 19:59:27 ddnsSendUpdate: Sending Dynamic DNS smtp update to
63.210.174.75 >
oct/05/2005 20:00:27 Error sending e-mail: abnormal termination (timeout)
不能发送E-mail,还是能访问!
[ 本帖最后由 zzf 于 2005-10-5 20:30 编辑 [/?_] 命令交??界??"山是terminal界面;“情灭”你或絥的主趁是原文的作者cam norris也是动态域吏的捐侙者,你找到了人家的脚本,当然五该用作者Ə?供的域名试验哈。 原帖由 cnyepeng 于 2005-10-5 20:48 发表
呹令交캒界面就是terminal界面;“情灭???你或略瘄主要是原文的作者sam norris也是动态域名的提供???你Ɖ?ň?了人家的脚本,当然应该用作? ?提供嚄域名试验哈。
筈我空闲暄时備来把这脚本毯句㚄駣释츀下 通过做这个试验??我觉徕rks的脚本是一个很???价值的渜西。要在d??用roS䨊有大的提高,以后大家可以在这方面下点功夫,多作交流。 oct/05/2005 20:22:20 ddnsReset: Resetting global values.
oct/05/2005 20:22:20 changed scheduled script settings by admin
oct/05/2005 20:22:24 ddnsSendUpdate: Sending Dynamic DNS smtp update to
oct/05/2005 20:22:24 script error: recipient address required
oct/05/2005 20:22:36 ddnsInit: Creating Dynamic DNS update system.
oct/05/2005 20:22:36 script error: empty string value where some kind of
specific value expected >
oct/05/2005 20:22:36 ddnsInit: Found dhcp interface *3 可能是变量写错了,是不是在定义全局变量dhcpinterface的时候或取值的时候,输入错,比如把“dhcpInterface”写成了“dhcp interface" 谢谢楼主和情灭老大呀,希望能尽快出这个脚本的命令解释。 我说的是脚本的内容,不是执行的结果。其实已经告诉你错误了,就是全局变量ddnsProxyEmail 没有定义,检查以下部分:
# EMAIL PROXY ADDRESS - DO NOT CHANGE FOR PRODUCTION.
:global ddnsProxyEmail
:set ddnsProxyEmail "ddnsUpdate@ChangeIP.com"