EIGRP的负载平衡配置  我所使用的路由器是Router 3640
 
实验拓扑:
 
 
连接方式  :
          Router1 S0/0 <----> Router2 S0/0
          Router1 S0/1 <----> Router2 S0/1
          Router2 S0/2 <----> Router3 S0/2
 
注意:在R1和R2是有两条路径的,上图只显示一条而已。
ip地址表 :
   R1   S0/0  192.168.1.1/24    S0/1 192.168.2.1
   R2   S0/0  192.168.1.2/24     S0/1 192.168.2.2   S0/2 192.168.3.2/24
   R3   S0/0   192.168.3.1/24
 
在R1,R2,R3启动EIGRP协议,没有实现负载均衡的情况如下:
 
 
R1路由 详细配置
router>en
router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
router(config)#hostname R1
R1(config)#int s0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int s0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#bandwidth 2000  //在这里我把带宽设置为2000kbit,默认是2048kbit
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#router eigrp 10 //启动路由EIGRP进程,进程号为10
R1(config-router)#network 192.168.1.0  //宣告直连网络
R1(config-router)#network 192.168.2.0
R1(config-router)#exit
R1(config)#exit
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
C    192.168.1.0/24 is directly connected, Serial0/0
C    192.168.2.0/24 is directly connected, Serial0/1
D    192.168.3.0/24 [90/2273792] via 192.168.1.2, 00:06:05, Serial0/0
 
注意:路由表里只包含到目标地址的最低度量值的路由。
 
 
R2路由(请参照R1的配置)
R2#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
C    192.168.1.0/24 is directly connected, Serial0/0
C    192.168.2.0/24 is directly connected, Serial0/1
C    192.168.3.0/24 is directly connected, Serial0/2

注意:要在接口上启动 clock rate  命令,给R1,R3提供时钟。
 
 
R3路由
R3#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
D    192.168.1.0/24 [90/2273792] via 192.168.3.2, 00:00:43, Serial0/2
D    192.168.2.0/24 [90/2304000] via 192.168.3.2, 00:00:43, Serial0/2
C    192.168.3.0/24 is directly connected, Serial0/2
 
注意:从上面可以看出R1两条线路到R3各自的度量值。
 
 
下面我们来实现负载均衡在R1----R3之间。负载均衡是什么?
 
   负载均衡是指路由器在其离目标地址的距离相同的所有网络端口之间分配数据流的能力。
    注意:负载均衡只针对经过路由器的数据流,而不针对当前路由器生成的数据流。
 
 
实现负载均衡的条件是什么?
 
1.当前FD必须大于从下一跳路由器获悉的AD。
2.当前FD和multiplier的乘积大于下一跳路由的度量值。

 
下面我将在R1上通过variance 来设置,另外由于R1---R3最低度量 为 2273792 ,所以通过 variance 2 就可以实现非等成本负载均衡。即 2273792*2 > 2340000
 
 
R1路由

R1#en
R1#config t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#router eigrp 10
R1(config-router)#var
R1(config-router)#variance 2
R1(config-router)#exit
R1(config)#exit
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
C    192.168.1.0/24 is directly connected, Serial0/0
C    192.168.2.0/24 is directly connected, Serial0/1
D    192.168.3.0/24 [90/2304000] via 192.168.2.2, 00:00:52, Serial0/1
                                [90/2273792] via 192.168.1.2, 00:00:52, Serial0/0

 
注意:这个时候出现了两条通向目标地址(192.168.3.0)的路径。在没有配置负载均衡时候,路由表只出现一条最佳路由。
 
 
现在再来ping 192.168.3.1 是否连通。
R1#ping 192.168.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
..!!!
Success rate is 60 percent (3/5), round-trip min/avg/max = 576/793/1228 ms
 
情况表明已经连通。
 
 
       现在在R1上运行命令show ip route 192.168.3.1 显示到达192.168.3.1的路径。注意这两条路径上正在负载均衡,路径旁边有个星号“*”号, 表示要使用这条路径来到达目标地址。
 
R1路由
R1#show ip route 192.168.3.1
Routing entry for 192.168.3.0/24
  Known via "eigrp 10", distance 90, metric 2273792, type internal
  Redistributing via eigrp 10
  Last update from 192.168.1.2 on Serial0/0, 00:02:25 ago
  Routing Descriptor Blocks:
    * 192.168.2.2, from 192.168.2.2, 00:02:25 ago, via Serial0/1
      Route metric is 2304000, traffic share count is 1
      Total delay is 40000 microseconds, minimum bandwidth is 2000 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 1
      192.168.1.2, from 192.168.1.2, 00:02:29 ago, via Serial0/0
      Route metric is 2273792, traffic share count is 1
      Total delay is 40000 microseconds, minimum bandwidth is 2048 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 1
 
使用192.168.2.2到达192.168.3.1
 
R1#show ip route 192.168.3.1
Routing entry for 192.168.3.0/24
  Known via "eigrp 10", distance 90, metric 2273792, type internal
  Redistributing via eigrp 10
  Last update from 192.168.2.2 on Serial0/1, 00:00:11 ago
  Routing Descriptor Blocks:
  * 192.168.1.2, from 192.168.1.2, 00:00:11 ago, via Serial0/0
      Route metric is 2273792, traffic share count is 1
      Total delay is 40000 microseconds, minimum bandwidth is 2048 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 1
    192.168.2.2, from 192.168.2.2, 00:00:13 ago, via Serial0/1
      Route metric is 2304000, traffic share count is 1
      Total delay is 40000 microseconds, minimum bandwidth is 2000 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 1
 
使用192.168.1.2到达192.168.3.1
 
 
在R1使用no variance上取消负载均衡
 
R1#config t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#router eigrp 10
R1(config-router)#no variance
R1(config-router)#exit
R1(config)#exit
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
C    192.168.1.0/24 is directly connected, Serial0/0
C    192.168.2.0/24 is directly connected, Serial0/1
D    192.168.3.0/24 [90/2304000] via 192.168.2.2, 00:00:00, Serial0/1
 
 
现在使用show ip route 192.168.3.1 看一下情况。注意只使用了一条路径,没有运行负载均衡。
 
 
R1#show ip route 192.168.3.1
Routing entry for 192.168.3.0/24
  Known via "eigrp 10", distance 90, metric 2273792, type internal
  Redistributing via eigrp 10
  Last update from 192.168.1.2 on Serial0/0, 00:00:24 ago
  Routing Descriptor Blocks:
  * 192.168.1.2, from 192.168.1.2, 00:00:24 ago, via Serial0/0
      Route metric is 2273792, traffic share count is 1
      Total delay is 40000 microseconds, minimum bandwidth is 2048 Kbit
      Reliability 255/255, minimum MTU 1500 bytes
      Loading 1/255, Hops 1
 
 
 
希望这个对大家有点用,以后多多交流。