找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 5322|回复: 5

[脚本] ros 3.x changeip动态域名脚本,来自routeros官网

[复制链接]
发表于 2009-12-16 11:30:02 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
本帖最后由 tournet 于 2009-12-16 11:40 编辑

# Define User Variables
:global ddnsuser "你在changeip注册的用户名"
:global ddnspass "你在chageip注册的密码"
:global ddnshost "你在changeip注册的域名,如:xxx.changeip.org"

# Define Global Variables
:global ddnsip
:global ddnslastip
:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }

:global ddnsinterface
:global ddnssystem ("mt-" . [/system package get system version] )

# Define Local Variables
:local int

# Loop thru interfaces and look for ones containing
# default gateways without routing-marks
:foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes ] do={
  :if ([:typeof [/ip route get $int routing-mark ]] != str ) do={
     :global ddnsinterface [/ip route get $int interface]
  }
}

# Grab the current IP address on that interface.
:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ]

# Did we get an IP address to compare?
:if ([ :typeof $ddnsip ] = nil ) do={
   :log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")
} else={

  :if ($ddnsip != $ddnslastip) do={

    :log info "DDNS: Sending UPDATE!"
    :log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ] ]
    :global ddnslastip $ddnsip

  } else={
    :log info "DDNS: No update required."
  }

}

# End of script



ros3.22,电信ADSL单线验证有效。
试了坛子上的好几个脚本,未成功,奇怪,然后搜索到ROS官网,发现2.X、3.X、4.X分别有不同的ddns示例,粘贴过来就行了。且这个脚本貌似有回流作用(待验证中……)?
routeros
发表于 2009-12-16 17:30:25 | 显示全部楼层
你是从那个官网下的?
routeros
回复

使用道具 举报

发表于 2009-12-16 17:43:35 | 显示全部楼层
routeros
回复

使用道具 举报

发表于 2009-12-17 12:23:01 | 显示全部楼层
记号,收藏,有时用得着。
routeros
回复

使用道具 举报

发表于 2010-2-19 00:33:47 | 显示全部楼层
记号,收藏,有时用得着
routeros
回复

使用道具 举报

发表于 2010-5-11 02:44:16 | 显示全部楼层
有没927的脚本呀。贴个啊。我在官方没找到。
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-6-1 21:00 , Processed in 0.094966 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表