找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4430|回复: 4

[脚本] 大家帮我看下动态IP更新脚本

[复制链接]
发表于 2007-9-7 00:13:16 | 显示全部楼层 |阅读模式

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

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

×
本人做了双ADSL

同网关双线ADSL天天会自动更换一次IP所以很麻烦如果有脚本一定时间后检测地址列表里不在线的IP从列表里删除,那就方便多了
所以大家帮我看看下面的这个脚本是否可以实现谢谢!!
:local ip1 [/ip add get [/ip add find broa=0.0.0.0 interface="你想要的名字1"] address]
:local ip2 [/ip add get [/ip add find broa=0.0.0.0 interface="你想要的名字2"] address]
:local ip3 [/ip add get [/ip add find comment= "你想要的名字1"] network]
:local ip4 [/ip add get [/ip add find comment= "你想要的名字2"] network]
:set ip1 [:pick $ip1 0 ([:len $ip1]-3)]
:set ip2 [:pick $ip2 0 ([:len $ip2]-3)]
:if $ip1 != $ip3 do={/ip add set [/ip add find comment="你想要的名字1"] address ($ip1 . "/32") broa $ip1 network $ip1}
:if $ip2 != $ip4 do={/ip add set [/ip add find comment="你想要的名字2"] address ($ip2 . "/32") broa $ip1 network $ip1}
routeros
发表于 2007-9-7 01:03:28 | 显示全部楼层
这个像是不行的吧我上次写过一个和你一样的只能运行一下吧
routeros
回复

使用道具 举报

发表于 2007-9-7 01:13:09 | 显示全部楼层
:local ip1
:local ip2
:local x
:set x 10
:for i from=1 to=$x do={
     :set ip1 [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address]
     :set ip1 [:pick $ip1 0 [:find $ip1 "/"]]
     :set ip2 [/ip route get [/ip route find comment=("adsl" . $i)] gateway]
     :if (($ip1 != $ip2) && ([:len $ip1] != 0)) do={
      /ip address set [/ip address find comment=("adsl" . $i)] address=$ip1 network=$ip1 broadcast=$ip1
      /ip route set [/ip route find comment=("adsl" . $i)] gateway=$ip1
     :log info ("change " . ("pppoe-out" . $i) . " gatewaye to " . $ip1 . "ok")
}
}
嗯..前辈的心血,给你参考一下
routeros
回复

使用道具 举报

 楼主| 发表于 2007-9-10 00:39:14 | 显示全部楼层

非常感激11!!

routeros
回复

使用道具 举报

发表于 2007-11-4 11:49:52 | 显示全部楼层
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-28 11:22 , Processed in 0.057547 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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