找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2616|回复: 2

[策略设置] 现有双线切换脚本,有谁可以解释?

[复制链接]
发表于 2007-12-29 10:07:11 | 显示全部楼层 |阅读模式

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

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

×
IP.down脚本:
:if ([/tool netwatch get [/tool netwatch find comment=PPPoE_Check] status]="down") do {/ip route set [/ip route find comment=Default_Route] gateway [/ip address get [/ip address find interface=wan.unicom] network]} else {/ip route set [/ip route find comment=Default_Route] gateway 10.165.1.1}

PPPoE.down脚本:
:if ([/tool netwatch get [/tool netwatch find comment=IP_Check] status]="down") do {/ip route set [/ip route find comment=Default_Route] gateway [/ip address get [/ip address find interface=wan.pppoe.tel] network]} else {/ip route set [/ip route find comment=Default_Route] gateway 220.1.30.193}


请问有谁可以解释一下这个脚本的意思呢?

这样的脚本好像有问题哦。。。。应该第一段是PPPOE.DOWN,第二段是IP.DOWN才对。我觉得。

[ 本帖最后由 yescon 于 2007-12-29 10:49 编辑 ]
routeros
发表于 2007-12-29 10:38:30 | 显示全部楼层
:if ([/tool netwatch get [/tool netwatch find comment=PPPoE_Check] status]="down") do {/ip route set [/ip route find comment=Default_Route] gateway [/ip address get [/ip address find interface=wan.pppoe.tel] network]} else {/ip route set [/ip route find comment=Default_Route] gateway 10.165.1.1}
高手一般就是这样写脚本的

如果检测到备注为PPPoE_Check的netwatch规则状态为down,那么备注为Default_Route的网关规则的网关IP为从网卡名为wan.pppoe.tel所得到的远端IP,否则设置该网关规则的网关IP为10.165.1.1

比较拗口,呵呵
把它拆分开来写,就比较容易看明白
我一般还是分步来写,思路比较清晰一点,代码也比较整齐
routeros
回复

使用道具 举报

 楼主| 发表于 2007-12-29 10:50:25 | 显示全部楼层
再帮忙分析一下,好像有问题。
routeros
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-9 18:52 , Processed in 0.077263 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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