|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
×
我做了ros三线NTH负载,试用过,第一次的时候用迅雷测试有效果,但用一会儿之后就不行了,现在只有两条线有效果,第一条没反应,我只用了一个用户测试,是拨号上网的,请问是不是有什么问题呢?下面是我用的脚本:
1.普通脚本设置
/ ip address
add address=A1IP interface=ADSL1 comment="1" disabled=no
add address=A2IP interface=ADSL2 comment="2" disabled=no
add address=A3IP interface=ADSL1 comment="3" disabled=no
/ ip route
add dst-address=0.0.0.0/0 gateway=A1网关 routing-mark=1 comment="1"
add dst-address=0.0.0.0/0 gateway=A2网关 routing-mark=2 comment="2"
add dst-address=0.0.0.0/0 gateway=A3网关 routing-mark=3 comment="3
2.添加NAT,NTH脚本(如果内网是拨号的,就把in-interface=Lan改为Src.Address=填你的IP-pool)
/ ip firewall mangle
add chain=prerouting in-interface=Lan protocol=tcp connection-state=new nth=2,1,0 action=mark-connection \
new-connection-mark=1 passthrough=yes comment="A1 NTH" disabled=no
add chain=prerouting in-interface= Lan protocol=tcp connection-mark=1 action=mark-routing new-routing-mark=1 \
passthrough=no comment="A1 NTH" disabled=no
add chain=prerouting in-interface= Lan protocol=tcp connection-state=new nth=2,1,1 action=mark-connection \
new-connection-mark=2 passthrough=yes comment="A2 NTH" disabled=no
add chain=prerouting in-interface= Lan protocol=tcp connection-mark=2 action=mark-routing new-routing-mark=2 \
passthrough=no comment="A2 NTH" disabled=no
add chain=prerouting in-interface= Lan protocol=tcp connection-state=new nth=2,1,2 action=mark-connection \
new-connection-mark=3 passthrough=yes comment="A3 NTH" disabled=no
add chain=prerouting in-interface= Lan protocol=tcp connection-mark=3 action=mark-routing new-routing-mark=3 \
passthrough=no comment="A3 NTH" disabled=no
3.添加NAT规则
/ ip firewall nat
add chain=srcnat connection-mark=1 action=src-nat to-addresses=A1IP to-ports=0-65535 comment="1" disabled=no
add chain=srcnat connection-mark=2 action=src-nat to-addresses=A2IP to-ports=0-65535 comment="2" disabled=no
add chain=srcnat connection-mark=3 action=src-nat to-addresses=A3IP to-ports=0-65535 comment="3" disabled=no
4.同步NAT,ADSL动态IP,网关脚本(30S运行一次)
:local assign-address
:local new-address
:local status
:local x
:set x 3
:for i from=1 to=$x do={
:set status [/interface get [/interface find name=("ADSL" . $i)] running]
:if ($status=true) do={
:set new-address [/ip address get [/ip address find dynamic=yes interface=("ADSL" . $i)] address]
:set new-address [:pick $new-address 0 ([:len $new-address] -3)]
:set assign-address [/ip address get [/ip address find dynamic=no interface=("ADSL" . $i)] address]
:set assign-address [:pick $assign-address 0 ([:len $assign-address] -3)]
:set new-gateway [/ip address get [/ip address find dynamic=yes interface=("ADSL" . $i)] network]
:set adckip [/tool netwatch get [/tool netwatch find comment=$i] host]
:if ($assign-address != $new-address) do={ /ip address set [/ip address find comment=$i] address=$new-address network=$new-address broadcast=$new-address
/ip route set [/ip route find comment=$i] gateway=$new-gateway]
/ip firewall nat set [/ip firewall nat find comment=$i] to-addresses=$new-address
/ip route set [/ip route find comment=$i] gateway=$new-gateway]
}
:if ($new-gateway != $adckip) do={/tool netwatch set [/tool netwatch find comment=$i] host=$new-gateway]
}
}
} |
|