找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 24025|回复: 34

[负载平衡] 二条线路ADSL+光纤固定IP做PCC负载均衡及部分IP策略分流设定!

  [复制链接]
发表于 2010-12-11 20:28:01 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

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

×
本帖最后由 wanken 于 2010-12-16 17:42 编辑

我想分享一下有人的需求与我一样,又不知道如何做的方式,故无私的分想给大家!如有错误请不吝指教!谢谢!


我司条件:一条ADSL  3M/3M (长城宽带的)   一条光纤(固定IP)2M/2M也是长城宽带的!
要求:1.合并2条线路频宽上网使用!
      2.Email 及网页Web主机使用固定IP出去,不走合并频宽,走策略分流出去,且Email收信要映射回来!

二线Pcc频宽合并及部分IP策略分流做法如下:
ros _ADSL+固定IP   PCC负载均衡及策略分流设定!
条件固定2M/2M IP: 210.75.27.51/27     Gateway:210.75.27.62   DNS:211.162.78.1   DNS_2:211.162.78.2
Pppoe拨接 3M/3M    帐号:xxxxxxxxxxx     密码:xxxxxxxxxxxxx
固定IP由内网IP 192.168.8.22 专用为Email  Server 使用  内网192.168.8.20 给web主机使用
Pppoe 拨接为其他内网 IP 使用

----------------------------------------------------1步
先把1网卡的名字改为Wan-1   comment="wan-1"
先把2网卡的名字改为Wan-2    comment="wan-2"
先把3网卡的名字改为Lan      comment="Lan"

在/ip address 配置内网IP、光纤固定IP及ADSL的设定
/ ip address
add address=192.168.8.3      interface=Lan
add address=             interface=Wan-1   <--可以不用设定或(随便给)一会adsl拨接设定interface在Wan-1
add address=210.75.27.51/27  interface=Wan-2          <--固定IP光纤

/ip address DNS
设定DNS
IP-->DNS-->Settings Primary DNS  211.162.78.1  Seconday DNS  211.162.78.2        <--这里是长城宽带的DNS

添加PPOE 拨号
拨号选网卡名为Wan-1的网卡
配置ADSL线路
/interface pppoe-client 配置ADSL拨号信息。让ADSL拔上去
/interface pppoe-client
add name=pppoe-out1 interface=Wan-1  user=帐号(adsl)   password=xxxxxx

   ROS拨号成功后就会获得adsl的动态IP和动态网关,获得的网关就是 ip->address 里interface=pppoe-out1的 network 项。
例如拨号获得的IP是address里的113.88.11.173 网关是network里的 113.88.10.1
   把ADD DEFAULT ROUTE 前的对号去掉注意一点一定要先把ADD DEFAULT ROUTE 前的对号去掉在点OK或
应用否则他会自动把ISP的网关天加到MAIN路由表里你还要删除才行



--------------------------------------------------------------------------------------------------------------
注意   per-connection-classifier= both-addresses   要选这个  both-addresses 选其他的工商银行网银会出问题,我试过其他的选项都不行!如src-address,src-port都不可以进入网银!

以下设定  192.168.8.1-192.168.8.17   PCC负载均衡
   /ip firewall mangle
add action=mark-connection chain=prerouting comment="" disabled=no new-connection-mark=adsl_conn\
passthrough=yes  per-connection-classifier= both-addresses:2/0  src-address=192.168.8.1-192.168.8.17
add action=mark-routing chain=prerouting comment="" connection-mark=adsl_conn\
disabled=no new-routing-mark=adsl_route  passthrough=yes src-address=192.168.8.1-192.168.8.17


add action=mark-connection chain=prerouting comment="" disabled=no new-connection-mark=IP_conn passthrough=yes \
    per-connection-classifier= both-addresses:2/1 src-address=192.168.8.1-192.168.8.17
add action=mark-routing chain=prerouting comment="" connection-mark=IP_conn  disabled=no\
new-routing-mark=IP_route  passthrough=yes src-address=192.168.8.1-192.168.8.17
---------------------------------------------------------------------------------------------------------------------------

以下设定  192.168.8.18-192.168.8.24   策略分流,给Email及WEB主机使用走固定IP出去!

add chain=prerouting src-address=192.168.8.18-192.168.8.24  action=mark-routing   new-routing-mark=IP_route  
passthrough=yes comment="" disabled=no        <--这一条规则是192.168.8.18-192.168.8.24的IP走固定IP路由出去

------------------------------------------------------------------------------------------------------------------------------
以下设定 192.168.8.25-192.168.8.254   PCC  负载均衡

add action=mark-connection chain=prerouting comment="" disabled=no new-connection-mark=adsl_conn\
passthrough=yes  per-connection-classifier= both-addresses:2/0  src-address=192.168.8.25-192.168.8.254
add action=mark-routing chain=prerouting comment="" connection-mark=adsl_conn\
disabled=no new-routing-mark=adsl_route  passthrough=yes src-address=192.168.8.25-192.168.8.254


add action=mark-connection chain=prerouting comment="" disabled=no new-connection-mark=IP_conn passthrough=yes \
    per-connection-classifier= both-addresses:2/1 src-address=192.168.8.25-192.168.8.254
add action=mark-routing chain=prerouting comment="" connection-mark=IP_conn  disabled=no\
new-routing-mark=IP_route  passthrough=yes src-address=192.168.8.25-192.168.8.254
--------------------------------------------------------------------------------------------------------------------------------

更改  mss
add action=change-mss chain=forward comment="" disabled=no new-mss=1440 protocol=tcp tcp-flags=syn

--------------------------------------------------------------------------------------------------------完成如下图1




添加路由表 固定IP   adsl
然后分别加网关
因为现在还不知道adsl网关所以可以随便填adsl路由表加网关为116.114.192.1
路由规则里添加相应的规则和平时设置一样关键是你的路由规则要按那张路由表走

配置路由(网关)
拨号成功后,PPPOE会自动添加IP地址和网关,我们要做的就是手动再添加一次这些地址。
adsl的网关随便填用防adsl掉线脚本来自动修改它手动添加1个和PPPOE自动添加出来一样的网关IP,并标记为comment="adsl"为ADSL的IP   设定 routing mark 为 adsl_route  interface 为 pppoe-out1

   添加光纖線路网关(固定IP)  210.75.27.62    设定 routing mark 为 IP_route  interface 为 Wan-2
并标记为 固定IP  comment="IP"   
/ ip route
add dst-address=0.0.0.0/0 gateway=116.114.192.1  distance=1 comment="adsl"  
check-gateway=ping  routing-mark=adsl_route    --------------------如图2



add dst-address=0.0.0.0/0 gateway=210.75.27.62  distance=1  comment="IP"   
  check-gateway=ping  routing-mark=IP_route   --------------------如图3


增加一个默认路由,这样ROS主机自己才可以连接外面做DDNS更新!
add dst-address=0.0.0.0/0 gateway=210.75.27.62  distance=1   comment="默認路由"  
check-gateway=ping  routing-mark=""                -----------------如图4   


添加脚本adsl-gateway取得adsl  ip address 的动态(network)网关 来修改 ip route 中的网关

取得 ip address 的动态(network)网关 来修改 ip route 中的网关用winbox到 / system script
add name="adsl-gateway"   
:global adslwg
:set adslwg [/ip address get [/ip address find dynamic=yes interface=pppoe-out1] network]
/ip route set [/ip route find comment=adsl] gateway=$adslwg

10秒钟运行一次script脚本,就是上面那个,来防adsl掉线后重新拨接网关没有及时更新!用winbox到
  / system scheduler
add name=" adsl-gateway " on-event=/system script run adsl-gateway" start-date=jMay/29/2010 start-time=00:00:00 interval=10s comment="" \
disabled=no

---------------------------------------------------------------------------------------------------------------------

配置IP伪装 (共享上网)
/ip firewall nat
add action=masquerade chain=srcnat out-interface=wan2
add action=masquerade chain=srcnat out-interface=pppoe-out1
-----------------------------------------------------------------------------------------------------


設定端口 25   110 映射讓Email主機封包到 192.168.8.22的內網!
/ip firewall nat
add action=dst-nat chain=dstnat comment="" disabled=no dst-address=\
    210.75.27.51 dst-port=25 in-interface=Wan-2 protocol=tcp to-addresses=\
    192.168.8.22 to-ports=25
add action=dst-nat chain=dstnat comment="" disabled=no dst-address=\
    210.75.27.51 dst-port=110 in-interface=Wan-2 protocol=tcp to-addresses=\
    192.168.8.22 to-ports=110
add action=masquerade chain=srcnat comment="" disabled=no




PCC.JPG
route-0.JPG
route-1.JPG
route-2.JPG
routeros
发表于 2010-12-12 00:46:02 | 显示全部楼层
沙发
routeros
回复

使用道具 举报

发表于 2010-12-12 06:26:48 | 显示全部楼层
      这么详细的教程一定要支持。。。。。
routeros
回复

使用道具 举报

发表于 2010-12-12 10:18:01 | 显示全部楼层
这么详细的教程一定要支持
routeros
回复

使用道具 举报

发表于 2010-12-12 11:13:42 | 显示全部楼层
支持原创教程,感谢LZ分享精神。
routeros
回复

使用道具 举报

发表于 2010-12-12 11:42:25 | 显示全部楼层
谢谢楼主,谢谢你的无私...
routeros
回复

使用道具 举报

 楼主| 发表于 2010-12-13 14:41:32 | 显示全部楼层
今天公司上班了,经过测试,遇到一个怪怪的问题,由公司外面使用OUTLOOK连接进公司可以收信,不能发信,提示PTR不正确??
后来将Email主机PTR反查的功能关闭就可以由公司外部发信了。
PTR是用来防止垃圾邮件的功能,现在关了垃圾邮件不知道会不会一直进来,
唉.....思考中不知道那位可以解答,不要关闭PTR又可以由外部发信,感谢,再感谢!
routeros
回复

使用道具 举报

发表于 2010-12-14 13:29:00 | 显示全部楼层
请教楼主,这种情况下应该需要DSCP或者PCQ做优先级吧?假设有个别客户端P2P,或者大部分客户端同时上网,又或者上下班时间段收发email,要影响WEB服务器的接入性能吧?
routeros
回复

使用道具 举报

 楼主| 发表于 2010-12-14 13:47:14 | 显示全部楼层
我使用  L7 将 p2p 全都关闭了,公司上班哪有给你用p2p的,另外我有使用 simple  queue 管制所有IP的上网频宽!全公司嘿嘿!只有我可以p2p!
routeros
回复

使用道具 举报

发表于 2010-12-16 00:26:30 | 显示全部楼层
我给顶上,只是小弟才疏学浅。不会把它改成双AD
routeros
回复

使用道具 举报

发表于 2010-12-16 13:29:37 | 显示全部楼层

      这么详细的教程一定要支持。。。
routeros
回复

使用道具 举报

发表于 2010-12-19 16:09:42 | 显示全部楼层
详细的教程一定要支持
routeros
回复

使用道具 举报

发表于 2010-12-21 13:28:15 | 显示全部楼层
这么详细的教程一定要支持。。。
routeros
回复

使用道具 举报

发表于 2010-12-21 19:32:08 | 显示全部楼层

详细的教程一定要支持
routeros
回复

使用道具 举报

发表于 2010-12-21 19:32:19 | 显示全部楼层
么详细的教程一定要支持
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-18 20:13 , Processed in 0.136831 second(s), 5 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

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