1) 配置等价路由,以基于地址库的运营商选路路由配置为例
参考“基于地址库的运营商选路”章节配置
通过tftp上传完成地址库后配置
RSR77-X(config)# route-auto-choose cnc gigabitEthernet 2/2/1 61.148.32.129 --->中国联通(CNC)接口为gigabitEthernet 2/2/1,下一跳地址为61.148.32.129
RSR77-X(config)# route-auto-choose cnc gigabitEthernet 2/2/2 62.14.2.123 --->中国联通(CNC)接口为gigabitEthernet 2/2/2,下一跳地址为62.14.2.123
RSR77-X(config)# route-auto-choose cmcc gigabitEthernet 1/1/1 218.204.198.65 --->中国移动(CMCC)接口为gigabitEthernet 4/1/1,下一跳地址为218.204.198.65
RSR77-X(config)# route-auto-choose cmcc gigabitEthernet 1/1/2 218.203.12.54 --->中国移动(CMCC)接口为gigabitEthernet 4/1/1,下一跳地址为218.203.12.54
2) 开启多链路负载均衡MLLB功能
RSR77-X(config)#mllb enable ----->全局开启多链路负载均衡功能
3) 配置负载均衡策略为按照负载进行均衡
RSR77-X(config)#mllb policy load ----->配置负载均衡策略为负载优先策略
RSR77-X(config)#mllb load-sharing original----->配置同一个源IP只走同一个出口。在某些应用场景(比如网银、游戏等)不允许同一个用户的报文从不同的出口到达目的地址,否则认为是伪造报文或多次登录。使用该命令后同一个源IP的报文都从同一个出口转发。
4) 配置链路带宽
RSR77-X(config)# interface gigabitEthernet 1/1/1
RSR77-X(config-if-gigabitEthernet 1/1/1)# bandwidth 500000 ---->设置接口带宽为500Mbps
RSR77-X(config-if-gigabitEthernet 1/1/0)#exit
RSR77-X(config)# interface gigabitEthernet 1/1/2
RSR77-X(config-if-gigabitEthernet 1/1/2)# bandwidth 1000000 ---->设置接口带宽为1Gbps
RSR77-X(config-if-gigabitEthernet 1/1/2)#exit
RSR77-X(config)# interface gigabitEthernet 2/2/1
RSR77-X(config-if-gigabitEthernet 2/2/1)# bandwidth 500000
RSR77-X(config-if-gigabitEthernet 2/2/1)#exit
RSR77-X(config)# interface gigabitEthernet 2/2/2
RSR77-X(config-if-gigabitEthernet 2/2/2)# bandwidth 800000
RSR77-X(config-if-gigabitEthernet 2/2/2)#end
可通过show mllb path 来查看链路的负载情况
RSR77-X#sh mllb path
MLLB state: enable policy: hash LOAD_SHARE: TRUE
MLLB path list count: 6 fpm mid: 0x0 entity bandwidth: 1000
GigabitEthernet 1/1/1(3-12), ACTIVE, bandwidth 500000, threshold 90, load 24%(208231)
GigabitEthernet 1/1/2(5-14), ACTIVE, bandwidth 1000000, threshold 90, load 20%(238202)
GigabitEthernet 2/2/1(6-15), ACTIVE, bandwidth 500000, threshold 90, load 16%(202231)
GigabitEthernet 2/2/2(7-16), ACTIVE, bandwidth 800000, threshold 90, load 23%(211238)
Route-aggregatePort 1(10-19), INACTIVE, bandwidth 1000000, threshold 90, load 0%(0)
关键字段解读:
1)entity bandwidth: 1000:显示当前的 mllb per-entity配置
2)(3-12):本地id和全局id,可以不用管,是开发用的
3)ACTIVE:表示该接口在负载均衡MLLB策略中,属于激活的状态
INACTIVE:表示这个接口不在MLLB的负载均衡接口当中,并没有参与MLLB功能
4)bandwidth 1000000:表示当前运营商提供的运营商带宽,
5)threshold 90:负载阀值,默认为90%
6)load 24%:表示基于当前带宽的百分比,流经接口的流量和bandwidth的比值
7)(208231)中的值:表示实际的接口流量,单位是 kbits
======
如果是通过策略路由的形式进行负载,配置示例如下:
RSR77-X(config)#route-map isp permit 10
RSR77-X(config-route-map)#match ip address 110
RSR77-X(config-route-map)#set ip next-hop 10.1.1.1
RSR77-X(config-route-map)#set ip next-hop 10.2.1.1
RSR77-X(config-route-map)#exit
RSR77-X(config)#route-map isp permit 20
RSR77-X(config-route-map)#match ip address 120
RSR77-X(config-route-map)#set ip next-hop 11.1.1.1
RSR77-X(config-route-map)#set ip next-hop 11.2.1.1
RSR77-X(config-route-map)#exit
#配置策略路由负载分担模式,缺省情况下为冗余模式
RSR77-X(config)#ip policy load-balance
# 内网口应用策略路由
RSR77-X(config)#interface TengigabitEthernet 2/1/0
RSR77-X(config-if-TengigabitEthernet 2/1/0)#ip policy route-map isp