2012年7月31日星期二

ROS3.30 ADSL双线PCC负载均衡



在真实路由器上建ppoeserver,开两用户,带宽分别为2M,网内虚拟机实验。帐号分别为0000和4444

三张网卡:lan内网、wan1 wan2进行ppoe连接。

1、内网IP设置:这个自行设置你内网的IP段


2、分别增加两个PPPOE拨号帐号 注意Add Default Route都不要打勾





ADSL建议更改下MSS值 具体的方法这里不介绍了。

3、标记链接,两条线分别标记 new connection mark 后面的名称可以自行定义。

4、标记路由。两条线分别标记,注意connection mark 要选上一步 自行定义的 名称 自行输入无效。new route mark 这里可以自行定义命名。

5、标记PCC,分别点选前面标记的链接,在advanced里的per connection classified:选src address and port 后面输入2/0, 这里的2/0是个变量,2表示有2条线做PCC负载,如是3线就是3,0表示PCC负载的第1线,依次类推为2/1. 为了方便可以自行添加个注释  如图:
6、添加主路由 ip--route--增加新的,2条线分别添加进主路由内 注意的地方是 gateway interface 分别选pppoe-out1和2就是选拨号名称而不是网卡名称,check gatew方式为ping distance距离选1因为是主路由就选1 routing mark选我们标记的路由,2条线都要标记。如下图:
7、添加备用路由  ip-router--new  同第6步的方法一样 但是在distance选择上要改为2 因为是备用路由,routing mark要留空。2条线都要添加 , 如下图:

下面是路由的全部设置 主路由和备用路由。



 8、进行NAT伪装 两条线都要进行伪装。在out-interface 选拨号名称分别进行伪装。


到这里PCC的负载设置就完毕,最后上一张测试图,2条4m的下载测试,没有NTH叠加的效果明显,两者各有优点和缺点,仁者见仁 智者见智吧~!



PS: 另贴一个双线ADSL的PCC纯脚本

设置内网网卡名和管理IP地址
/ip address add address=192.168.0.1/24 interface=lan

设置DNS解析地址和缓存
/ip dns set allow-remote-requests=yes cache-max-ttl=1w cache-size=2048KiB max-udp-packet-size=512 primary-dns=202.181.202.140 secondary-dns=202.175.3.3


设置你的adsl帐号密码
第一条:
/ interface pppoe-client
add name="pppoe-out1" max-mtu=1440 max-mru=1440 interface=外网卡名1 user="ADSL帐号1" password="ADSL密码1" profile=default add-default-route=no dial-on-demand=no use-peer-dns=no allow=pap,chap,mschap1,mschap2 disabled=no 
第二条:
/ interface pppoe-client
add name="pppoe-out2" max-mtu=1440 max-mru=1440 interface=外网卡名2 user="ADSL帐号2" password="ADSL密码2" profile=default add-default-route=no dial-on-demand=no use-peer-dns=no allow=pap,chap,mschap1,mschap2 disabled=no 

设置PCC
设置第一条:
/ ip firewall mangle
add chain=prerouting dst-address-type=!local in-interface=lan per-connection-classifier=both-addresses:2/0 action=mark-connection new-connection-mark=1st_conn passthrough=yes comment="PCC1"
add chain=prerouting connection-mark=1st_conn in-interface=lan action=mark-routing new-routing-mark=1st_route
设置第二条:
/ ip firewall mangle
add chain=prerouting dst-address-type=!local in-interface=lan per-connection-classifier=both-addresses:2/ action=mark-connection new-connection-mark=2st_conn passthrough=yes comment="PCC2"
add chain=prerouting connection-mark=2st_conn in-interface=lan action=mark-routing new-routing-mark=2st_route

设置路由:
/ip route
第一条
add comment="1st-route" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out1 check-gateway=ping routing-mark=1st_route
第二条
add comment="2st-route" disabled=no distance=1 dst-address=0.0.0.0/0 gateway=pppoe-out2 check-gateway=ping routing-mark=2st_route

备用路由可设可以不设

NAT伪装
/ip firewall nat
add action=masquerade chain=srcnat comment=1 out-interface=pppoe-out1

add action=masquerade chain=srcnat comment=2 out-interface=pppoe-out2




                                                                       分割线                                                                        




更多资料可以参考这位朋友的博客:http://blog.0797.us:88/1210.shtml 



1 条评论:

  1. 这个比较详细了 ! 如果看这个都不会 我真无语了~!

    回复删除