1、等价负载均衡

当到达目的地有多条路径时,而有多条路径的metric值一样,这时就可以做等价负载均衡,让数据包均衡转发,不过要看该路由器的转发方式,如果是快速转发方式,这种方式无用(本地产生的数据包除外)。

2、非等价负载均衡

只有eigrp可以做非等价负载均衡,意思是,到达同一目的地有多条路径,而它们的度量值不一样时,可以做非等价负载均衡,可以通过设置variance值来进行不等价负载均衡,即两数相除取整加1,满足此条件的线路就可以按非等价负载均衡的方式发送数据包,非等价最大支持16条(猜的,不一定),也要看数据包的转发方式,如果是快速转发方式,效果但不到,但是对于本地产生的数据包可以实现非等价,因为此时,本地产生的数据包还是按进程转发方式转发数据包的,对其他路由器的数据包,要关闭快速转发,可以启用cef,且cef对本地的数据包也是产生效果的,记住,不能更改默认的均衡方式,即默认的traffic-share balanced命令不能被修改!
 
1、EIGRP默认支持四条链路的不等代价的负载均衡(所有路由基本上都支持);
2、使用下面命令可支持六条:
router EIGRP 10
maximum-paths 6——设置成6条
variance——后跟差异度量值,实现负载均衡。差异值为1时,只有相同度量才会安置到本地路由表中,为2时,任一由EIGRP发现的了解的路由,只有其度量少于继任度量的两倍,将会被安置到本地的路由表中。
 
 
在做实验之前我想先解释一下实现EIGRP负载的一些知识()!

一:思考

如果 R1 想去去往 R5 的话,那么它面临着有 3 条路可以走,但是我们可以请注意到, 3 条路的度量值是不一样的,所以度量值不一样即不能实现负载均衡,于是 R1 就会选择 R3 做为它的下一跳,把它放入路由表当中 , 那我们怎样实现非等价负载呢(即带宽不一致的情况)?

二:术语

AD Advertise Distance : 宣告距离 (邻居到某网络的距离)

FD (Feasible Distance) :可行距离 (自己到某网络的距离)

如图所示 : 如果 R1 R3 R5 ,那么它的 AD=10 FD=20.

注:这个一定得搞清,不然接下来都不知道我讲什么 .

三:条件

1. 如果我在 R1 配置 R1 config-router #variance 2 的话,那么 R2 会做为 R1 的另一条去住 R5 的路径,因为 2* FD > 20+10=30 ),即从 R2 R5 FD 小于 R3 R5 FD ,所以才能实现负载 .

2. 如果我 variance 设置为 3 的话,那么按我刚刚所说的从 R4 R5 FD 也小于 2* FD ),那它会被加入的负载路径里面去吗?答案肯定不会,因为还有一个条件就是AD必需小于FD,从R4到R5的AD为25,而从R3到R5的FD为20, 所以不满足,不能实现负载 .

实验:拓扑如下

注:首先说明一下,由于 51CTO 只允许写 8 万字,所以步骤一只写了 R1 的配置,其它一样

 
步骤一:首先先把所以接口信息以及EIGRP 全部启用,并且查看信息 .

R1:

Router>

Router>en

Router#conf t

Router(config)#hostname R1

R1(config)#interface f0/0

R1(config-if)#ip address 192.168.12.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#ip address 192.168.13.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#exit

R1(config)#router eigrp 1

R1(config-router)#no auto-summary

R1(config-router)#network 192.168.12.0 0.0.0.255

R1(config-router)#network 192.168.13.0 0.0.0.255

R1(config-if)#end

R1#

R1 上查看路由表:

R1#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

4.0.0.0/24 is subnetted, 1 subnets

D 4.4.4.0 [90/158720] via 192.168.13.2, 00:00:06, FastEthernet0/1

[90/158720] via 192.168.12.2, 00:00:06, FastEthernet0/0

C 192.168.12.0/24 is directly connected, FastEthernet0/0

C 192.168.13.0/24 is directly connected, FastEthernet0/1

D 192.168.24.0/24 [90/30720] via 192.168.12.2, 00:04:00, FastEthernet0/0

D 192.168.34.0/24 [90/30720] via 192.168.13.2, 00:03:50, FastEthernet0/1

R1#

注:很清楚的看到,去往4.4.4.4 有两条路可以走,因为其度量值一样,EIGRP 自动实现负载均衡,

步骤二: R1 设置F0/1 接口带宽为 512KB ,其两边度量值不一样,使得所以数据只向 F0/0 转发 , 产查看路由表与拓扑表 .

R1(config)#interface f0/1

R1(config-if)#bandwidth 512

R1(config-if)#end

R1#

查看路由表:

R1#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

4.0.0.0/24 is subnetted, 1 subnets

D 4.4.4.0 [90/158720] via 192.168.12.2, 00:08:43, FastEthernet0/0

//这里因为改变F0/1了带宽,所以去住4.4.4.4全部往F0/0转发.只有一条.

 

C 192.168.12.0/24 is directly connected, FastEthernet0/0

C 192.168.13.0/24 is directly connected, FastEthernet0/1

D 192.168.24.0/24 [90/30720] via 192.168.12.2, 00:12:37, FastEthernet0/0

D 192.168.34.0/24 [90/33280] via 192.168.12.2, 00:01:04, FastEthernet0/0

R1#

 
R1(config)#do sh ip eigrp topo
IP-EIGRP Topology Table for AS 1
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
       r - Reply status
P 192.168.12.0/24, 1 successors, FD is 28160
         via Connected, FastEthernet0/0
P 192.168.13.0/24, 1 successors, FD is 5002496
         via Connected, FastEthernet0/1
P 192.168.24.0/24, 1 successors, FD is 30720
         via 192.168.12.2 (30720/28160), FastEthernet0/0
P 192.168.34.0/24, 1 successors, FD is 33280
         via 192.168.12.2 (33280/30720), FastEthernet0/0
         via 192.168.13.2 (5005056/28160), FastEthernet0/1
P 4.4.4.4/32, 1 successors, FD is 158720
         via 192.168.12.2 (158720/156160), FastEthernet0/0
         via 192.168.13.2 (5133056/156160), FastEthernet0/1
//通过查看拓扑表可以知道通过R2到R4的可行距离FD=158720,而通过R3到R4的可行距离FD=5133056。

步骤三:实现非等价负载均衡

R1(config)#router eigrp 1

R1(config-router)# variance 33 // 33=[5133056/ 158720]+1,满足条件.

查看路由表:

R1#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

4.0.0.0/24 is subnetted, 1 subnets

D 4.4.4.0 [90/5133056] via 192.168.13.2, 00:00:02, FastEthernet0/1

[90/158720] via 192.168.12.2, 00:00:01, FastEthernet0/0

C 192.168.12.0/24 is directly connected, FastEthernet0/0

C 192.168.13.0/24 is directly connected, FastEthernet0/1

D 192.168.24.0/24 [90/30720] via 192.168.12.2, 00:00:01, FastEthernet0/0

D 192.168.34.0/24 [90/30720] via 192.168.13.2, 00:00:02, FastEthernet0/1

R1#

// 去往4.4.4.4 的路由,又变成了两条 .

实验完毕 .

本文部分内容出自 “梅岩〃s博客” 博客,请务必保留此出处http://justim.blog.51cto.com/740099/244732