在做实验之前我想先解释一下实现EIGRP负载的一些知识()!
 
一:思考
如果R1想去去往R5的话,那么它面临着有3条路可以走,但是我们可以请注意到,3条路的度量值是不一样的,所以度量值不一样即不能实现负载均衡,于是R1就会选择R3做为它的下一跳,把它放入路由表当中,那我们怎样实现非等价负载呢(即带宽不一致的情况)?
 
二:术语
ADAdvertise Distance:宣告距离 (邻居到某网络的距离)  
FD (Feasible Distance):可行距离   (自己到某网络的距离)
如图所示: 如果R1R3R5,那么它的AD=10FD=20.
 
注:这个一定得搞清,不然接下来都不知道我讲什么.
 
三:条件
 
1.    如果我在R1配置R1config-router#variance 2的话,那么R2会做为R1的另一条去住R5的路径,因为2*FD>20+10=30),即从R2R5FD小于R3R5FD,所以才能实现负载.
 
2.如果我variance设置为3的话,那么按我刚刚所说的从R4R5FD也小于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
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#
 
//这里因为改变F0/1了带宽,所以去住4.4.4.4全部往F0/0转发.只有一条.
 
 
 
 
 
步骤三:实现非等价负载均衡
 
R1(config)#router eigrp 1
R1(config-router)#variance 32    //    32=5133056除以158720,满足条件.
 
查看路由表:
 
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的路由,又变成了两条.
 
 
实验完毕.