找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3850|回复: 3

[脚本] 2.9.27 的脚本 3.22部分不能用(应该怎么改?)

[复制链接]
发表于 2010-3-12 22:31:45 | 显示全部楼层 |阅读模式

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

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

×
我的现象是 这个脚本没有效果
:local assign-address
:local new-address
:local status
:local x
:set x 2
:for i from=1 to=$x do={
:set status [/interface get [/interface find  name=("pppoe-out" . $i)] running]
:if ($status=true) do={
:set new-address [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address]
:set new-address [:pick $new-address 0 [:find $new-address "/"]]
:set assign-address [/ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]
:set assign-address [:pick $assign-address 0 [:find $assign-address "/"]]
:if ($assign-address != $new-address) do={
/ip address set [/ip address find comment=("pppoe-out" . $i)] address=$new-address network=$new-address broadcast=$new-address
/ip route set [/ip route find comment=("pppoe-out" . $i)] gateway=$new-address
/ip fir nat set[/ip fir nat find comment=("pppoe-out" . $i)] to-address=$new-address
}
}
}
routeros
发表于 2010-3-12 23:37:39 | 显示全部楼层
:local newaddress
:local status
:local x
:set x 3
:for i from=1 to=$x do={
    :set status [/interface get [/interface find  name=("pppoe-out" . $i)] running]
    :if ($status=true) do={
     :set newaddress [/ip address get [/ip address find dynamic=yes interface=("pppoe-out" . $i)] address]
     :set newaddress [:pick $newaddress 0 ([:len $newaddress] -3)]
     :set assignip [/ip address get [/ip address find dynamic=no interface=("pppoe-out" . $i)] address]
     :set assignip [:pick $assignip 0 ([:len $assignip] -3)]
        :if ($assignip != $newaddress) do={ /ip address set [/ip address find comment=$i] address=$newaddress network=$newaddress broadcast=$newaddress
        /ip route set [/ip route find comment=$i] gateway=$newaddress
        /ip fir nat set [/ip fir nat find comment=$i] to-addresses=$newaddress
        /ip route set [/ip route find comment=$i] gateway=$newaddress
       }
   }
}




:for i from=1 to=$x do={:set status [/interface get [/interface find name=("pppoe-out" . $i)] running ]}
routeros
回复

使用道具 举报

发表于 2010-3-13 08:14:44 | 显示全部楼层
拿分走人
routeros
回复

使用道具 举报

 楼主| 发表于 2010-3-13 13:53:45 | 显示全部楼层
2楼的朋友。可不可以说出毛病出在哪?
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-12-26 22:27 , Processed in 0.066634 second(s), 14 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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