goodluck12 发表于 2008-10-13 11:49:08

四线ADSL nth负载均衡 断线 掉线调整 报警脚本 多线ADSL可修改

:global ip
:global gateold
:global address
:global adsl1-statu
:if ($adsl1-statu) do={
:set ip address]
:set address [:pick $ip 0 ([:len $ip] -3)]
:log info ($address)
:set gateold gateway]
    :if ($gateold!=$address) do={
    /ip add set address=$address network=$address broadcast=$address
    /ip route set gateway=$address
    /ip fir nat set to-addresses=$address
    }
}
:global adsl2-statu
:if ($adsl2-statu) do={
:set ip address]
:set address [:pick $ip 0 ([:len $ip] -3)]
:log info ($address)
:set gateold gateway]
    :if ($gateold!=$address) do={
    /ip add set address=$address network=$address broadcast=$address
    /ip route set gateway=$address
    /ip fir nat set to-addresses=$address
    }
}
:global adsl3-statu
:if ($adsl3-statu) do={
:set ip address]
:set address [:pick $ip 0 ([:len $ip] -3)]
:log info ($address)
:set gateold gateway]
    :if ($gateold!=$address) do={
    /ip add set address=$address network=$address broadcast=$address
    /ip route set gateway=$address
   /ip fir nat set to-addresses=$address
    }
}
:global adsl4-statu
:if ($adsl4-statu) do={
:set ip address]
:set address [:pick $ip 0 ([:len $ip] -3)]
:log info ($address)
:set gateold gateway]
    :if ($gateold!=$address) do={
    /ip add set address=$address network=$address broadcast=$address
    /ip route set gateway=$address
    /ip fir nat set to-addresses=$address
    }
}
:if (($adsl1-statu)&&($adsl2-statu)&&($adsl3-statu)&&($adsl4-statu)) do={
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( nth]!=3,4,0) do={/ip fi man set nth=3,4,0}
:if ( nth]!=3,4,1) do={/ip fi man set nth=3,4,1}
:if ( nth]!=3,4,2) do={/ip fi man set nth=3,4,2}
:if ( nth]!=3,4,3) do={/ip fi man set nth=3,4,3}
:beep length=100ms frequency=1755
}
:if ((!$adsl1-statu)&&($adsl2-statu)&&($adsl3-statu)&&($adsl4-statu)) do={
:if ( new-connection-mark]!=2) do={/ip fi man set new-connection-mark=2}
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
#:if ( nth]!=3,4,0) do={/ip fi man set nth=3,4,0}
:if ( nth]!=2,3,0) do={/ip fi man set nth=2,3,0}
:if ( nth]!=2,3,1) do={/ip fi man set nth=2,3,1}
:if ( nth]!=2,3,2) do={/ip fi man set nth=2,3,2}
:beep length=100ms frequency=1755
}
:if (($adsl1-statu)&&(!$adsl2-statu)&&($adsl3-statu)&&($adsl4-statu)) do={
:if ( new-connection-mark]!=1) do={/ip fi man set new-connection-mark=1}
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( nth]!=2,3,0) do={/ip fi man set nth=2,3,0}
#:if ( nth]!=3,4,1) do={/ip fi man set nth=3,4,1}
:if ( nth]!=2,3,1) do={/ip fi man set nth=2,3,1}
:if ( nth]!=2,3,2) do={/ip fi man set nth=2,3,2}
:beep length=100ms frequency=1755
}
:if (($adsl1-statu)&&($adsl2-statu)&&(!$adsl3-statu)&&($adsl4-statu)) do={
:if ( new-connection-mark]!=1) do={/ip fi man set new-connection-mark=1}
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=yes) do={/ip fi man en }
:if ( nth]!=2,3,0) do={/ip fi man set nth=2,3,0}
:if ( nth]!=2,3,1) do={/ip fi man set nth=2,3,1}
#:if ( nth]!=3,4,2) do={/ip fi man set nth=3,4,2}
:if ( nth]!=2,3,2) do={/ip fi man set nth=2,3,2}
:beep length=100ms frequency=1755
}
:if (($adsl1-statu)&&($adsl2-statu)&&($adsl3-statu)&&(!$adsl4-statu)) do={
:if ( new-connection-mark]!=1) do={/ip fi man set new-connection-mark=1}
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=no) do={/ip fi man dis }
:if ( nth]!=2,3,0) do={/ip fi man set nth=2,3,0}
:if ( nth]!=2,3,1) do={/ip fi man set nth=2,3,1}
:if ( nth]!=2,3,2) do={/ip fi man set nth=2,3,2}
#:if ( nth]!=3,4,3) do={/ip fi man set nth=3,4,3}
:beep length=100ms frequency=1755
}
:if ((!$adsl1-statu)&&(!$adsl2-statu)&&($adsl3-statu)&&($adsl4-statu)) do={
:if ( new-connection-mark]!=3) do={/ip fi man set new-connection-mark=3}
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
#:if ( nth]!=3,4,0) do={/ip fi man set nth=3,4,0}
#:if ( nth]!=3,4,1) do={/ip fi man set nth=3,4,1}
:if ( nth]!=1,2,0) do={/ip fi man set nth=1,2,0}
:if ( nth]!=1,2,1) do={/ip fi man set nth=1,2,1}
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
}
:if (($adsl1-statu)&&(!$adsl2-statu)&&(!$adsl3-statu)&&($adsl4-statu)) do={
:if ( new-connection-mark]!=1) do={/ip fi man set new-connection-mark=1}
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=yes) do={/ip fi man en }
:if ( nth]!=1,2,0) do={/ip fi man set nth=1,2,0}
#:if ( nth]!=3,4,1) do={/ip fi man set nth=3,4,1}
#:if ( nth]!=1,2,0) do={/ip fi man set nth=1,2,0}
:if ( nth]!=1,2,1) do={/ip fi man set nth=1,2,1}
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
}
:if (($adsl1-statu)&&($adsl2-statu)&&(!$adsl3-statu)&&(!$adsl4-statu)) do={
:if ( new-connection-mark]!=1) do={/ip fi man set new-connection-mark=1}
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( nth]!=1,2,0) do={/ip fi man set nth=1,2,0}
:if ( nth]!=1,2,1) do={/ip fi man set nth=1,2,1}
#:if ( nth]!=3,4,2) do={/ip fi man set nth=3,4,2}
#:if ( nth]!=3,4,3) do={/ip fi man set nth=3,4,3}
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
}
:if ((!$adsl1-statu)&&($adsl2-statu)&&($adsl3-statu)&&(!$adsl4-statu)) do={
:if ( new-connection-mark]!=2) do={/ip fi man set new-connection-mark=2}
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=no) do={/ip fi man dis }
#:if ( nth]!=3,4,0) do={/ip fi man set nth=3,4,0}
:if ( nth]!=1,2,0) do={/ip fi man set nth=1,2,0}
:if ( nth]!=1,2,1) do={/ip fi man set nth=1,2,1}
#:if ( nth]!=3,4,3) do={/ip fi man set nth=3,4,3}
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
}
:if ((!$adsl1-statu)&&(!$adsl2-statu)&&(!$adsl3-statu)&&($adsl4-statu)) do={
:if ( new-connection-mark]!=4) do={/ip fi man set new-connection-mark=4}
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=yes) do={/ip fi man en }
#:if ( nth]!=3,4,0) do={/ip fi man set nth=3,4,0}
#:if ( nth]!=3,4,1) do={/ip fi man set nth=3,4,1}
#:if ( nth]!=3,4,2) do={/ip fi man set nth=3,4,2}
:if ( nth]!=0,1,0) do={/ip fi man set nth=0,1,0}
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
}
:if (($adsl1-statu)&&(!$adsl2-statu)&&(!$adsl3-statu)&&(!$adsl4-statu)) do={
:if ( new-connection-mark]!=1) do={/ip fi man set new-connection-mark=2}
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( nth]!=0,1,0) do={/ip fi man set nth=0,1,0}
#:if ( nth]!=3,4,1) do={/ip fi man set nth=3,4,1}
#:if ( nth]!=3,4,2) do={/ip fi man set nth=3,4,2}
#:if ( nth]!=3,4,3) do={/ip fi man set nth=3,4,3}
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
}
:if ((!$adsl1-statu)&&($adsl2-statu)&&(!$adsl3-statu)&&(!$adsl4-statu)) do={
:if ( new-connection-mark]!=2) do={/ip fi man set new-connection-mark=2}
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
#:if ( nth]!=3,4,0) do={/ip fi man set nth=3,4,0}
:if ( nth]!=0,1,0) do={/ip fi man set nth=0,1,0}
#:if ( nth]!=3,4,2) do={/ip fi man set nth=3,4,2}
#:if ( nth]!=3,4,3) do={/ip fi man set nth=3,4,3}
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
}
:if ((!$adsl1-statu)&&(!$adsl2-statu)&&($adsl3-statu)&&(!$adsl4-statu)) do={
:if ( new-connection-mark]!=3) do={/ip fi man set new-connection-mark=3}
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=yes) do={/ip fi man en }
:if ( disabled]=no) do={/ip fi man dis }
#:if ( nth]!=3,4,0) do={/ip fi man set nth=3,4,0}
#:if ( nth]!=3,4,1) do={/ip fi man set nth=3,4,1}
:if ( nth]!=0,1,0) do={/ip fi man set nth=0,1,0}
#:if ( nth]!=3,4,3) do={/ip fi man set nth=3,4,3}
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
:delay 500ms
:beep length=100ms frequency=1755
}
:if ((!$adsl1-statu)&&(!$adsl2-statu)&&(!$adsl3-statu)&&(!$adsl4-statu)) do={
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
:if ( disabled]=no) do={/ip fi man dis }
#:if ( nth]!=3,4,0) do={/ip fi man set nth=3,4,0}
#:if ( nth]!=3,4,1) do={/ip fi man set nth=3,4,1}
#:if ( nth]!=0,1,0) do={/ip fi man set nth=0,1,0}
#:if ( nth]!=3,4,3) do={/ip fi man set nth=3,4,3}
:beep length=1s frequency=1755
}

ylml78366 发表于 2008-10-14 13:46:02

楼主是个大好人,顶一下,有人试过没有?

ylml78366 发表于 2008-10-14 13:50:45

楼主应该弄个文字说明在里面,太长了,看不过来,如果配上图,绝对是精华。

wbyz20 发表于 2008-10-14 15:39:58

冗余了

soft_route 发表于 2008-10-14 19:14:37

没测试环境测试呢:D :D :D

jxwlkjsz_001 发表于 2008-10-14 21:01:57

看不懂,LZ请给出说明!

专卖精品 发表于 2008-10-14 23:38:07

看着头晕

hackerii 发表于 2008-10-14 23:54:24

LZ请给出说明

jxwlkjsz_001 发表于 2008-10-15 01:20:14

看懂了,LZ有没有简明点的语言,这样太浪费CPU了

5299 发表于 2008-11-27 14:08:51

看着头晕

LW2008 发表于 2008-11-27 21:27:20

不是通用的,不过能发出来,就不错!

网络-浪子 发表于 2008-11-27 22:38:11

这东西导进去,估计路由器就不用干别的了...

hzy 发表于 2008-11-29 12:30:52

不敢试!

xtwt001 发表于 2008-12-11 16:36:58

楼主,我服了你。

showname 发表于 2008-12-11 16:57:04

真是人才:) 非常不错,很有条理
页: [1] 2 3
查看完整版本: 四线ADSL nth负载均衡 断线 掉线调整 报警脚本 多线ADSL可修改