|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
一、首先说明,本篇受“情灭缘尽”转帖的脚本启发,其发布的原始脚本如下:
# 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 \
[/ip address find interface=$dhcpInterface] \
address \
]
}
/system script add name="ddnsCheck" source={
:if ([/system scheduler get ddnsJob run-count] |
|