|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
大家看是不是原创,有需要的再上传脚本配置,多条adsl线路NTH均衡简直就是无法正常使用,如果用户都用单线程下载的话,全网就出问题了,本人ros同时在线人数70多
/ ip address
add address=218.17.37.44/32 network=218.17.37.44 broadcast=218.17.37.44 \
interface=pppoe-out5 comment="5" disabled=no
add address=58.61.132.212/32 network=58.61.132.212 broadcast=58.61.132.212 \
interface=pppoe-out1 comment="1" disabled=no
add address=58.61.132.210/32 network=58.61.132.210 broadcast=58.61.132.210 \
interface=pppoe-out3 comment="3" disabled=no
add address=58.61.62.231/32 network=58.61.62.231 broadcast=58.61.62.231 \
interface=pppoe-out2 comment="2" disabled=no
add address=58.61.63.251/32 network=58.61.63.251 broadcast=58.61.63.251 \
interface=pppoe-out4 comment="4" disabled=no
/ ip firewall mangle
add chain=prerouting src-address=192.168.10.3-192.168.10.20 \
action=mark-routing new-routing-mark=1 passthrough=yes comment="1" \
disabled=no
add chain=prerouting src-address=192.168.10.21-192.168.10.41 \
action=mark-routing new-routing-mark=2 passthrough=yes comment="2" \
disabled=no
add chain=prerouting src-address=192.168.10.42-192.168.10.65 \
action=mark-routing new-routing-mark=3 passthrough=yes comment="3" \
disabled=no
add chain=prerouting src-address=192.168.10.66-192.168.10.95 \
action=mark-routing new-routing-mark=4 passthrough=yes comment="4" \
disabled=no
add chain=prerouting src-address=192.168.10.96-192.168.10.120 \
action=mark-routing new-routing-mark=5 passthrough=yes comment="5" \
disabled=no
/ interface pppoe-client
add name="pppoe-out5" max-mtu=1480 max-mru=1480 interface=5wan \
user="" password="" profile=default \
service-name="" ac-name="" add-default-route=yes dial-on-demand=no \
use-peer-dns=no allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out4" max-mtu=1480 max-mru=1480 interface=4wan \
user="" password="" profile=default service-name="" \
ac-name="" add-default-route=yes dial-on-demand=no use-peer-dns=no \
allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out2" max-mtu=1480 max-mru=1480 interface=2wan \
user="" password="" profile=default \
service-name="" ac-name="" add-default-route=yes dial-on-demand=no \
use-peer-dns=no allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out1" max-mtu=1480 max-mru=1480 interface=1wan \
user="" password="" profile=default \
service-name="" ac-name="" add-default-route=yes dial-on-demand=no \
use-peer-dns=no allow=pap,chap,mschap1,mschap2 disabled=no
add name="pppoe-out3" max-mtu=1480 max-mru=1480 interface=3wan \
user="" password="" profile=default \
service-name="" ac-name="" add-default-route=yes dial-on-demand=no \
use-peer-dns=no allow=pap,chap,mschap1,mschap2 disabled=no
/ queue type
add name="adsl_1" kind=pcq pcq-rate=2200000 pcq-limit=50 \
pcq-classifier=dst-address pcq-total-limit=2000
add name="adsl_2" kind=pcq pcq-rate=2200000 pcq-limit=50 \
pcq-classifier=dst-address pcq-total-limit=2000
add name="adsl_3" kind=pcq pcq-rate=2200000 pcq-limit=50 \
pcq-classifier=dst-address pcq-total-limit=2000
add name="adsl_4" kind=pcq pcq-rate=816613 pcq-limit=50 \
pcq-classifier=dst-address pcq-total-limit=2000
add name="adsl_5" kind=pcq pcq-rate=2200000 pcq-limit=50 \
pcq-classifier=dst-address pcq-total-limit=2000
add name="default-small" kind=pfifo pfifo-limit=10
/ ip route
add dst-address=0.0.0.0/0 gateway=58.61.132.212 scope=255 target-scope=10 \
routing-mark=1 comment="1" disabled=no
add dst-address=0.0.0.0/0 gateway=58.61.62.231 scope=255 target-scope=10 \
routing-mark=2 comment="2" disabled=no
add dst-address=0.0.0.0/0 gateway=58.61.132.210 scope=255 target-scope=10 \
routing-mark=3 comment="3" disabled=no
add dst-address=0.0.0.0/0 gateway=58.61.63.251 scope=255 target-scope=10 \
routing-mark=4 comment="4" disabled=no
add dst-address=0.0.0.0/0 gateway=218.17.37.44 scope=255 target-scope=10 \
routing-mark=5 comment="5" disabled=no
/ system scheduler
add name="gateway" on-event=":local assign-address
\n:local \
new-address
\n:local status
\n:local x
\n:set x 5
\n:for i from=1 to=\$x \
do={
\n :set status \[/interface get \[/interface find \
name=(\"pppoe-out\" . \$i)\] running\]
\n :if (\$status=true) do={
\n \
:set new-address \[/ip address get \[/ip address find dynamic=yes \
interface=(\"pppoe-out\" . \$i)\] address\]
\n :set new-address \
\[:pick \$new-address 0 (\[:len \$new-address\] -3)\]
\n :set \
assign-address \[/ip address get \[/ip address find dynamic=no \
interface=(\"pppoe-out\" . \$i)\] address\]
\n :set assign-address \
\[:pick \$assign-address 0 (\[:len \$assign-address\] -3)\]
\n :if \
(\$assign-address != \$new-address) do={ /ip address set \[/ip address \
find comment=\$i\] address=\$new-address network=\$new-address \
broadcast=\$new-address
\n /ip route set \[/ip route find \
comment=\$i\] gateway=\$new-address
\n }
\n }
\n}
\n" \
start-date=jan/01/1970 start-time=00:00:00 interval=30s comment="" \
disabled=no
add name="dns_flush_adsl_down" on-event="/ip dns cache flush
\n/inter \
pppoe-client set \[/inter pppoe-client find name=\"pppoe-out1\"\] \
disabled=no
\n/inter pppoe-client set \[/inter pppoe-client find \
name=\"pppoe-out2\"\] disabled=no
\n/inter pppoe-client set \[/inter \
pppoe-client find name=\"pppoe-out3\"\] disabled=no
\n/inter pppoe-client \
set \[/inter pppoe-client find name=\"pppoe-out4\"\] disabled=no
\n/inter \
pppoe-client set \[/inter pppoe-client find name=\"pppoe-out5\"\] \
disabled=no" start-date=jan/01/1970 start-time=06:00:00 interval=1d \
comment="" disabled=no
add name="queue_adsl_1" on-event=":local RxCurRate 0
\n:local RxCurSet \
0
\n:local RxResRate 0
\n:local RxMaxRate 0
\n:local RxStepRate \
0
\n
\ninterface monitor pppoe-out1 once do={:set RxCurRate \
\$received-bits-per-second}
\n:set RxCurSet \[/queue type get \[/queue \
type find name=\"adsl_1\"\] pcq-rate\]
\n:set RxResRate 320000
\n:set \
RxMaxRate 2200000
\n:set RxRangRate \
100000
\n
\n:if(\$RxCurRate<(\$RxMaxRate+-\$RxResRate+-\$RxRangRate)&&\$RxC\
urSet<\$RxMaxRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet>\$R\
xMaxRate) do={:set RxCurSet \$RxMaxRate}
\n/queue type set \"adsl_1\" \
kind=pcq pcq-rate=\$RxCurSet \
pcq-classifier=dst-address
\n}
\n
\n:if(\$RxCurRate>(\$RxMaxRate+-\$RxResRa\
te+\$RxRangRate)&&\$RxCurSet>\$RxResRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet<\$R\
xResRate) do={:set RxCurSet \$RxResRate}
\n/queue type set \"adsl_1\" \
kind=pcq pcq-rate=\$RxCurSet pcq-classifier=dst-address
\n}
\n" \
start-date=jan/01/1970 start-time=00:00:00 interval=10s \
comment="queue_adsl_1" disabled=no
add name="queue_adsl_2" on-event=":local RxCurRate 0
\n:local RxCurSet \
0
\n:local RxResRate 0
\n:local RxMaxRate 0
\n:local RxStepRate \
0
\n
\ninterface monitor pppoe-out2 once do={:set RxCurRate \
\$received-bits-per-second}
\n:set RxCurSet \[/queue type get \[/queue \
type find name=\"adsl_2\"\] pcq-rate\]
\n:set RxResRate 320000
\n:set \
RxMaxRate 2200000
\n:set RxRangRate \
100000
\n
\n:if(\$RxCurRate<(\$RxMaxRate+-\$RxResRate+-\$RxRangRate)&&\$RxC\
urSet<\$RxMaxRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet>\$R\
xMaxRate) do={:set RxCurSet \$RxMaxRate}
\n/queue type set \"adsl_2\" \
kind=pcq pcq-rate=\$RxCurSet \
pcq-classifier=dst-address
\n}
\n
\n:if(\$RxCurRate>(\$RxMaxRate+-\$RxResRa\
te+\$RxRangRate)&&\$RxCurSet>\$RxResRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet<\$R\
xResRate) do={:set RxCurSet \$RxResRate}
\n/queue type set \"adsl_2\" \
kind=pcq pcq-rate=\$RxCurSet pcq-classifier=dst-address
\n}
\n" \
start-date=jan/01/1970 start-time=00:00:00 interval=10s \
comment="queue_adsl_2" disabled=no
add name="queue_adsl_3" on-event=":local RxCurRate 0
\n:local RxCurSet \
0
\n:local RxResRate 0
\n:local RxMaxRate 0
\n:local RxStepRate \
0
\n
\ninterface monitor pppoe-out3 once do={:set RxCurRate \
\$received-bits-per-second}
\n:set RxCurSet \[/queue type get \[/queue \
type find name=\"adsl_3\"\] pcq-rate\]
\n:set RxResRate 320000
\n:set \
RxMaxRate 2200000
\n:set RxRangRate \
100000
\n
\n:if(\$RxCurRate<(\$RxMaxRate+-\$RxResRate+-\$RxRangRate)&&\$RxC\
urSet<\$RxMaxRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet>\$R\
xMaxRate) do={:set RxCurSet \$RxMaxRate}
\n/queue type set \"adsl_3\" \
kind=pcq pcq-rate=\$RxCurSet \
pcq-classifier=dst-address
\n}
\n
\n:if(\$RxCurRate>(\$RxMaxRate+-\$RxResRa\
te+\$RxRangRate)&&\$RxCurSet>\$RxResRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet<\$R\
xResRate) do={:set RxCurSet \$RxResRate}
\n/queue type set \"adsl_3\" \
kind=pcq pcq-rate=\$RxCurSet pcq-classifier=dst-address
\n}
\n" \
start-date=jan/01/1970 start-time=00:00:00 interval=10s \
comment="queue_adsl_3" disabled=no
add name="queue_adsl_4" on-event=":local RxCurRate 0
\n:local RxCurSet \
0
\n:local RxResRate 0
\n:local RxMaxRate 0
\n:local RxStepRate \
0
\n
\ninterface monitor pppoe-out4 once do={:set RxCurRate \
\$received-bits-per-second}
\n:set RxCurSet \[/queue type get \[/queue \
type find name=\"adsl_4\"\] pcq-rate\]
\n:set RxResRate 320000
\n:set \
RxMaxRate 2200000
\n:set RxRangRate \
100000
\n
\n:if(\$RxCurRate<(\$RxMaxRate+-\$RxResRate+-\$RxRangRate)&&\$RxC\
urSet<\$RxMaxRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet>\$R\
xMaxRate) do={:set RxCurSet \$RxMaxRate}
\n/queue type set \"adsl_4\" \
kind=pcq pcq-rate=\$RxCurSet \
pcq-classifier=dst-address
\n}
\n
\n:if(\$RxCurRate>(\$RxMaxRate+-\$RxResRa\
te+\$RxRangRate)&&\$RxCurSet>\$RxResRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet<\$R\
xResRate) do={:set RxCurSet \$RxResRate}
\n/queue type set \"adsl_4\" \
kind=pcq pcq-rate=\$RxCurSet pcq-classifier=dst-address
\n}
\n" \
start-date=jan/01/1970 start-time=00:00:00 interval=10s \
comment="queue_adsl_4" disabled=no
add name="queue_adsl_5" on-event=":local RxCurRate 0
\n:local RxCurSet \
0
\n:local RxResRate 0
\n:local RxMaxRate 0
\n:local RxStepRate \
0
\n
\ninterface monitor pppoe-out5 once do={:set RxCurRate \
\$received-bits-per-second}
\n:set RxCurSet \[/queue type get \[/queue \
type find name=\"adsl_5\"\] pcq-rate\]
\n:set RxResRate 320000
\n:set \
RxMaxRate 2200000
\n:set RxRangRate \
100000
\n
\n:if(\$RxCurRate<(\$RxMaxRate+-\$RxResRate+-\$RxRangRate)&&\$RxC\
urSet<\$RxMaxRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet>\$R\
xMaxRate) do={:set RxCurSet \$RxMaxRate}
\n/queue type set \"adsl_5\" \
kind=pcq pcq-rate=\$RxCurSet \
pcq-classifier=dst-address
\n}
\n
\n:if(\$RxCurRate>(\$RxMaxRate+-\$RxResRa\
te+\$RxRangRate)&&\$RxCurSet>\$RxResRate) do={
\n:set RxCurSet \
(\$RxCurSet+(\$RxMaxRate+-\$RxResRate+-\$RxCurRate)/2)
\n:if(\$RxCurSet<\$R\
xResRate) do={:set RxCurSet \$RxResRate}
\n/queue type set \"adsl_5\" \
kind=pcq pcq-rate=\$RxCurSet pcq-classifier=dst-address
\n}
\n" \
start-date=jan/01/1970 start-time=00:00:00 interval=10s \
comment="queue_adsl_5" disabled=no
add name="pppoe-out_down_1-2" on-event=":if (\[/in pppoe-c get \[find \
name=pppoe-out1\] running\]=false) do {
\n:global adsl \
\"pppoe-out2\"
\n:global new-ip \[ /ip address get \[/ip address find \
broa=0.0.0.0 int=\$adsl\] network \]
\n:global old-ip \[ /ip route get \
\[/ip route find comm=\"1\"\] gateway \]
\n:if (\$new-ip != \$old-ip) \
do={
\n :log info \[/ip route set \[/ip route find comm=\"1\"\] \
gateway=\$new-ip\]
\n }
\n}
\n" start-date=jan/01/1970 \
start-time=00:00:00 interval=30s comment="" disabled=no
add name="pppoe-out_down_2-1" on-event=":if (\[/in pppoe-c get \[find \
name=pppoe-out2\] running\]=false) do {
\n:global adsl \
\"pppoe-out1\"
\n:global new-ip \[ /ip address get \[/ip address find \
broa=0.0.0.0 int=\$adsl\] network \]
\n:global old-ip \[ /ip route get \
\[/ip route find comm=\"2\"\] gateway \]
\n:if (\$new-ip != \$old-ip) \
do={
\n :log info \[/ip route set \[/ip route find comm=\"2\"\] \
gateway=\$new-ip\]
\n }
\n}
\n" start-date=jan/01/1970 \
start-time=00:00:00 interval=30s comment="" disabled=no
add name="pppoe-out_down_3-4" on-event=":if (\[/in pppoe-c get \[find \
name=pppoe-out3\] running\]=false) do {
\n:global adsl \
\"pppoe-out4\"
\n:global new-ip \[ /ip address get \[/ip address find \
broa=0.0.0.0 int=\$adsl\] network \]
\n:global old-ip \[ /ip route get \
\[/ip route find comm=\"3\"\] gateway \]
\n:if (\$new-ip != \$old-ip) \
do={
\n :log info \[/ip route set \[/ip route find comm=\"3\"\] \
gateway=\$new-ip\]
\n }
\n}
\n" start-date=jan/01/1970 \
start-time=00:00:00 interval=30s comment="" disabled=no
add name="pppoe-out_down_4-3" on-event=":if (\[/in pppoe-c get \[find \
name=pppoe-out4\] running\]=false) do {
\n:global adsl \
\"pppoe-out3\"
\n:global new-ip \[ /ip address get \[/ip address find \
broa=0.0.0.0 int=\$adsl\] network \]
\n:global old-ip \[ /ip route get \
\[/ip route find comm=\"4\"\] gateway \]
\n:if (\$new-ip != \$old-ip) \
do={
\n :log info \[/ip route set \[/ip route find comm=\"4\"\] \
gateway=\$new-ip\]
\n }
\n}
\n" start-date=jan/01/1970 \
start-time=00:00:00 interval=30s comment="" disabled=no
add name="pppoe-out_down_5-4" on-event=":if (\[/in pppoe-c get \[find \
name=pppoe-out5\] running\]=false) do {
\n:global adsl \
\"pppoe-out4\"
\n:global new-ip \[ /ip address get \[/ip address find \
broa=0.0.0.0 int=\$adsl\] network \]
\n:global old-ip \[ /ip route get \
\[/ip route find comm=\"5\"\] gateway \]
\n:if (\$new-ip != \$old-ip) \
do={
\n :log info \[/ip route set \[/ip route find comm=\"5\"\] \
gateway=\$new-ip\]
\n }
\n}
\n" start-date=jan/01/1970 \
start-time=00:00:00 interval=30s comment="" disabled=no
/ system script
add name="adsl_1_down" source="/queue type set \"adsl_1\" kind=pcq \
pcq-rate=320000
\n/system scheduler set \[/system scheduler find \
name=\"queue_adsl_1\"\] disabled=yes" \
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adsl_2_down" source="/queue type set \"adsl_2\" kind=pcq \
pcq-rate=320000
\n/system scheduler set \[/system scheduler find \
name=\"queue_adsl_2\"\] disabled=yes" \
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adsl_3_down" source="/queue type set \"adsl_3\" kind=pcq \
pcq-rate=320000
\n/system scheduler set \[/system scheduler find \
name=\"queue_adsl_3\"\] disabled=yes" \
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adsl_4_down" source="/queue type set \"adsl_4\" kind=pcq \
pcq-rate=320000
\n/system scheduler set \[/system scheduler find \
name=\"queue_adsl_4\"\] disabled=yes" \
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adsl_5_down" source="/queue type set \"adsl_5\" kind=pcq \
pcq-rate=320000
\n/system scheduler set \[/system scheduler find \
name=\"queue_adsl_5\"\] disabled=yes" \
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adsl_1_up" source="/system scheduler set \[/system scheduler find \
name=\"queue_adsl_1\"\] disabled=no" \
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adsl_2_up" source="/system scheduler set \[/system scheduler find \
name=\"queue_adsl_2\"\] disabled=no" \
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adsl_3_up" source="/system scheduler set \[/system scheduler find \
name=\"queue_adsl_3\"\] disabled=no" \
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adsl_4_up" source="/system scheduler set \[/system scheduler find \
name=\"queue_adsl_4\"\] disabled=no" \
policy=ftp,reboot,read,write,policy,test,winbox,password
add name="adsl_5_up" source="/system scheduler set \[/system scheduler find \
name=\"queue_adsl_5\"\] disabled=no" \
policy=ftp,reboot,read,write,policy,test,winbox,password
/ tool traffic-monitor
add name="adsl_5_down" interface=5wan traffic=received trigger=below \
threshold=1 on-event=adsl_5_down comment="" disabled=no
add name="adsl_4_down" interface=4wan traffic=received trigger=below \
threshold=1 on-event=adsl_4_down comment="" disabled=no
add name="adsl_1_down" interface=1wan traffic=received trigger=below \
threshold=1 on-event=adsl_1_down comment="" disabled=no
add name="adsl_3_down" interface=3wan traffic=received trigger=below \
threshold=1 on-event=adsl_3_down comment="" disabled=no
add name="adsl_2_down" interface=2wan traffic=received trigger=below \
threshold=1 on-event=adsl_2_down comment="" disabled=no
add name="adsl_1_up" interface=1wan traffic=received trigger=above \
threshold=1000 on-event=adsl_1_up comment="" disabled=no
add name="adsl_2_up" interface=2wan traffic=received trigger=above \
threshold=1000 on-event=adsl_2_up comment="" disabled=no
add name="adsl_3_up" interface=3wan traffic=received trigger=above \
threshold=1000 on-event=adsl_3_up comment="" disabled=no
add name="adsl_4_up" interface=4wan traffic=received trigger=above \
threshold=1000 on-event=adsl_4_up comment="" disabled=no
add name="adsl_5_up" interface=5wan traffic=received trigger=above \
threshold=1000 on-event=adsl_5_up comment="" disabled=no
[ 本帖最后由 WGHBOY 于 2008-12-4 18:14 编辑 ] |
|