EIGRP(Enhanced Interior Gateway Routing Protocol,增强型内部网关路由协议)是Cisco  公司开发的一个平衡混合型路由协议,它融合了距离向量和链路状态两种路由协议的优点,支持IP、IPX、ApplleTalk  等多种网络层协议。由于TCP/IP 是当今网络中最常用的协议,因此本书只讨论IP 网络环境中的EIGRP
5.1 EIGRP 概述
EIGRP 是一个高效的路由协议,它的特点如下:
1. 通过发送和接收Hello 包来建立和维持邻居关系,并交换路由信息;
2. 采用组播(224.0.0.10)或单播进行路由更新;
3. EIGRP 的管理距离为90 或170;
4. 采用触发更新,减少带宽占用;
5. 支持可变长子网掩码 (VLSM),默认开启自动汇总功能;
6. 支持IP、IPX、AppleTalk 等多种网络层协议;
7. 对每一种网络协议,EIGRP 都维持独立的邻居表、拓扑表和路由表;
8. EIGRP 使用Diffusing Update 算法(DUAL)来实现快速收敛.并确保没有路由环路;
9. 存储整个网络拓扑结构的信息,以便快速适应网络变化;
10. 支持等价和非等价的负载均衡;
11. 使用可靠传输协议(RTP)保证路由信息传输的可靠性;
12. 无缝连接数据链路层协议和拓扑结构,EIGRP 不要求对OSI 参考模型的2 层协议做特别的配置。

5.2 实验1:EIGRP 基本配置
1.实验目的
通过本实验可以掌握:
(1)在路由器上启动EIGRP 路由进程
(2)启用参与路由协议的接口,并且通告网络
(3)EIGRP 度量值的计算方法
(4)可行距离(FD)、通告距离(RD)以及可行性条件(FC)
(5)邻居表、拓扑表以及路由表的含义
(6)查看和调试EIGRP 路由协议相关信息
2.实验拓扑
本实验拓扑结构如图5-1 所示。

13232U535-0.jpg

3.实验步骤
(1)步骤1:配置路由器R1
R1(config)#router eigrp 1

R1(config-router)#no auto-summary
R1(config-router)#network 1.1.1.0 0.0.0.255
R1(config-router)#network 192.168.12.0
(2)步骤2:配置路由器R2
R2(config)#router eigrp 1
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.12.0
R2(config-router)#network 192.168.23.0
(3)步骤3:配置路由器R3
R3(config)#router eigrp 1
R3(config-router)#no auto-summary
R3(config-router)#network 192.168.23.0
R3(config-router)#network 192.168.34.0
(4)步骤4:配置路由器R4
R4(config)#router eigrp 1
R4(config-router)#no auto-summary
R4(config-router)#network 4.4.4.0 255.255.255.0
R4(config-router)#network 192.168.34.0
【说明】
EIGRP 协议在通告网段时,如果是主类网络(即标准A、B、C 类的网络,或者说没有划分子网的网络),只需输入此网络地址;如果是子网的话,则最好在网络号后面写子网掩码或者反掩码,这样可以避免将所有的子网都加入EIGRP 进程中。
反掩码是用广播地址(255.255.255.255) 减去子网掩码所得到。如掩码地址是255.255.248.0,则反掩码地址是0.0.7.255。在高级的IOS 中也支持网络掩码的写法。
运行EIGRP 的整个网络AS 号码必须一致,其范围为1-65535 之间。
4.实验调试
(1)show ip route

R2#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.12.0/24 is directly connected, Serial0/0/0
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/20640000] via 192.168.12.1, 00:04:19, Serial0/0/0
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/21152000] via 192.168.23.3, 00:00:06, Serial0/0/1

C 192.168.23.0/24 is directly connected, Serial0/0/1
D 192.168.34.0/24 [90/21024000] via 192.168.23.3, 00:05:34, Serial0/0/1
以上输出表明路由器R2 通过EIGRP 学到了3 条EIGRP 路由条目,管理距离是90,注意
EIGRP 协议代码用字母“D”表示,如果通过重分布方式进入EIGRP 网络的路由条目,默认管
理距离为170,路由代码用“D EX”表示,也说明EIGRP 路由协议能够区分内部路由和外部
路由。
对于EIGRP 度量值的计算,不妨以“D 1.1.1.0 [90/20640000] via 192.168.12.1,
00:04:19, Serial0/0/0”路由条目为例来说明。
EIGRP 度量值的计算公式=[ K1 * Bandwidth + (K2 * Bandwidth)/(256-Load) +
K3*Delay ]*[K5/(Reliability + K4) ] *256
默认情况下,K1 = K3 = 1 ,K2 = K4 = K5 = 0 。
Bandwidth =107/所经由链路中入口带宽(单位为Kbps)的最小值
Delay=所经由链路中入口的延迟之和(单位为μs)/10
接下来看一下在路由器R2 中的“1.1.1.0”路由条目的度量值是如何计算的?
首先看带宽应该是从R1 的 Loopback0 到R2 最小的,应该是R2 的s0/0/0 接口的带宽,
为128K,而延迟是路由器R1 的 Loopback0 和路由器R2 的s0/0/0 接口的延迟之和,所以最
后的度量值应该是[107/128+(5000+20000)/10]*256=20640000,和路由器计算的结果是一致
的。
【提示】
接口的带宽和延迟可以通过“show interface ”查看。
(2)show ip protocols
R2#show ip protocols
Routing Protocol is "eigrp 1"
//AS 号码为1

Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Default networks flagged in outgoing updates
Default networks accepted from incoming updates
EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
// 显示计算度量值所用的K 值
EIGRP maximum hopcount 100
//EIGRP 支持的最大跳数
EIGRP maximum metric variance 1
// variance 值默认为1,即默认时只支持等价路径的负载均衡
Redistributing: eigrp 1
EIGRP NSF-aware route hold timer is 240s
//不间断转发的持续时间
Automatic network summarization is not in effect
//显示自动汇总已经关闭,默认自动汇总是开启的
Maximum path: 4
Routing for Networks:
192.168.12.0

192.168.23.0
Routing Information Sources:
Gateway Distance Last Update
192.168.12.1 90 00:10:44
192.168.23.3 90 00:10:15
Distance: internal 90 external 170
(3)show ip eigrp neighbors
R2#show ip eigrp neighbors
IP-EIGRP neighbors for process 1
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
1 192.168.23.3 Se0/0/1 12 00:11:05 7 1140 0 5
0 192.168.12.1 Se0/0/0 12 00:11:29 7 1140 0 3
以上输出各字段的含义如下:
① H: 表示与邻居建立会话的顺序;
② Address: 邻居路由器的接口地址;
③ Interface: 本地到邻居路由器的接口;
④ Hold: 认为邻居关系不存在所能等待的最大时间;
⑤ Uptime: 从邻居关系建立到目前的时间;
⑥ SRTT: 是向邻居路由器发送一个数据包以及本路由器收到确认包的时间;
⑦ RTO: 路由器在重新传输包之前等待ACK 的时间;
⑧ Q Cnt: 等待发送的队列;
⑨ Seq Num: 从邻居收到的发送数据包的序列号。
【技术要点】
运行EIGRP 路由协议的路由器不能建立邻居关系的可能原因:
① EIGRP 进程的AS 号码不同
② 计算度量值的K 值不同

(4)show ip eigrp topology
R2#show ip eigrp topology
IP-EIGRP Topology Table for AS(1)/ID(192.168.23.2)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 1.1.1.0/24, 1 successors, FD is 20640000
via 192.168.12.1 (20640000/128256), Serial0/0/0
P 4.4.4.0/24, 1 successors, FD is 21152000
via 192.168.23.3 (21152000/20640000), Serial0/0/1
P 192.168.34.0/24, 1 successors, FD is 21024000
via 192.168.23.3 (21024000/20512000), Serial0/0/1
P 192.168.12.0/24, 1 successors, FD is 20512000
via Connected, Serial0/0/0

P 192.168.23.0/24, 1 successors, FD is 20512000
via Connected, Serial0/0/1 (5)show ip eigrp interface
以上输出可以清楚地看到每条路由条目的FD 和RD 的值。而拓扑结构数据库中状态代码
最常见的是“P”,“A”和“s”,含义如下:
① P: 代表passive,表示网络处于收敛的稳定状态;
② A: 代表active,当前网络不可用,正处于发送查询状态;
③ s:在3 分钟内,如果被查询的路由没有收到回应,查询的路由就被置为“stuck in
active”状态。
【术语】
可行距离(FD):到达一个目的网络的最小度量值;
通告距离(RD):邻居路由器所通告的它自己到达目的网络的最小的度量值;
可行性条件(FC):是EIGRP 路由器更新路由表和拓扑表的依据。可行性条件可以有效
地阻止路由环路,实现路由的快速收敛。可行性条件的公式为:AD<FD。
(5)show ip eigrp interfaces
R2#show ip eigrp interfaces
IP-EIGRP interfaces for process 1

                                         Xmit Queue                 Mean                  Pacing Time                      Multicast                      Pending
Interface          Peers         Un/Reliable                   SRTT                 Un/Reliable                       Flow  Timer                 Routes
Se0/0/0              1                       0/0                          7                            5/190                              21                               8  

Se0/0/1            1                        0/0                          7                            5/190                              222                            0

以上输出各字段的含义如下:
① Interface:运行EIGRP 协议的接口;
② Peers:该接口的邻居的个数;
③ Xmit Queue Un/Reliable:在不可靠/可靠队列中存留的数据包的数量;
④ Mean SRTT:平均的往返时间,单位是秒;
⑤ Pacing Time Un/Reliable:用来确定不可靠/可靠队列中数据包被送出接口的时间
间隔;
⑥ Multicast Flow Timer:组播数据包被发送前最长的等待时间;
⑦ Pending Routes:在传送队列中等待被发送的数据包携带的路由条目。
(6)show ip eigrp traffic
R2#show ip eigrp traffic
IP-EIGRP Traffic Statistics for AS 1
Hellos sent/received: 364/361
Updates sent/received: 10/8
Queries sent/received: 0/0
Replies sent/received: 0/0
Acks sent/received: 4/5
Input queue high water mark 1, 0 drops
SIA-Queries sent/received: 0/0
SIA-Replies sent/received: 0/0
Hello Process ID: 187

PDM Process ID: 167
以上输出显示了EIGRP 发送和接收到的数据包的统计情况。
(7)debug eigrp neighbors
该命令可以动态查看EIGRP 邻居关系的情况。在路由器R1 先将s0/0/0 接口shutdown
掉,然后再no shutdown,可以看到EIGRP 邻居建立的过程。
R2#debug eigrp neighbors
EIGRP Neighbors debugging is on
*Feb 10 02:59:31.199: %LINK-3-UPDOWN: Interface Serial0/0/0, changed state to down
*Feb 10 02:59:31.199: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 192.168.12.1 (Serial0/0/0)
is down: interface down
*Feb 10 02:59:31.199: Going down: Peer 192.168.12.1 total=1 stub 0 template=1, iidb-stub=0
iid-all=0
*Feb 10 02:59:31.199: EIGRP: Neighbor 192.168.12.1 went down on Serial0/0/0
*Feb 10 02:59:32.199: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed
state to down
*Feb 10 02:59:48.199: %LINK-3-UPDOWN: Interface Serial0/0/0, changed state to up
*Feb 10 02:59:49.199: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/0/0, changed
state to up
*Feb 10 02:59:49.687: EIGRP: New peer 192.168.12.1 total=2 stub 0 template=1 idbstub=0
iidball=1
*Feb 10 02:59:49.687: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 192.168.12.1 (Serial0/0/0)
is up: new adjacency
(8)debug eigrp packets
该命令可以显示EIGRP 发送和接收的数据包。
R2#debug eigrp packets
EIGRP Packets debugging is on

(UPDATE, REQUEST, QUERY, REPLY, HELLO, IPXSAP, PROBE, ACK, STUB, SIAQUERY, SIAREPLY)
*Feb 10 03:01:08.107: EIGRP: Received HELLO on Serial0/0/0 nbr 192.168.12.1
*Feb 10 03:01:08.107: AS 1, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0 peerQ un/rely
0/0
*Feb 10 03:01:08.843: EIGRP: Received HELLO on Serial0/0/1 nbr 192.168.23.3
*Feb 10 03:01:08.843: AS 1, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0 peerQ un/rely
0/0
*Feb 10 03:01:10.927: EIGRP: Sending HELLO on Serial0/0/0
*Feb 10 03:01:10.927: AS 1, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0
*Feb 10 03:01:12.471: EIGRP: Sending HELLO on Serial0/0/1
*Feb 10 03:01:12.471: AS 1, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0
以上输出显示R2 发送和接收的EIGRP 数据包,由于当前网络是收敛的,所以只有HELLO
数据包发送和接收的报告。
【术语】
在EIGRP 中,有五种类型的数据包:
① Hello:以组播的方式定期发送,用于建立和维持邻居关系;
② 更新:当路由器收到某个邻居路由器的第一个Hello 包时,以单播传送方式回送一个包含它所知道的路由信息的更新包。当路由信息发生变化时,以组播的方式发送只包含变化信息的更新包;
③ 查询:当一条链路失效,路由器重新进行路由计算,但在拓扑表中没有可行的后继路由时,路由器就以组播的方式向它的邻居发送一个查询包,以询问它们是否有一条到目的地的后继路由;
④ 答复:以单播的方式回传给查询方,对查询数据包进行应答;
⑤ 确认:以单播的方式传送,用来确认更新、查询、答复数据包。
(9)在路由器R1 上通过“ip default-network”向EIGRP 网络注入一条默认路由,具体配置如下:
R1(config-if)#ip address 1.1.1.1 255.0.0.0
R1(config)#router eigrp 1
R1(config-router)#no network 1.1.1.0 0.0.0.255
R1(config-router)#network 1.0.0.0
R1(config)#ip default-network 1.0.0.0
在R2 上查看路由表:
R2#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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 192.168.12.1 to network 1.0.0.0
C 192.168.12.0/24 is directly connected, Serial0/0/0
1.0.0.0/8 is subnetted, 1 subnets
D* 1.0.0.0 [90/20640000] via 192.168.12.1, 00:00:08, Serial0/0/0
4.0.0.0/24 is subnetted, 1 subnets
D 4.4.4.0 [90/21152000] via 192.168.23.3, 00:05:35, Serial0/0/1
C 192.168.23.0/24 is directly connected, Serial0/0/1
D 192.168.34.0/24 [90/21024000] via 192.168.23.3, 00:05:35, Serial0/0/1
以上输出表明路由器R2 收到一条默认路由,同理,在R3,R4 上也会收到一条默认路由。

5.3 EIGRP 负载均衡、汇总和认证
5.3.1 实验2: EIGRP 负载均衡
1.实验目的
通过本实验可以掌握:
(1)EIGRP 等价负载均衡的实现方法
(2)EIGRP 非等价负载均衡的实现方法
(3)修改EIGRP 度量值的方法
(4)可行距离(FD)、通告距离(RD)以及可行性条件(FC)的深层含义
2.实验拓扑
本实验拓扑结构如图5-2 所示。

13232RS9-1.jpg


3.实验步骤
(1)步骤1:配置路由器R1
R1(config)#router eigrp 1
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.14.0
R1(config-router)#network 192.168.12.0
(2)步骤2:配置路由器R2
R2(config)#router eigrp 1
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.12.0
R2(config-router)#network 192.168.23.0
R2(config-router)#network 2.2.2.0 255.255.255.0
(3)步骤3:配置路由器R3
R3(config)#router eigrp 1
R3(config-router)#no auto-summary
R3(config-router)#network 192.168.23.0
R3(config-router)#network 192.168.34.0
(4)步骤4:配置路由器R4
R4(config)#router eigrp 1
R4(config-router)#no auto-summary
R4(config-router)#network 4.4.4.0 255.255.255.0
R4(config-router)#network 192.168.34.0
R4(config-router)#network 192.168.14.0
4.实验调试
(1)按照上面的配置,在R4 查看路由表:

R4#show ip route
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.12.0/24
[90/20514560] via 192.168.14.1, 00:00:15, GigabitEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/20642560] via 192.168.14.1, 00:00:15, GigabitEthernet0/0
C 192.168.14.0/24 is directly connected, GigabitEthernet0/0
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
D 192.168.23.0/24 [90/21024000] via 192.168.34.3, 00:00:15, Serial0/0/0
C 192.168.34.0/24 is directly connected, Serial0/0/0
本实验只关注路由器R2 的Loopback 0,虽然路由器R4 到达路由器R2 的Loopback 0
有两条路径,但是路由器会将FD 最小的放入路由表,选择走g0/0 接口。那么另外一条路径
是不是可行后继路由呢?在路由器R4 上查看拓扑表如下:
R4#show ip eigrp topology
IP-EIGRP Topology Table for AS(1)/ID(4.4.4.4)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status

P 2.2.2.0/24, 1 successors, FD is 20642560
via 192.168.14.1 (20642560/20640000), GigabitEthernet0/0
via 192.168.34.3 (21152000/20640000), Serial0/0/0
P 4.4.4.0/24, 1 successors, FD is 128256
via Connected, Loopback0
P 192.168.34.0/24, 1 successors, FD is 20512000
via Connected, Serial0/0/0
P 192.168.12.0/24, 1 successors, FD is 20514560
via 192.168.14.1 (20514560/20512000), GigabitEthernet0/0
P 192.168.14.0/24, 1 successors, FD is 28160
via Connected, GigabitEthernet0/0
P 192.168.23.0/24, 1 successors, FD is 21024000
via 192.168.34.3 (21024000/20512000), Serial0/0/0
从上面的输出中可以看到,第二条路径(走s0/0/0 接口)的AD 为20640000,而最优路由(走g0/0 接口)的FD 为20642560,AD<FD,满足可行性条件,所以第二条路径(走s0/0/0接口)是最优路由(走g0/0 接口)的可行后继。

【术语】
后继:是一个直接连接的邻居路由器,通过它到达目的网络的路由最优;可行后继:是一个邻居路由器,但是通过它到达目的地的度量值比其它路由器高,但它的通告距离小于通过后继路由器到达目的网络的可行距离,因而被保存在拓扑表中,用做备份路由。
(2) 通过适当的配置,使得在路由器R4 上看R2 的Loopback 0 的路由条目为等价路由,从而实现等价负载均衡。根据前面讲的EIGRP  度量值的计算公式,这两条路径的最小带宽是相同的,只要它们的延迟之和相同,就是等价路由,为此,在路由器R4 上做如下的配置:
R4(config)#interface gigabitEthernet 0/0
R4(config-if)#delay 2000
【提示】
在接口下用delay 命令修改的延迟,在计算度量值时,不需要再除以10。
在R4 上查看路由表:
R4#show ip route eigrp
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.12.0/24
[90/21024000] via 192.168.14.1, 00:00:15, GigabitEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/21152000] via 192.168.34.3, 00:00:15, Serial0/0/0
[90/21152000] via 192.168.14.1, 00:00:15, GigabitEthernet0/0
D 192.168.23.0/24 [90/21024000] via 192.168.34.3, 00:00:15, Serial0/0/0
以上输出表明路由条目“2.2.2.0”确实有两条等价路径,表明EIGRP 是支持等价负载均衡的。
(3)将R4 的以太口g0/0 的delay 恢复到原来的值,通过 “variance”命令来研究EIGRP 的非等价负载均衡。在(1)的结果中发现,对于“2.2.2.0”路由条目,在路由器R4的拓扑结构数据库中存在如下的记录:
P 2.2.2.0/24, 1 successors, FD is 20642560
via 192.168.14.1 (20642560/20640000), GigabitEthernet0/0
via 192.168.34.3 (21152000/20640000), Serial0/0/0
现在只需要在R4 的路由器上调整variance 的值,使得这两条路径在路由表中都可见和可用,R4 上的配置如下:
R4(config)#router eigrp 1
R4(config-router)#variance 2
在R4 上查看路由表:
R4#show ip route eigrp
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.12.0/24
[90/20514560] via 192.168.14.1, 00:00:02, GigabitEthernet0/0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/21152000] via 192.168.34.3, 00:00:02, Serial0/0/0
[90/20642560] via 192.168.14.1, 00:00:02, GigabitEthernet0/0
D 192.168.23.0/24 [90/21024000] via 192.168.34.3, 00:00:02, Serial0/0/0
以上输出表明路由条目“2.2.2.0”有两条路径可达,但是它们的度量值不同,这就是所说的非等价路由,从而证明EIGRP 是支持非等价负载均衡的。

【技术要点】
EIGRP 非等价负载均衡是通过“variance”命令实现的,  “variance”默认是1(即代表等价路径的负载均衡), variance  值的范围是1-128.这个参数代表了可以接受的不等价路径的度量值的倍数,在这个范围内的链路都将被接受,并且被放入路由表中。
5.3.2 实验3: EIGRP 路由汇总
1.实验目的
通过本实验可以掌握:
(1)路由汇总的目的
(2)EIGRP 自动汇总
(3)EIGRP 手工汇总
(4)指向null0 路由的含义
2.实验拓扑
本实验拓扑结构如图5-3 所示。

13232US2-2.jpg

3.实验步骤
本实验只给出路由器R4 的配置,路由器R1、R2 和R3 的配置同5.2 的实验1 完全相同。
默认的时候EIGRP 的自动汇总是开启的,自动汇总只对本地产生的EIGRP 路由汇总,可以通
过“no auto-summary”命令关闭自动汇总,然后进行手工汇总,R4 的配置如下:
R4(config)#router eigrp 1
R4(config-router)#no auto-summary
R4(config-router)#network 4.4.0.0 255.255.252.0
R4(config-router)#network 192.168.34.0
R4(config)#interface s0/0/0
R4(config-if)#ip summary-address eigrp 1 4.4.0.0 255.255.252.0
//配置EIGRP 手工路由汇总
4.实验调试
(1)在R4 s0/0/0 执行汇总之前,在R3 上查看路由表:
R3#show ip route eigrp
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.12.0/24 [90/21024000] via 192.168.23.2, 00:23:31, Serial0/0/1
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/21152000] via 192.168.23.2, 00:00:18, Serial0/0/1
4.0.0.0/24 is subnetted, 4 subnets
D 4.4.0.0 [90/20640000] via 192.168.34.4, 00:01:02, Serial0/0/0
D 4.4.1.0 [90/20640000] via 192.168.34.4, 00:01:02, Serial0/0/0
D 4.4.2.0 [90/20640000] via 192.168.34.4, 00:01:02, Serial0/0/0
D 4.4.3.0 [90/20640000] via 192.168.34.4, 00:01:02, Serial0/0/0
以上输出表明路由器R3 的路由表中有4 条明细路由。
(2)在路由器R4 s0/0/0 接口执行汇总,在R3 和R4 上查看路由表:
R4#show ip route eigrp

Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.12.0/24 [90/21536000] via 192.168.34.3, 00:04:36, Serial0/0/0
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/21664000] via 192.168.34.3, 00:03:41, Serial0/0/0
4.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
D 4.4.0.0/22 is a summary, 00:01:33, Null0
D 192.168.23.0/24 [90/21024000] via 192.168.34.3, 00:26:55, Serial0/0/0
R3#show ip route eigrp
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.12.0/24 [90/21024000] via 192.168.23.2, 00:27:30, Serial0/0/1
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/21152000] via 192.168.23.2, 00:04:17, Serial0/0/1
4.0.0.0/22 is subnetted, 1 subnets
D 4.4.0.0 [90/20640000] via 192.168.34.4, 00:02:09, Serial0/0/0
以上输出说明,在路由器R4 的s0/0/0 执行手工汇总后,会在自己路由表产生一条指向“null0”的EIGRP 路由,主要是为了防止路由环路的;在路由器R3 上收到被汇总的路由条目“4.4.0.0/22”。
【提示】
当被汇总的明细路由全部down 掉以后,汇总路由才自动从路由表里被删除,从而可以有效避免路由抖动。
【思考】
如果把上面的实验的R4 的环回接口lo0-lo4 的地址改为192.168.96.4/24,192.168.97
.4/24, 192.168.98.4/24, 192.168.99.4/24,那么在路由器R4 的s0/0/0 接口还能够实现汇

总吗?在路由器R4 上实施的配置如下:
R4(config)#router eigrp 1
R4(config-router)#network 192.168.96.0 255.255.252.0
R4(config)#interface s0/0/0
R4(config-if)#ip summary-address eigrp 1 192.168.96.0 255.255.252.0
分别在R4 和R3 上查看路由表:
R4#show ip route eigrp
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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.12.0/24 [90/21536000] via 192.168.34.3, 00:04:36, Serial0/0/0
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/21664000] via 192.168.34.3, 00:03:41, Serial0/0/0
D 192.168.96.0/22 is a summary, 00:01:40, Null0
D 192.168.23.0/24 [90/21024000] via 192.168.34.3, 00:26:55, Serial0/0/0
R3#show ip route eigrp
Codes: C - connected, S - static, 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

i - IS-IS, su - IS-IS summary, 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.12.0/24 [90/21024000] via 192.168.23.2, 00:27:30, Serial0/0/1
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/21152000] via 192.168.23.2, 00:04:17, Serial0/0/1
D 192.168.96.0/22 [90/20640000] via 192.168.34.4, 00:02:09, Serial0/0/0
从R3 和R4 的路由表的输出可以看出EIGRP 支持CIDR 汇总,这一点和RIPv2 是不相同的。
5.3.3 实验4: EIGRP 认证
1.实验目的
通过本实验可以掌握EIGRP 路由协议认证的配置和调试。
2.实验拓扑
本实验拓扑结构如图5-1 所示。
3.实验步骤

(1)步骤1:配置路由器R1
R1(config)#key chain ccnp
R1(config-keychain)# key 1
R1(config-keychain-key)#key-string cisco
R1(config)#interface s0/0/0
R1(config-if)#ip authentication mode eigrp 1 md5 //认证模式为MD5
R1(config-if)#ip authentication key-chain eigrp 1 ccnp //在接口上调用钥匙链
(2)步骤2:配置路由器R2
R2(config)#key chain ccnp
R2(config-keychain)# key 1
R2(config-keychain-key)#key-string cisco
R2(config)#interface s0/0/0
R2(config-if)#ip authentication mode eigrp 1 md5
R2(config-if)#ip authentication key-chain eigrp 1 ccnp
R2(config)#interface s0/0/1
R2(config-if)#ip authentication mode eigrp 1 md5
R2(config-if)#ip authentication key-chain eigrp 1 ccnp
(3)步骤3:配置路由器R3
R3(config)#key chain ccnp
R3(config-keychain)# key 1
R3(config-keychain-key)#key-string cisco
R3(config)#interface s0/0/0
R3(config-if)#ip authentication mode eigrp 1 md5
R3(config-if)#ip authentication key-chain eigrp 1 ccnp
R3(config)#interface s0/0/1
R3(config-if)#ip authentication mode eigrp 1 md5
R3(config-if)#ip authentication key-chain eigrp 1 ccnp
(4)步骤4:配置路由器R4
R4(config)#key chain ccnp
R4(config-keychain)# key 1

R4(config-keychain-key)#key-string cisco
R4(config)#interface s0/0/0
R4(config-if)#ip authentication mode eigrp 1 md5
R4(config-if)#ip authentication key-chain eigrp 1 ccnp
4.实验调试
(1)如果链路的一端启用了认证,另外一端没有起用认证,则出现下面的提示信息:
*Feb 10 05:46:11.119: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 192.168.12.2
(Serial0/0/0) is down: authentication mode changed
(2)如果钥匙链的密匙不正确,则出现下面的提示信息:
*Feb 10 05:47:08.122: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 1: Neighbor 192.168.12.1
(Serial0/0/0) is down: Auth failure