找回密码
 立即注册
查看: 7815|回复: 1

mikrotik routes 6.15 changeip更新脚本

[复制链接]

25

主题

28

回帖

575

积分

高级会员

小学生

积分
575

热心会员活跃会员最佳新人

发表于 2014-7-1 10:29:39 | 显示全部楼层 |阅读模式
:global ddnsuser "账号"
:global ddnspass "密码"
:global ddnshost "域名"
:global ddnsinterface "接口"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# END OF USER DEFINED CONFIGURATION
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:global ddnssystem ("mt-" . [/system package get [/system package find name=system] version] )
:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
:global ddnslastip

:if ([:len [/interface find name=$ddnsinterface]] = 0 ) do={ :log info "DDNS: No interface named $ddnsinterface, please check configuration." }
: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 [ :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 changes necessary."
}

}
# END OF SCRIPT

没有谁比谁厉害,只有谁比谁热心!
回复

使用道具 举报

26

主题

4

回帖

258

积分

超级版主

积分
258
QQ
发表于 2014-7-1 16:37:12 | 显示全部楼层
赞一个!
回复

使用道具 举报

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

本版积分规则

QQ|Archiver|手机版|小黑屋|EDCwifi.BBS ( 粤ICP备17065502号-1 粤公网安备44030702001530号 )

GMT+8, 2024-12-22 11:57 , Processed in 0.183294 second(s), 24 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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