ROS软路由论坛 ROSABC.com 网络方案网络工程交流

 找回密码
 会员注册

QQ登录

只需一步,快速开始

查看: 17761|回复: 16

[交流] PCC 5线负载均衡脚本

[复制链接]
发表于 2011-11-7 04:14:27 | 显示全部楼层 |阅读模式

马上注册成为ROSABC会员,随时发帖回复。

您需要 登录 才可以下载或查看,没有账号?会员注册

x
以下为PCC 5线负载均衡脚本,能正常工作,但是有一个问题,中间有条线路PPPOE-out3,无论如何没有流量,
本人钻研数日,都无法开解,困惑至极,请高人指教!将之修改完善,造福大众!

100131094450266bd638dd768b.jpg 2010-1-31 09:44 上传
下载附件 (78.23 KB)


100131094450266bd638dd768b.jpg 2010-1-31 09:44 上传
下载附件 (83.45 KB)




/ip address add address=192.168.1.1/255.255.255.0 interface=ether1 comment=LAN
/ip dns set primary-dns=202.96.128.166 secondary-dns=202.96.128.68 allow-remote-requests=yes


/ip firewall mangle
add action=change-mss chain=forward comment="CHANGE MSS" disabled=no new-mss=1440 protocol=tcp tcp-flags=syn

add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out1 new-connection-mark=pppoe-out1_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out2 new-connection-mark=pppoe-out2_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out3 new-connection-mark=pppoe-out3_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out4 new-connection-mark=pppoe-out4_conn passthrough=yes
add action=mark-connection chain=input comment="" disabled=no in-interface=pppoe-out5 new-connection-mark=pppoe-out5_conn passthrough=yes

add action=mark-routing chain=output comment="" connection-mark=pppoe-out1_conn disabled=no new-routing-mark=to_pppoe-out1 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out2_conn disabled=no new-routing-mark=to_pppoe-out2 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out3_conn disabled=no new-routing-mark=to_pppoe-out3 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out4_conn disabled=no new-routing-mark=to_pppoe-out4 passthrough=yes
add action=mark-routing chain=output comment="" connection-mark=pppoe-out5_conn disabled=no new-routing-mark=to_pppoe-out5 passthrough=yes

add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=ether1 new-connection-mark=pppoe-out1_conn passthrough=yes per-connection-classifier=both-addresses:5/0 src-address=192.168.1.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=ether1 new-connection-mark=pppoe-out2_conn passthrough=yes per-connection-classifier=both-addresses:5/1 src-address=192.168.1.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=ether1 new-connection-mark=pppoe-out3_conn passthrough=yes per-connection-classifier=both-addresses:5/2 src-address=192.168.1.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=ether1 new-connection-mark=pppoe-out4_conn passthrough=yes per-connection-classifier=both-addresses:5/3 src-address=192.168.1.0/24
add action=mark-connection chain=prerouting comment="" disabled=no dst-address-type=!local in-interface=ether1 new-connection-mark=pppoe-out5_conn passthrough=yes per-connection-classifier=both-addresses:5/4 src-address=192.168.1.0/24

add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out1_conn disabled=no in-interface=ether1 new-routing-mark=to_pppoe-out1 passthrough=yes src-address=192.168.1.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out2_conn disabled=no in-interface=ether1 new-routing-mark=to_pppoe-out2 passthrough=yes src-address=192.168.1.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out3_conn disabled=no in-interface=ether1 new-routing-mark=to_pppoe-out3 passthrough=yes src-address=192.168.1.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out3_conn disabled=no in-interface=ether1 new-routing-mark=to_pppoe-out4 passthrough=yes src-address=192.168.1.0/24
add action=mark-routing chain=prerouting comment="" connection-mark=pppoe-out3_conn disabled=no in-interface=ether1 new-routing-mark=to_pppoe-out5 passthrough=yes src-address=192.168.1.0/24

/ip route
add comment=1 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out1 routing-mark=to_pppoe-out1 check-gateway=ping
add comment=2 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out2 routing-mark=to_pppoe-out2 check-gateway=ping
add comment=3 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out3 routing-mark=to_pppoe-out3 check-gateway=ping
add comment=4 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out4 routing-mark=to_pppoe-out4 check-gateway=ping
add comment=5 disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out5 routing-mark=to_pppoe-out5 check-gateway=ping

add check-gateway=ping comment="pppoe-out1" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out1
add check-gateway=ping comment="pppoe-out2" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out2
add check-gateway=ping comment="pppoe-out3" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out3
add check-gateway=ping comment="pppoe-out4" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out4
add check-gateway=ping comment="pppoe-out5" disabled=no distance=10 dst-address=0.0.0.0/0 gateway=pppoe-out5

/ip firewall nat
add action=masquerade chain=srcnat comment="1" disabled=no out-interface=pppoe-out1
add action=masquerade chain=srcnat comment="2" disabled=no out-interface=pppoe-out2
add action=masquerade chain=srcnat comment="3" disabled=no out-interface=pppoe-out3
add action=masquerade chain=srcnat comment="4" disabled=no out-interface=pppoe-out4
add action=masquerade chain=srcnat comment="5" disabled=no out-interface=pppoe-out5
发表于 2011-11-7 18:03:04 | 显示全部楼层
111111111111111111111
发表于 2011-11-7 19:16:20 | 显示全部楼层
看看先!!
发表于 2011-11-8 07:16:18 | 显示全部楼层
当然是PCC好。
发表于 2011-11-9 23:43:53 | 显示全部楼层
回。。。。。回。。。。。回。。。。。
发表于 2011-11-10 05:01:04 | 显示全部楼层
试试................
发表于 2011-11-10 19:56:02 | 显示全部楼层
经过几天的观察,发现PCC流量的确不如NTH均衡,PCC不但考虑数据流的源和目标,更多的顾忌数据流的路径,强调原路来,原路去,这样就导致了一些出口拥堵,其他出口可能没有流量的情况。
网吧还是用NTH好,单线带宽够大方可考虑PCC。
发表于 2011-11-10 21:49:10 | 显示全部楼层
本帖最后由 sike5184 于 2010-1-31 16:36 编辑

我的QQ172948501!请注明~~~~~~~~~~~把你的路理由表哪张全部帖出来?
发表于 2011-11-11 10:37:56 | 显示全部楼层
经过几天的观察,发现PCC流量的确不如NTH均衡,PCC不但考虑数据流的源和目标,更多的顾忌数据流的路径,强调 ...
srisy 发表于 2010-2-3 20:14




      从3.24版本开始,ROS引入新的负载均衡概念,就是PCC匹配器(per- connection-classifier),这个匹配器允许你分离传输流,做到平衡流量的能力,这里面可以设置设置选择根据源地址,源端口,目标地址,目标端口来进行处理,现在论坛里已经有相关的设置帖子,一般是使用所有地址来进行处理,即“both addresses”(使用这种方式才能解决网银问题,如果选择按port方式就会跟NTH一样需要处理网银端口走线),这种处理方式是目前来讲最全面的一种了。很多人以为NTH应该跟PCC差不多,其实不然,虽然大家都是依据各自的规则来进行均衡,两者都不可能达到真正的1+1=2,但是事实上,PCC内置了一个连接重置规则,比如说,你是两条ADSL均衡,使用NTH时就会发现,如果其中一条线路满载,客户机PING外网的话,会出现一下延迟很大,一下延迟很小的情况,如果使用PCC,则不会如此,当其中一条线路满载时,PING连接将会被丢弃再重新选择另一条线路,这样就会达到带宽更充足的利用,从而概念上达到1+1接近于2。(图1显示的是当ADSL1线路满载的情况下,ping值依然很低)所以,选择PCC是更有好利的,况且PCC已经解决了网银问题,以及部分软件走线不兼容问题,不要吝惜你稳定使用着的ROS旧版本,尽管升级吧,至少也得升到3.30版。


这是我在rc论坛看到的.现在看来各种说法都有.到底哪个正确?
发表于 2011-11-11 15:50:29 | 显示全部楼层
我的PCC做出来,就是只跑默认路由的那一根线是怎么回事呢?望赐教啊。。。
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

不良信息举报Q:2000617

软路由

不良信息举报Q:2000617|Archiver|ROS软路由论坛 ROSABC.com 网络方案网络工程交流

GMT+8, 2025-8-5 14:18 , Processed in 0.430202 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表