深圳捷联讯通科技有限公司

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

mikrotik routes 6.15 changeip更新脚本

[复制链接]

25

主题

53

帖子

575

积分

高级会员

小学生

Rank: 4

积分
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

主题

30

帖子

258

积分

超级版主

Rank: 8Rank: 8

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

使用道具 举报

*滑块验证:
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2022-11-30 15:11 , Processed in 0.120085 second(s), 25 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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