3148715 发表于 2009-7-1 20:11:05

RouterOS v3.24版本PCC多线负载均衡设置教程

本帖最后由 3148715 于 2009-7-1 20:15 编辑

三线例子代码

/ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark=1st_conn per-connection-classifier=src-address-and-port:3/0
/ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark=2nd_conn per-connection-classifier=src-address-and-port:3/1
/ip firewall mangle add chain=prerouting action=mark-connection new-connection-mark=3rd_conn per-connection-classifier=src-address-and-port:3/2


以下是二线设置代码
说明:Local为内网 wlan1、wlan2为外网







/ ip address
add address=192.168.0.1/24 network=192.168.0.0 broadcast=192.168.0.255 interface=Local
add address=10.111.0.2/24 network=10.111.0.0 broadcast=10.111.0.255 interface=wlan2
add address=10.112.0.2/24 network=10.112.0.0 broadcast=10.112.0.255 interface=wlan1

/ ip firewall mangle
add chain=input in-interface=wlan1 action=mark-connection new-connection-mark=wlan1_conn
add chain=input in-interface=wlan2 action=mark-connection new-connection-mark=wlan2_conn
add chain=output connection-mark=wlan1_conn action=mark-routing new-routing-mark=to_wlan1
add chain=output connection-mark=wlan2_conn action=mark-routing new-routing-mark=to_wlan2
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses:2/0 \
action=mark-connection new-connection-mark=wlan1_conn passthrough=yes
add chain=prerouting dst-address-type=!local in-interface=Local per-connection-classifier=both-addresses:2/1 \
action=mark-connection new-connection-mark=wlan2_conn passthrough=yes
add chain=prerouting connection-mark=wlan1_conn in-interface=Local action=mark-routing new-routing-mark=to_wlan1
add chain=prerouting connection-mark=wlan2_conn in-interface=Local action=mark-routing new-routing-mark=to_wlan2

/ ip route
add dst-address=0.0.0.0/0 gateway=10.111.0.1 routing-mark=to_wlan1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.112.0.1 routing-mark=to_wlan2 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.111.0.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.112.0.1 distance=2 check-gateway=ping

/ ip firewall nat
add chain=srcnat out-interface=wlan1 action=masquerade
add chain=srcnat out-interface=wlan2 action=masquerade



如果你是ADSL动态IP和动态网关,请用动态脚本改变
:global assignaddress
:global newaddress
:global status
:global x
:global i
:set x 2
:for i from=1 to=$x do={
:set status running]
:if ($status=true) do={
:set newaddress address]
:set newaddress [:pick $newaddress 0 [:find $newaddress "/">
:set assignaddress address]
:set assignaddress [:pick $assignaddress 0 [:find $assignaddress "/">
:if ($assignaddress != $newaddress) do={
/ip address set address=$newaddress network=$newaddress broadcast=$newaddress
/ip route set gateway=$newaddress
}
}
}

WGHBOY 发表于 2009-7-1 21:34:41

不要重复发了

cool525000 发表于 2009-7-2 07:41:02

3.X新版本,可以更简化。

xfhlg 发表于 2009-7-2 08:08:05

可恶,转的也不注明出处

WGHBOY 发表于 2009-7-2 13:12:18

这些设置都淘汰了

xfhlg 发表于 2009-7-2 17:28:34

5# WGHBOY

淘汰了,这PCC负载均衡版本才刚出来

3148715 发表于 2009-7-2 17:36:37

别人是大师级人物,他和我们不是一个等级的人。。知道不

;P;P;P

WGHBOY 发表于 2009-7-2 18:00:35

5# WGHBOY

淘汰了,这PCC负载均衡版本才刚出来
xfhlg 发表于 2009-7-2 17:28 http://bbs.routerclub.com/images/common/back.gif
我说除开pcc,其它几个脚本都是老掉牙了,从2.9.27搬过来的

redcom 发表于 2009-7-3 01:21:09

不管如何,先保存了再说

47771885 发表于 2009-7-13 19:28:53

咳咳 咳咳

ysh2009 发表于 2009-9-22 11:52:54

啊?有从2.297过来的?

TheHorizon 发表于 2010-3-7 21:06:00


/ ip route
add dst-address=0.0.0.0/0 gateway=10.111.0.1 distance=1 check-gateway=ping
add dst-address=0.0.0.0/0 gateway=10.112.0.1 distance=2 check-gateway=ping


这两条到底有什么用啊?放进去之后不在“有效”状态的?
删除了,照样可以负载啊。

wdipq 发表于 2010-3-8 15:06:37

kkkkkkkk

billzhong 发表于 2010-3-9 16:01:05

本帖最后由 billzhong 于 2010-3-9 16:02 编辑

双线PCC,不需要什么更新网关的脚本,PCC不好玩:


/ip route
add check-gateway=ping comment="" disabled=no distance=1 dst-address=\
    0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_P1 scope=30 target-scope=10
add check-gateway=ping comment="" disabled=no distance=1 dst-address=\
    0.0.0.0/0 gateway=pppoe-out2 routing-mark=to_P2 scope=30 target-scope=10

/ip firewall nat
add action=masquerade chain=srcnat comment="" disabled=no out-interface=\
    pppoe-out1
add action=masquerade chain=srcnat comment="" disabled=no out-interface=\
    pppoe-out2
add action=masquerade chain=srcnat comment="" disabled=no

/ip firewall mangle
add action=mark-connection chain=input comment="" disabled=no in-interface=\
    pppoe-out1 new-connection-mark=P1 passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=\
    pppoe-out2 new-connection-mark=P2 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=P1 disabled=\
    no new-routing-mark=to_P1 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=P2 disabled=\
    no new-routing-mark=to_P2 passthrough=yes
add action=mark-connection chain=prerouting comment="" disabled=no \
    dst-address-type=!local in-interface=LAN new-connection-mark=P1 \
    passthrough=yes per-connection-classifier=both-addresses:2/0
add action=mark-connection chain=prerouting comment="" disabled=no \
    dst-address-type=!local in-interface=LAN new-connection-mark=P2 \
    passthrough=yes per-connection-classifier=both-addresses:2/1
add action=mark-routing chain=prerouting comment="" connection-mark=P1 \
    disabled=no in-interface=LAN new-routing-mark=to_P1 passthrough=yes
add action=mark-routing chain=prerouting comment="" connection-mark=P2 \
    disabled=no in-interface=LAN new-routing-mark=to_P2 passthrough=yes
add action=change-mss chain=forward comment="" disabled=no new-mss=1300 \
    protocol=tcp tcp-flags=syn
add action=accept chain=prerouting comment="" disabled=no

superlone 发表于 2010-3-19 10:51:06

2.9又玩不了
页: [1] 2 3
查看完整版本: RouterOS v3.24版本PCC多线负载均衡设置教程