1. 程式人生 > >ros設定單網絡卡撥多100條ADSL 使用vrrp 及pcc負載

ros設定單網絡卡撥多100條ADSL 使用vrrp 及pcc負載

ros設定單網絡卡撥多ADSL 使用vrrp  有些版本有問題,使用5.2破解版本測試成功。

1.建立100個vrrp,並繫結到wan口下
for i from 1 to 100 do={/interface vrrp add comment=("RP".$i) interface=wan interval=1 name=("vrrp".$i)  vrid=$i}

2.修改vrrp 協議

for i from 1 to 100 do={/interface vrrp  set v3-protocol=ipv6  numbers=("vrrp".$i)}

3.建立pppoe,(這裡需要注意你的adsl 使用者和密碼),並繫結到對應的vrrp

for i from 1 to 100 do={/interface pppoe-client add add-default-route=yes allow=pap,chap comment=($i) interface=("vrrp".$i) max-mtu=1480 name=("pppoe-out".$i) user=$i password=$i }

設定pppoe 的為取消預設路由
for i from 0 to 99 do={/interface pppoe-client  set numbers=$i add-default-route=no }

設定PCC負載均衡(原來的PPPOE需要取消預設路由,後邊收到設定路由)

1.設定NAT

for i from 1 to 100 do={/ip firewall nat add chain=srcnat action=masquerade out-interface=("pppoe-out".$i) comment=("pppoe".$i)}

2.設定input

for i from 1 to 100 do={/ip firewall mangle add chain=input action=mark-connection new-connection-mark=("pppoe-out".$i."_conn")  passthrough=yes in-interface=("pppoe-out".$i)  comment=("input".$i)}

3.設定output

for i from 1 to 100 do={/ip firewall mangle add chain=output action=mark-routing new-routing-mark=("to_pppoe_out".$i) passthrough=yes connection-mark=("pppoe-out".$i."_conn") comment=("output".$i)}

4.設定連線標記

for i from 6 to 100 do={/ip firewall mangle add  chain=prerouting action=mark-connection new-connection-mark=("pppoe-out".$i."_conn") passthrough=yes src-address=10.0.0.0/8 dst-address-type=!local in-interface=ether1-lan per-connection-classifier=("both-addresses:100/".$i-1) comment=("pcc".$i)}

5.設定路由標記

for i from 6 to 100 do={/ip firewall mangle add chain=prerouting action=mark-routing new-routing-mark=("to_pppoe_out".$i) passthrough=yes src-address=10.0.0.0/8 in-interface=ether1-lan connection-mark=("pppoe-out".$i."_conn")  comment=("pcc".$i)}

6.手動設定路由

for i from 6 to 100 do={/ip route add comment=$i disabled=no distance=1 dst-address="0.0.0.0/0" gateway=("pppoe-out".$i) routing-mark=("to_pppoe_out".$i) check-gateway=("ping")}

7.設定路由ping 監控
for i from 8 to 100 do={/ip route add check-gateway="ping" comment=("pppoe-out".$i) disabled=no distance="10" dst-address="0.0.0.0/0" gateway=("pppoe-out".$i)}

附錄:截圖