找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3943|回复: 2

[脚本] ddns不能动态更新IP,有时候手动运行脚本可以,有时候又不可以更新,郁闷!

[复制链接]
发表于 2009-5-3 20:03:12 | 显示全部楼层 |阅读模式

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

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

×
环境:ros2.9.27
用计划任务执行 运行次数是有的 但手动更新运行有时候可以有时候又不可以更新
QQ截图未命名.jpg
代码: 用ROS脚本生成器2.0 生成

第一个代码::log info "DDNS: Begin"
:global ddns-user "用户名"
:global ddns-pass "密码"
:global ddns-host "用户名.dns-dns.com"
:global ddns-interface "pppoe-out1"
:global ddns-system ("mt-" . [/system package get [/system package find name=system] version] )
:global ddns-ip [ /ip address get [/ip address find interface=$ddns-interface] address ]
:if ([ :typeof $ddns-lastip ] = nil ) do={ :global ddns-lastip 0.0.0.0/0 }
:if ([ :typeof $ddns-ip ] = nil ) do={
:log info ("DDNS: No ip address present on " . $ddns-interface . ", please check.") } else={
:if ($ddns-ip != $ddns-lastip) do={
:log info "DDNS: Sending UPDATE!"
:log info [ /tool dns-update name=$ddns-host address=[:pick $ddns-ip 0 [:find $ddns-ip "/"] ] key-name=$ddns-user key=$ddns-pass ]
:global ddns-lastip $ddns-ip } else={
:log info "DDNS: No change"
}
}
:log info "DDNS: End"

第二个代码::log info "DDNS: Begin"
:global ddns-user "用户名"
:global ddns-pass "密码"
:global ddns-host "*1"
:global ddns-interface "pppoe-out1"
:global ddns-ip [ /ip address get [/ip address find interface=$ddns-interface] address ]
:if ([ :typeof $ddns-lastip ] = nil ) do={ :global ddns-lastip 0.0.0.0/0 }
:if ([ :typeof $ddns-ip ] = nil ) do={
:log info ("DDNS: No ip address present on " . $ddns-interface . ", please check.")
} else={
:if ($ddns-ip != $ddns-lastip) do={
    :log info "DDNS: Sending UPDATE!"
    :log info [ /tool dns-update name=$ddns-host address=[:pick $ddns-ip 0 [:find $ddns-ip "/"] ] key-name=$ddns-user key=$ddns-pass ]
    :global ddns-lastip $ddns-ip
} else={
    :log info "DDNS: No change"
}
}
:log info "DDNS: End"
routeros
发表于 2009-5-29 10:17:36 | 显示全部楼层
我都系这个总是`
routeros
回复

使用道具 举报

发表于 2009-5-29 18:24:50 | 显示全部楼层
:global ddnsip [/ip address get [/ip address find dynamic=yes interface=pppoe-out ] address ];
:global ddnsnip [:pick $ddnsip 0 [:find $ddnsip "/" ] ] ;
:if ($ddnsnip !=[:resolve "xxxx.25u.com"] ) do={:log info [/tool dns-update name=xxxx.25u.com address=$ddnsnip key-name=xxxxx key=xxxxx ] ;};
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-6 07:56 , Processed in 0.070658 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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