四线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
} 楼主是个大好人,顶一下,有人试过没有? 楼主应该弄个文字说明在里面,太长了,看不过来,如果配上图,绝对是精华。 冗余了 没测试环境测试呢:D :D :D 看不懂,LZ请给出说明! 看着头晕 LZ请给出说明 看懂了,LZ有没有简明点的语言,这样太浪费CPU了 看着头晕 不是通用的,不过能发出来,就不错! 这东西导进去,估计路由器就不用干别的了... 不敢试! 楼主,我服了你。 真是人才:) 非常不错,很有条理