分享

EIGRP协议详解

 king9413 2014-10-26

这篇文章主要介绍EIGRP的特性、分组类型、表的种类、度量值的计算以及EIGRP非等值负载均衡、路由汇总等配置。


___________________________________________

文章目录

___________________________________________

[*1*].EIGRP特性与基本配置

EIGRP(Enhanced Interior Gateway Routing Protocol,增强型内部网关路由协议),是思科私有的,高级距离矢量、无类的路由选择协议。

* EIGRP特性

  • 复合度量值:使用带宽(bandwidth)、负载(load)、延时(delay)、可靠性(reliability),默认只使用带宽和延时做为度量值计算的参数。
  • 快速收敛:使用DUAL算法,通过在拓扑表中保存可行性后继,相当于次优路由,当可用路由消失后,次优路由马上进入路由表。
  • 100%无环路:主要受益于DUAL算法。
  • 配置简单。
  • 可靠的更新:采用RTP(可靠传输协议),并为每个邻居保存一个重传列表。
  • 建立邻居关系:运行EIGRP的路由器中有三张表,路由表、邻居表、拓扑表。
  • 支持多种网络协议。
  • 支持VLSM和CIDR。
  • 支持手动汇总,能关闭自动汇总。
  • 使用组播地址224.0.0.10发送更新。
  • 支持等价和非等价负载均衡。
  • 兼容IGRP。
  • 增量式更新:仅发送变化的路由信息。
  • 路由标记功能:从IGRP何任何外部源收到的更新都标记成EX(外部)。

* EIGRP包格式

EIGRP被设计成一个传输层协议,协议号是88,EIGRP使用RTP(Reliable Transport Protocol,可靠传输协议)传送和接收EIGRP分组

EIGRP的包格式如下图:

CCNA-EIGRP包格式

数据链路层头部:每个组播IP都有一个对应的MAC地址,组播厂商编码为“01-00-5E”,后面的编号部分根据不同的组播IP计算得来,224.0.0.10对应的MAC地址是“01-00-5E-00-00-0A”。

* EIGRP分组类型

EIGRP使用5种分组类型:

1,Hello分组

Hello分组用来发现、验证和重新发现邻居路由器。默认的Hello分组发送间隔,除小于等于1.544Mb/s的多点帧中继链路是60秒外,其他链路都是5秒。使用组播地址224.0.0.10发送,在邻居表中包含一个“保持时间”字段,记录了最后收到hello分组的时间,如果在保持时间到期前没有收到邻居路由器的任何Hello分组,就认为这个邻居出现了故障,默认的保持时间是Hello时间的3倍,即15秒。EIGRP仅在宣告进EIGRP进程的接口的主IP地址上发送分组。

* EIGRP基本配置

下面使用一个实例演示EIGRP基本配置以及Hello分组的参数设置:

图中,R1和R2使用串行线路和以太网线路相连,在R1上有两个回环接口其中除Lo1(3.3.3.3)外,R1和R2的其他接口都宣告进EIGRP进程,自制系统号100(AS=100)。

CCNA-EIGRP简单配置

(本文[1][2][3]部分使用此拓扑来介绍EIGRP配置)

R1配置:

1R1(config)#int s 0/0
2R1(config-if)#ip add 12.1.1.1 255.255.255.0
3R1(config-if)#no shut
4R1(config-if)#int fa 1/0
5R1(config-if)#ip add 21.1.1.1 255.255.255.0
6R1(config-if)#no shut
7R1(config-if)#int lo 0
8R1(config-if)#ip add 1.1.1.1 255.255.255.0
9R1(config-if)#no shut
10R1(config-if)#int lo 1
11R1(config-if)#ip add 3.3.3.3 255.255.255.0
12R1(config-if)#no shut
13R1(config-if)#router eigrp 100 /*EIGRP需要配置AS号*/
14R1(config-router)#net 1.1.1.0 0.0.0.255 /*宣告接口使用的是反掩码形式*/
15R1(config-router)#net 12.1.1.0 0.0.0.255
16R1(config-router)#net 21.1.1.0 0.0.0.255
17R1(config-router)#end
18R1#
19 
20/*
21 * router eigrp 100
22 * EIGRP进程需要配置AS号(自制系统号),这里的100就是AS号,
23 * AS标识了属于一个互连网络中的所有路由器,
24 * 同一个AS内的不同路由如果想要互相学习路由信息,必须配置相同的AS号。
25 *
26 * net 12.1.1.0 0.0.0.255
27 * 在EIGRP中宣告接口需要使用反掩码,如果不输入反掩码,
28 * 路由默认会使用接口的主类网络号,
29 * "net 12.1.1.0" 等价于 "net 12.0.0.0 0.255.255.255"
30 *
31 * 如果路由的所有接口都宣告进EIGRP进程,则可以使用"net 0.0.0.0"一次性宣告所有接口。
32 *
33 */

R2配置:

1R2(config)#int s 0/1
2R2(config-if)#ip add 12.1.1.2 255.255.255.0
3R2(config-if)#no shut
4R2(config-if)#int lo 0
5R2(config-if)#ip add 2.2.2.2 255.255.255.0
6R2(config-if)#no shut
7R2(config-if)#int fa 1/0
8R2(config-if)#ip add 21.1.1.2 255.255.255.0
9R2(config-if)#router eigrp 100  /*自制系统号和R1相同*/
10R2(config-router)#net 0.0.0.0  /*宣告所有接口接入EIGRP进程*/
11R2(config-router)#end
12R2#

* 查看和修改Hello分组发送间隔

配置完成后使用下面的命令查看Hello分组默认发送间隔:

1/*显示R1的s0/0接口上EIGRP配置信息*/
2R1#show ip eigrp interfaces detail s0/0
3IP-EIGRP interfaces for process 100
4 
5            Xmit Queue     Mean   Pacing Time   Multicast   Pending
6Interface Peers Un/Reliable SRTT  Un/Reliable  Flow Timer  Routes
7Se0/0        1        0/0        37       0/15         163           0
8  Hello interval is 5 sec  /*这里就是Hello分组发送间隔,默认5秒*/
9  Next xmit serial <none>
10  Un/reliable mcasts: 0/0  Un/reliable ucasts: 1/3
11  Mcast exceptions: 0  CR packets: 0  ACKs suppressed: 3
12  Retransmissions sent: 0  Out-of-sequence rcvd: 1
13  Authentication mode is not set
14  Use unicast
15R1#

可以使用下面的命令修改Hello分组发送间隔:

1/*修改hello时间间隔为30秒*/
2R1(config)#int s 0/0
3R1(config-if)#ip hello-interval eigrp 100 30
4 
5/*再次查看,发现hello时间变成30秒了*/
6R1#show ip eigrp interfaces detail s 0/0
7.....
8  Hello interval is 30 sec
9.....
10R1#
11 
12/*这样修改后,会遇到一个问题,因为默认的EIGRP保持时间是15秒,而R1发给R2的hello间隔却被修改成了30秒,我们将看到路由上面反复的出现邻居关系down掉后又建立的消息,*/
13*Mar  1 00:31:28.823: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 12.1.1.2 (Serial0/0) is down: Interface
14 
15Goodbye received
16R1(config-if)#
17*Mar  1 00:31:33.739: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 12.1.1.2 (Serial0/0) is up: new adjacency
18 
19/*解决的办法是修改保持时间大于hello时间,一般修改成hello时间的3倍(90秒)*/
20R1(config-if)#ip hold-time eigrp 100 90
21R1(config-if)#end
22R1#
23 
24/*修改后在R2上查看EIGRP邻居表,可以看到R1发送过来的保持时间有是从90秒开始倒计时了*/
25R2#show ip eigrp neighbors
26IP-EIGRP neighbors for process 100
27H   Address   Interface   Hold   Uptime   SRTT   RTO  Q   Seq
28                          (sec)           (ms)        Cnt Num
291   21.1.1.1  Fa1/0        70   00:01:07  1025   5000  0  9
300   12.1.1.1  Se0/1        70   00:01:07   58    348   0  7
31 
32/*上面的Hold下面的70,代表已经收到hello分组20秒了,根据我们的改动再过10秒R2将再次收到R1发送过来的hello分组*/

在EIGRP中,邻居的建立不需要有相同的hello时间和保持时间,而OSPF中必须要有相同的Hello时间和保持时间,否则邻居关系建立将不会成功。

2,ACK(确认)分组

路由器在交换期间,使用确认分组来确认收到了EIGRP分组,确认分组单播发送。

3,Update(更新)分组

更新分组是可靠传送的,需要被确认,当路由发现新邻居或检测到网络拓扑发生变化时,使用更新分组。

4,Query(查询)分组

当EIGRP路由器需要从一个或所有邻居那里得到指定信息时,使用查询分组。查询分组也是可靠传送的,需要被确认。

5,Reply(回复)分组

对邻居的查询信息进行单播回复,可靠传送,需要被确认。

EIGRP分组对照表:

CCNA-EIGRP分组对照表

[*2*].EIGRP表

EIGRP中有三张表:邻居表、路由表、拓扑表。

* 邻居表(Neighbor Table)

两台相邻路由器要建立起邻接关系需要满足两个条件:

  • 具有相同的AS号
  • 具有相匹配的K值

可以通过下面的命令来查看EIGRP默认的K值:

1R1#show ip protocols
2Routing Protocol is "eigrp 100" /*AS=100*/
3  Outgoing update filter list for all interfaces is not set
4  Incoming update filter list for all interfaces is not set
5  Default networks flagged in outgoing updates
6  Default networks accepted from incoming updates
7  EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
8  EIGRP maximum hopcount 100
9  EIGRP maximum metric variance 1
10  Redistributing: eigrp 100
11  EIGRP NSF-aware route hold timer is 240s
12  Automatic network summarization is in effect
13  Automatic address summarization:
14    21.0.0.0/8 for Loopback0, Serial0/0
15      Summarizing with metric 28160
16    12.0.0.0/8 for Loopback0, FastEthernet1/0
17      Summarizing with metric 2169856
18    1.0.0.0/8 for FastEthernet1/0, Serial0/0
19      Summarizing with metric 128256
20  Maximum path: 4
21  Routing for Networks: /*本路由运行了EIGRP的接口*/
22    1.1.1.0/24
23    12.1.1.0/24
24    21.1.1.0/24
25  Routing Information Sources:  /*从哪些源接收到了更新*/
26    Gateway         Distance      Last Update
27    (this router)         90      00:02:29
28    12.1.1.2              90      00:02:29
29    21.1.1.2              90      00:02:24
30  Distance: internal 90 external 170 /*内部管理距离和外部管理距离*/
31 
32/*
33 * 从输出可以看到自制系统号AS=100。
34 *
35 * Maximum path: 4 代表最大允许4条线路的负载均衡,
36 * 可以使用R1(config-router)#maximum-paths 16来修改成16条,或者其他数值
37 *
38 * 可以看到上面的输出中有这么一行:
39 * EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
40 * 其中K1代表带宽,K2代表负载,K3代表延时,K4和K5代表可靠性,
41 * 默认EIGRP只使用了带宽和负载作为度量值计算参数。
42 *
43 */

可以使用下面的命令来修改K值:

“metric weights tos k1 k2 k3 k4 k5″
其中tos被用作服务质量区分服务等级,这里暂时用不到,0为不启用,1为启用。

1/*修改EIGRP K值,只使用带宽作为度量值计算参数*/
2R1(config)#router eigrp 100
3R1(config-router)#metric weights 0 1 0 0 0 0
4 
5/*修改后马上看到了与邻路由K值不匹配的消息*/
6*Mar  1 00:45:32.391: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 12.1.1.2 (Serial0/0) is down: K-value
7 
8mismatch
9 
10/*接着就发现与邻居的邻接关系down掉了*/
11*Mar  1 00:45:32.391: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 12.1.1.2 (Serial0/0) is down: K-value
12 
13mismatch
14 
15/*重新将K值改成默认的带宽和延时有效的状态*/
16R1(config-router)#metric weights 0 1 0 1 0 0

下图是EIGRP建立邻接关系的过程:

CCNA-EIGRP邻居关系建立过程

可以使用下面的命令查看邻居表:

1R1#show ip eigrp neighbors
2IP-EIGRP neighbors for process 100
3H   Address    Interface   Hold   Uptime   SRTT   RTO  Q   Seq
4                           (sec)           (ms)        Cnt Num
51   21.1.1.2   Fa1/0        11   00:04:50   52   312   0   9
60   12.1.1.2   Se0/0        10   00:04:50   59   354   0   10
7 
8/*
9 * “H”表示邻居被学到的先后顺序,0是最先学到的邻居。
10 * “Address”是邻居路由接口IP。
11 * “Interface”是本地路由和这个邻居相连的接口
12 * “Hold”是当前的保持时间,默认15秒,是一个递减的数值。
13 * “Uptime”是邻居进入邻居表到当前经过了多长时间。
14 * 后面的参数在CCNA中暂时不讨论。
15 */

* 路由表

使用下面的命令显示R1的路由表:

1R1#show ip route
2Gateway of last resort is not set
3 
4     1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
5C       1.1.1.0/24 is directly connected, Loopback0
6D       1.0.0.0/8 is a summary, 00:06:49, Null0
7D    2.0.0.0/8 [90/156160] via 21.1.1.2, 00:06:49, FastEthernet1/0
8     3.0.0.0/24 is subnetted, 1 subnets
9C       3.3.3.0 is directly connected, Loopback1
10     21.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
11C       21.1.1.0/24 is directly connected, FastEthernet1/0
12D       21.0.0.0/8 is a summary, 00:06:51, Null0
13     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
14C       12.1.1.0/24 is directly connected, Serial0/0
15D       12.0.0.0/8 is a summary, 00:06:50, Null0
16R1#
17 
18/*
19 *
20 * 路由表中的"D 1.0.0.0/8 is a summary, 01:40:23, Null0",
21 * 是一条自动汇总产生的路由,EIGRP和RIP默认都在主网边界自动汇总,
22 * 而不同的是EIGRP会在本地产生一条自动汇总后的路由,目标指向空接口(Null0)
23 * 发往空接口的数据会被丢弃。这可以有效的避免路由环路的产生。
24 *
25 * "D 2.0.0.0/8 [90/156160] via 21.1.1.2, 00:06:49, FastEthernet1/0
26 * 这是一条通过EIGRP学习到的最终路由,D代表是通过EIGRP学习到的,
27 * 可以看到R1上的2.2.2.2/24被汇总成了2.0.0.0/8发送过来,
28 * [90/156160]中的90是EIGRP默认的管理距离,后面是度量值。
29 * 从这条路由可以得知,去往2.0.0.0/8网络的数据发往21.1.1.2,
30 * 从本地的FastEthernet1/0发出。
31 *
32 */

下面这个例子解释了,为什么EIGRP要在本地产生一条去往空接口的汇总路由:

CCNA-EIGRP如何避免路由环路

假设R1和R2都运行了RIP协议,R1和R2相连的串行线路属于12.1.1.0/24网段,R1将自己回环接口lo0汇总成1.0.0.0/8发送给R2,并且在R1上有一条默认路由指向R2。此时,在R2上面有一个去往1.1.2.1的数据包,R2根据R1发过来的路由1.0.0.0/8匹配,将数据发给R1,R1上面只有默认路由可以匹配,它又将数据发回R2,这样路由环路形成。

假设R1和R2都运行了EIGRP协议,R1和R2相连的串行线路属于12.1.1.0/24网段,R1将自己回环接口lo0汇总成1.0.0.0/8发送给R2,并且在R1上有一条默认路由指向R2。此时,在R2上面有一个去往1.1.2.1的数据包,R2根据R1发过来的路由1.0.0.0/8匹配,将数据发给R1,R1发现路由表中有一条1.0.0.0/8的条目能够匹配(子网掩码最长匹配,这个条目比默认路由子网掩码长,所以优先选取),所以最终R1将数据发往了空接口,即丢弃。有效的避免了路由环路的形成。

* 拓扑表

显示拓扑表:

1/*显示R1的拓扑表*/
2R1#show ip eigrp topology
3IP-EIGRP Topology Table for AS(100)/ID(3.3.3.3)
4 
5Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
6       r - reply Status, s - sia Status
7 
8P 1.0.0.0/8, 1 successors, FD is 128256
9        via Summary (128256/0), Null0
10P 1.1.1.0/24, 1 successors, FD is 128256
11        via Connected, Loopback0
12P 2.0.0.0/8, 1 successors, FD is 156160
13        via 21.1.1.2 (156160/128256), FastEthernet1/0
14        via 12.1.1.2 (2297856/128256), Serial0/0
15P 12.0.0.0/8, 1 successors, FD is 2169856
16        via Summary (2169856/0), Null0
17P 12.1.1.0/24, 1 successors, FD is 2169856
18        via Connected, Serial0/0
19P 21.0.0.0/8, 1 successors, FD is 28160
20        via Summary (28160/0), Null0
21P 21.1.1.0/24, 1 successors, FD is 28160
22        via Connected, FastEthernet1/0
23R1#
24 
25/*
26 * 路由状态:
27 * P 表示被动路由(Passive),即路由是稳定可用的,
28 * A 表示是活跃路由(Active),即路由正在使用DUAL重新计算中,不可用。
29 *
30 * 网络目标: 2.0.0.0/8就是一个网络目标。
31 *
32 * 后继(Successor):到达远程网络的主要路由,对任何特定的路由可以有多达4条后继路由。
33 * "2.0.0.0/8, 1 successors",代表去往2.0.0.0/8只有一条最佳路径。
34 *
35 * 可行距离(FD,Feasible Distance):
36 * 是下一跳路由的报告距离和本路由到下一跳路由的距离之和,
37 * R1去往2.0.0.0/8的路径有两条,距离分别是156160和2297856,
38 * 最小距离156160成为可行距离,即从快速以太网接口到达R2。
39 *
40 * 路由来源:是指最初发布这条路由的路由器标识(via 12.1.1.2),
41 * 这个标识仅当路由是从其他EIGRP路由器学到时才填入。
42 *
43 * 报告距离(RD,Reported Distance):
44 * 报告距离是邻路由报告的,到一个指定目标网络的距离,
45 * “via 21.1.1.2 (156160/128256), FastEthernet1/0”
46 * 128256就是R2报告给R1达自己lo0接口的报告距离,
47 *
48 * 接收端口如"FastEthernet1/0",是本路由从哪个接口可以到达目的地。
49 *
50 */

[*3*].度量值的计算

EIGRP使用复合度量值计算到目的地址最佳路径,复合度量值是带宽、延时、可靠性和负载的组合。在K1、K2、K3、K4、K5都不

为0的前提下,复合度量值的计算公式:

1Metric=[K1*Bandwidth+(K2*Bandwidth)/(256-Load)+K3*Delay]*[K5/(Reliability+K4)]

K1影响的是带宽(Bandwidth),K2影响的是负载(Load),K3影响的是延时(Delay),K4和K5影响的是可靠性(Reliability)。

默认情况下Cisco路由器只使用K1和K3来进行复合度量值的计算,所以公式可以简化成:

1Metric=(10000M/源和目的之间最低链路带宽+源和目的之间所有链路延时总和/10)*256
2 
3/*
4 * 源和目的之间最低链路带宽,单位是M。
5 * 源和目的之间所有链路延时总和,单位是微秒(usec)。
6 * 至于这里为什么要用延时总和除以10,
7 * 那是因为EIGRP度量值计算中是使用10微秒作为单位进行计算的。
8 */

下面举个例子,计算一下R1到R2的lo0接口的复合度量值。注意,R1到R2的lo0接口的度量值,要使用R1去往R2 Lo0接口方向的出接口的带宽和延时作为参数来计算:

1/*
2 * 查看R1的s 0/0接口参数
3 * 可以看到 BW带宽等于1.544M,延时为20000微秒。
4 */
5R1#show interfaces s 0/0
6Serial0/0 is up, line protocol is up
7  Hardware is M4T
8  Internet address is 12.1.1.1/24
9  MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
10 
11/*
12 * 查看R1的fa 1/0接口参数
13 * 可以看到 BW带宽等于100M,延时为100微秒。
14 */
15R1#show interfaces fastEthernet 1/0
16FastEthernet1/0 is up, line protocol is up
17  Hardware is AmdFE, address is cc00.04b0.0010 (bia cc00.04b0.0010)
18  Internet address is 21.1.1.1/24
19  MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
20 
21/*
22 * 再查看R2的Lo0接口的参数
23 * 带宽为8000M,延时为5000微秒。
24 */
25R2#show int lo 0
26Loopback0 is up, line protocol is up
27  Hardware is Loopback
28  Internet address is 2.2.2.2/24
29  MTU 1514 bytes, BW 8000000 Kbit, DLY 5000 usec,

根据公式”Metric=(10000M/源和目的之间最低链路带宽+源和目的之间所有链路延时总和/10)*256″,如果从s0/0去往R2 lo0,最低链路带宽是1.544,延时总和是s0/0的延时+R2的lo0的延时=20000+5000,代入公式计算:

[10000/R1的s0/0接口带宽(单位M)+(R1的s0/0接口延时+R2的lo0接口延时)/10]*256
[10000/1.544+(20000+5000)/10]*256
注意,这个公式的计算每部分都是取整的,比如:
10000/1.544≈6476 ,小数部分直接舍去,且不四舍五入。
(20000+5000)/10=2500
8976*256=2297856

如果从R1的fa1/0去往R2的lo0的度量值就是:
[10000/R1的fa1/0接口带宽(单位M)+(R1的fa1/0接口延时+R2的lo0接口延时)/10]*256
[10000/100+(100+5000)/10]*256=156160

使用show ip eigrp topology看看结果是否相同:

1R1#show ip eigrp topology
2 
3P 2.0.0.0/8, 1 successors, FD is 156160
4        via 21.1.1.2 (156160/128256), FastEthernet1/0
5        via 12.1.1.2 (2297856/128256), Serial0/0
6 
7/*显示的可行距离和自己计算的,完全相同*/

上面的输出中报告距离128256,也可以使用公式计算出来:
[10000/R2的lo0接口带宽(单位M)+(R2的lo0接口延时)/10]*256
[10000/8000+(5000)/10]*256=
10000/8000≈1 , 直接舍去小数位,且不四舍五入。
501*256=128256

计算中,除法出现小数都直接舍去小数部分,且不四舍五入。

如果此时我们更改R2的s0/1或R2的fa1/0带宽,是不会影响R1上面去往R2的lo0接口的度量值的,因为R1去往R2的lo0接口的度量值计算是根据出接口,即R1的s0/0和f1/0以及R2的lo0接口的带宽和延时作为参数来计算的,但是会影响R2到R1的lo0接口的度量值,可以使用下面的方法来验证:

1/*没有更改带宽前,查看R2上去往R1的lo0接口的度量值*/
2R2#show ip eigrp topology
3 
4P 1.0.0.0/8, 1 successors, FD is 156160
5        via 21.1.1.1 (156160/128256), FastEthernet1/0
6        via 12.1.1.1 (2297856/128256), Serial0/1
7 
8/*下面我们更改R2的出接口s0/1的带宽,看会不会改变2297856这个数值大小*/
9R2(config)#int s 0/1
10R2(config-if)#bandwidth 1000000 /*将带宽改成1000M*/
11R2(config-if)#end
12 
13/*查看一下,确实修改成功了*/
14R2#show interfaces s 0/1
15  MTU 1500 bytes, BW 1000000 Kbit, DLY 20000 usec,
16 
17/*再看R2拓扑表*/
18R2#show ip eigrp topology
19 
20P 1.0.0.0/8, 1 successors, FD is 156160
21        via 21.1.1.1 (156160/128256), FastEthernet1/0
22        via 12.1.1.1 (642560/128256), Serial0/1
23/*
24 * 可以看到,从s0/1去往1.0.0.0/8的度量值变成了642560,
25 * 可以用公式来验证这个数值是更改后的1000M带宽作为参数计算得到的。
26 */

可以通过下面的命令来查看某条路由的明细拓扑数据库:

1R2#show ip eigrp topology 1.0.0.0
2IP-EIGRP (AS 100): Topology entry for 1.0.0.0/8
3  State is Passive, Query origin flag is 1, 1 Successor(s), FD is 156160
4  Routing Descriptor Blocks:
5  21.1.1.1 (FastEthernet1/0), from 21.1.1.1, Send flag is 0x0
6      Composite metric is (156160/128256), Route is Internal
7      Vector metric:
8        Minimum bandwidth is 100000 Kbit
9        Total delay is 5100 microseconds
10        Reliability is 255/255
11        Load is 1/255
12        Minimum MTU is 1500
13        Hop count is 1
14  12.1.1.1 (Serial0/1), from 12.1.1.1, Send flag is 0x0
15      Composite metric is (642560/128256), Route is Internal
16      Vector metric:
17        Minimum bandwidth is 1000000 Kbit /*这是我们刚才修改的带宽*/
18        Total delay is 25000 microseconds
19        Reliability is 255/255
20        Load is 1/255
21        Minimum MTU is 1500
22        Hop count is 1
23R2#

[*4*].EIGRP高级配置

介绍EIGRP高级配置前,先介绍一下DUAL算法的相关术语:

  • Successor(后继):后继就是到目标网络花费最少的路由。
  • FD(Feasible Distance,可行距离):到目标网络的最小度量值。
  • RD(Reported Distance,报告距离)又称AD(Advertised Distance,通告距离):下一跳路由器通告的到相同目标网络的距离。
  • FS(Feasible Successor,可行后继):可行后继就是次优路径。
  • FC(Feasibility Condition,可行条件):可行条件是报告距离必须小于可行距离,也就是邻路由到目标网络的距离必须小于本路由到目标网络的距离。

能出现在”show ip eigrp topology”中的非可行距离路径,都满足可行条件,都是可行后继。

下面这个例子中列出的拓扑表很好的解释了上面这些概念:

1R2#show ip eigrp topology
2 
3P 1.0.0.0/8, 1 successors, FD is 156160
4        via 21.1.1.1 (156160/128256), FastEthernet1/0
5        via 12.1.1.1 (2297856/128256), Serial0/1
6 
7/*
8 * 在上面的拓扑表显示中:
9 * R2去往1.0.0.0/8网络有一条后继"1 successors",
10 * 可行距离是"FD is 156160",
11 * 报告距离是"128256",
12 * 可行后继是"via 12.1.1.1 (2297856/128256), Serial0/1"
13 * 能出现在这个命令下的,都满足可行条件。
14 */

* EIGRP非等值负载均衡

用下面这个实例来讲解EIGRP非等值负载均衡的配置:

CCNA-EIGRP非等值负载均衡实例

R1配置:

1R1(config)#no cdp run  /*关闭CDP协议,否则在以太网会有不匹配提示*/
2R1(config)#int lo 0
3R1(config-if)#ip add 1.1.1.1 255.255.255.0
4R1(config-if)#no shut
5R1(config-if)#int s 0/0
6R1(config-if)#ip add 12.1.1.1 255.255.255.0
7R1(config-if)#no shut
8R1(config-if)#int fa 1/0
9R1(config-if)#ip add 13.1.1.1 255.255.255.0
10R1(config-if)#no shut
11R1(config-if)#router eigrp 100
12R1(config-router)#net 0.0.0.0
13R1(config-router)#end
14R1#

R2配置:

1R2(config)#int lo 0
2R2(config-if)#ip add 2.2.2.2 255.255.255.0
3R2(config-if)#no shut
4R2(config-if)#int s 0/1
5R2(config-if)#ip add 12.1.1.2 255.255.255.0
6R2(config-if)#no shut
7R2(config-if)#int s 0/0
8R2(config-if)#ip add 23.1.1.2 255.255.255.0
9R2(config-if)#no shut
10R2(config-if)#router eigrp 100
11R2(config-router)#net 0.0.0.0
12R2(config-router)#end
13R2#

R3配置:

1R3(config)#no cdp run
2R3(config)#int lo 0
3R3(config-if)#ip add 3.3.3.3 255.255.255.0
4R3(config-if)#no shut
5R3(config-if)#int s 0/1
6R3(config-if)#ip add 23.1.1.3 255.255.255.0
7R3(config-if)#no shut
8R3(config-if)#int fa 1/0
9R3(config-if)#ip add 13.1.1.3 255.255.255.0
10R3(config-if)#no shut
11R3(config-if)#router eigrp 100
12R3(config-router)#net 0.0.0.0
13R3(config-router)#end
14R3#

配置完成后查看R1路由表:

1R1#show ip route
2 
3     1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
4C       1.1.1.0/24 is directly connected, Loopback0
5D       1.0.0.0/8 is a summary, 00:07:03, Null0
6D    2.0.0.0/8 [90/2297856] via 12.1.1.2, 00:03:10, Serial0/0
7D    3.0.0.0/8 [90/156160] via 13.1.1.3, 00:03:10, FastEthernet1/0
8D    23.0.0.0/8 [90/2172416] via 13.1.1.3, 00:03:10, FastEthernet1/0
9     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
10C       12.1.1.0/24 is directly connected, Serial0/0
11D       12.0.0.0/8 is a summary, 00:05:02, Null0
12     13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
13C       13.1.1.0/24 is directly connected, FastEthernet1/0
14D       13.0.0.0/8 is a summary, 00:07:04, Null0
15R1#
16 
17/*注意,路由表中去往23.0.0.0/8的路径只显示了一条,而RIP则会显示两条,因为RIP仅仅通过跳数去判断路径的好坏,而EIGRP使用复合度量值,默认和带宽和延时有关,前面已经说明。*/

实际上去往23.0.0.0/8的路径还有一条可行后继,即通过R1,可以通过查看R1上针对23.0.0.0/8的拓扑数据库看到另外一条可行后继:

1R1#show ip eigrp topology 23.0.0.0
2IP-EIGRP (AS 100): Topology entry for 23.0.0.0/8
3  State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2172416
4  Routing Descriptor Blocks:
5 
6/*这一条是后继路由*/
7  13.1.1.3 (FastEthernet1/0), from 13.1.1.3, Send flag is 0x0
8      Composite metric is (2172416/2169856), Route is Internal
9      Vector metric:
10        Minimum bandwidth is 1544 Kbit
11        Total delay is 20100 microseconds
12        Reliability is 255/255
13        Load is 1/255
14        Minimum MTU is 1500
15        Hop count is 1
16 
17/*这一条是可行后继*/
18  12.1.1.2 (Serial0/0), from 12.1.1.2, Send flag is 0x0
19      Composite metric is (2681856/2169856), Route is Internal
20      Vector metric:
21        Minimum bandwidth is 1544 Kbit
22        Total delay is 40000 microseconds
23        Reliability is 255/255
24        Load is 1/255
25        Minimum MTU is 1500
26        Hop count is 1
27R1#

可以使用下面的方法让去往23.0.0.0/8的数据能够很好的被分配到两条线路上:

我们使用上面拓扑数据中最大的可行后继的度量值(本例只有一个可行后继度量值是2681856)除以后继路径的度量值(2172416),取不小于结果的整数:

2681856/2172416≈1.234 , 所以取值等于2作为不等价因子来配置非等值负载均衡:

1R1(config)#router eigrp 100
2R1(config-router)#variance 2  /*配置非等值负载均衡*/
3R1(config-router)#end
4R1#
5 
6/*再次查看R1路由表,发现23.0.0.0/8出现了两条路径*/
7R1#show ip route
8 
9     1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
10C       1.1.1.0/24 is directly connected, Loopback0
11D       1.0.0.0/8 is a summary, 00:00:42, Null0
12D    2.0.0.0/8 [90/2297856] via 12.1.1.2, 00:00:42, Serial0/0
13D    3.0.0.0/8 [90/156160] via 13.1.1.3, 00:00:42, FastEthernet1/0
14D    23.0.0.0/8 [90/2172416] via 13.1.1.3, 00:00:42, FastEthernet1/0
15                [90/2681856] via 12.1.1.2, 00:00:42, Serial0/0
16     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
17C       12.1.1.0/24 is directly connected, Serial0/0
18D       12.0.0.0/8 is a summary, 00:00:43, Null0
19     13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
20C       13.1.1.0/24 is directly connected, FastEthernet1/0
21D       13.0.0.0/8 is a summary, 00:00:43, Null0
22R1#

这里用到的不等价因子2,代表度量值小于“可行距离*2”且报告距离小于可行距离的路径可以进入路由表,可以使用下面的命令来验证这一点:

1/*
2 * 这条命令可以显示所有的路由链路,即使不满足可行条件的也会显示出来
3 * 可以看到2.0.0.0/8、3.0.0.0/8,
4 * 他们的第二条链路的度量值也小于"可行距离*2",
5 * 但是这两条链路不满足可行条件,所以不能进入路由表。
6 */
7R1#show ip eigrp topology all-links
8 
9P 1.0.0.0/8, 1 successors, FD is 128256, serno 6
10        via Summary (128256/0), Null0
11P 1.1.1.0/24, 1 successors, FD is 128256, serno 3
12        via Connected, Loopback0
13P 2.0.0.0/8, 1 successors, FD is 2297856, serno 10
14        via 12.1.1.2 (2297856/128256), Serial0/0
15        via 13.1.1.3 (2300416/2297856), FastEthernet1/0
16P 3.0.0.0/8, 1 successors, FD is 156160, serno 14
17        via 13.1.1.3 (156160/128256), FastEthernet1/0
18        via 12.1.1.2 (2809856/2297856), Serial0/0
19P 12.0.0.0/8, 1 successors, FD is 2169856, serno 8
20        via Summary (2169856/0), Null0
21P 12.1.1.0/24, 1 successors, FD is 2169856, serno 7
22        via Connected, Serial0/0
23P 13.0.0.0/8, 1 successors, FD is 28160, serno 5
24        via Summary (28160/0), Null0
25P 13.1.1.0/24, 1 successors, FD is 28160, serno 2
26        via Connected, FastEthernet1/0
27P 23.0.0.0/8, 1 successors, FD is 2172416, serno 13
28        via 13.1.1.3 (2172416/2169856), FastEthernet1/0
29        via 12.1.1.2 (2681856/2169856), Serial0/0

* EIGRP手动汇总

EIGRP和RIP一样,默认在主类网络的边界自动汇总,我们来看下面这个实例:

CCNA-EIGRP手动汇总实例

R1配置:

1R1(config)#int lo 0
2R1(config-if)#ip add 12.1.2.1 255.255.255.128
3R1(config-if)#no shut
4R1(config-if)#int s 0/0
5R1(config-if)#ip add 12.1.1.1 255.255.255.0
6R1(config-if)#no shut
7R1(config-if)#router eigrp 100
8R1(config-router)#net 12.1.1.0 0.0.0.255
9R1(config-router)#net 12.1.2.0 0.0.0.127
10R1(config-router)#end
11R1#

R2配置:

1R2(config)#int lo 0
2R2(config-if)#ip add 2.2.0.1 255.255.255.0
3R2(config-if)#no shut
4R2(config-if)#int lo 1
5R2(config-if)#ip add 2.2.1.1 255.255.255.0
6R2(config-if)#no shut
7R2(config-if)#int s 0/1
8R2(config-if)#ip add 12.1.1.2 255.255.255.0
9R2(config-if)#no shut1
10R2(config-if)#router eigrp 100
11R2(config-router)#net 0.0.0.0
12R2(config-router)#end
13R2#

配置完成后分别查看R1和R2的路由表:

1/*
2 * 可以看到R1的路由表中2.0.0.0/8是R2汇总后发送过来的条目
3 * R2在将自己的Lo0和Lo1从s0/1向外发送的时候,
4 * 发现发送的接口s0/1的IP是12.1.1.2,默认的主类网络是12.0.0.0/8,
5 * 这和Lo0和Lo1的默认主类网络(2.0.0.0/8)不同,
6 * 所以R2在自己的s0/1自动汇总这两条路由成2.0.0.0/8发送给R1。
7 */
8R1#show ip route
9 
10D    2.0.0.0/8 [90/2297856] via 12.1.1.2, 00:00:53, Serial0/0
11     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
12C       12.1.1.0/24 is directly connected, Serial0/0
13C       12.1.2.0/25 is directly connected, Loopback0
14R1#
15 
16/*
17 * 与RIP不同的是,EIGRP自动汇总后,会在本地产生一条指向空接口的汇总路由
18 *
19 * "2.0.0.0/8 is a summary, 00:02:59, Null0",
20 * 是Lo0和Lo1在本地s0/1汇总时产生的。
21 *
22 * "12.0.0.0/8 is a summary, 00:02:59, Null0",
23 * 是R2将自己的s0/1接口路由和从R2接收到的12.1.2.0/25,
24 * 从Lo0和Lo1发送出去时的汇总路由。
25 *
26 * "12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:00:50, Serial0/1"
27 * 这一条从R1发过来的路由没有被汇总的原因是,
28 * R1的发送接口s0/0(12.1.1.1)的默认主类网络地址12.0.0.0/8,
29 * 和这条被发送的路由条目的默认主类网络地址相同,
30 * 自动汇总只发生在主类网络边界。并且从这里可以看出EIGRP支持VLSM。
31 */
32R2#show ip route
33 
34     2.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
35C       2.2.0.0/24 is directly connected, Loopback0
36C       2.2.1.0/24 is directly connected, Loopback1
37D       2.0.0.0/8 is a summary, 00:02:59, Null0
38     12.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
39C       12.1.1.0/24 is directly connected, Serial0/1
40D       12.0.0.0/8 is a summary, 00:02:59, Null0
41D       12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:00:50, Serial0/1
42R2#

关于上面的R2的路由表中“12.0.0.0/8 is a summary, 00:02:59, Null0”这条汇总条目是没有必要的,因为是R2向自己的回环接口发送EIGEP分组的时候产生的汇总路由,可以使用下面的命令将回环接口设置成被动接口,即不发送分组,来减小路由表大小:

1/*将回环接口设置成被动接口*/
2R2(config)#router eigrp 100
3R2(config-router)#passive-interface lo 0
4R2(config-router)#passive-interface lo 1
5R2(config-router)#end
6 
7/*再次查看R2的路由表,就看不到12.0.0.0/8的汇总路由了*/
8R2#show ip route
9 
10     2.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
11C       2.2.0.0/24 is directly connected, Loopback0
12C       2.2.1.0/24 is directly connected, Loopback1
13D       2.0.0.0/8 is a summary, 00:18:02, Null0
14     12.0.0.0/8 is variably subnetted, 3 subnets, 3 masks
15C       12.1.1.0/24 is directly connected, Serial0/1
16D       12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:15:53, Serial0/1
17R2#

接下来,关闭EIGRP的自动汇总,使用手动汇总:

1/*关闭R1的自动汇总*/
2R1(config)#router eigrp 100
3R1(config-router)#no auto-summary
4 
5/*关闭R2的自动汇总*/
6R2(config)#router eigrp 100
7R2(config-router)#no auto-summary
8 
9/*
10 * 关闭汇总后查看R1和R2的路由表
11 * R1上的2.0.0.0/8汇总路由变成了两条明细路由,
12 * 所有的指向空接口的条目消失了
13 */
14R1#show ip route
15 
16     2.0.0.0/24 is subnetted, 2 subnets
17D       2.2.0.0 [90/2297856] via 12.1.1.2, 00:00:06, Serial0/0
18D       2.2.1.0 [90/2297856] via 12.1.1.2, 00:00:06, Serial0/0
19     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
20C       12.1.1.0/24 is directly connected, Serial0/0
21C       12.1.2.0/25 is directly connected, Loopback0
22 
23R2#show ip route
24 
25     2.0.0.0/24 is subnetted, 2 subnets
26C       2.2.0.0 is directly connected, Loopback0
27C       2.2.1.0 is directly connected, Loopback1
28     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
29C       12.1.1.0/24 is directly connected, Serial0/1
30D       12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:25:08, Serial0/1
31 
32/*在R2上使用手动汇总将Lo0和Lo1汇总成一条*/
33R2(config)#int s 0/1  /*手动汇总是在主类网络的边界接口上配置的*/
34R2(config-if)#ip summary-address eigrp 100 2.2.0.0 255.255.254.0
35R2(config-if)#end
36R2#
37 
38/*再次查看R1和R2的路由表*/
39R1#show ip route
40 
41     2.0.0.0/23 is subnetted, 1 subnets /*汇总后发过来的条目*/
42D       2.2.0.0 [90/2297856] via 12.1.1.2, 00:01:32, Serial0/0
43     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
44C       12.1.1.0/24 is directly connected, Serial0/0
45C       12.1.2.0/25 is directly connected, Loopback0
46R1#
47 
48/*手动汇总后R2上自动生成了一条汇总路由,指向空接口*/
49R2#show ip route
50 
51     2.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
52C       2.2.0.0/24 is directly connected, Loopback0
53D       2.2.0.0/23 is a summary, 00:02:20, Null0
54C       2.2.1.0/24 is directly connected, Loopback1
55     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
56C       12.1.1.0/24 is directly connected, Serial0/1
57D       12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:30:19, Serial0/1
58R2#

* EIGRP外部路由

接着上面的实验,在R1上新增一个Loopback1,IP地址设置成1.1.1.1/24 :

1R1(config)#int lo 1
2R1(config-if)#ip add 1.1.1.1 255.255.255.0
3R1(config-if)#no shut
4R1(config-if)#end
5R1#

这个时候在R2上查看路由表,看不到R1的回环接口lo1的条目,这是因为前面配置的时候,并没有使用net 0.0.0.0宣告全部的接口,这里要使用路由重发布技术,将R1的lo1接口发布进EIGRP,R1配置如下:

1R1(config)#router eigrp 100
2R1(config-router)#redistribute connected  /*重发布直连路由*/
3R1(config-router)#end
4R1#
5 
6/*
7 * 在R2上查看路由表,发现一条D EX开头的条目,
8 * “D EX”表示这条路由条目是EIGRP外部路由,不是起源EIGRP内部,
9 * 可能是用重发布发布进EIGRP进程的,EIGRP外部路由默认管理距离是170。
10 */
11R2#show ip route
12 
13     1.0.0.0/24 is subnetted, 1 subnets
14D EX    1.1.1.0 [170/2297856] via 12.1.1.1, 00:00:51, Serial0/1
15     2.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
16C       2.2.0.0/24 is directly connected, Loopback0
17D       2.2.0.0/23 is a summary, 00:13:00, Null0
18C       2.2.1.0/24 is directly connected, Loopback1
19     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
20C       12.1.1.0/24 is directly connected, Serial0/1
21D       12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:40:59, Serial0/1
22R2#
23 
24/*可以在拓扑表中看到这条外部路由的详细信息*/
25R2#show ip eigrp  topology 1.1.1.0/24
26IP-EIGRP (AS 100): Topology entry for 1.1.1.0/24
27  State is Passive, Query origin flag is 1, 1 Successor(s), FD is 2297856
28  Routing Descriptor Blocks:
29  12.1.1.1 (Serial0/1), from 12.1.1.1, Send flag is 0x0
30/*Route is External,这是一条外部路由*/
31      Composite metric is (2297856/128256), Route is External
32      Vector metric:
33        Minimum bandwidth is 1544 Kbit
34        Total delay is 25000 microseconds
35        Reliability is 255/255
36        Load is 1/255
37        Minimum MTU is 1500
38        Hop count is 1
39      External data:
40        Originating router is 12.1.2.1
41        AS number of route is 0
42/*External protocol is Connected,重发布的是外部直连路由*/
43        External protocol is Connected, external metric is 0
44        Administrator tag is 0 (0x00000000)
45R2#

* EIGRP重发布默认路由

可以使用相同的方法重发布一条外部默认路由,在R1上配置一条默认路由,然后再将这条默认路由使用静态路由的形式重发布到EIGRP进程里:

1R1(config)#ip route 0.0.0.0 0.0.0.0 lo1 /*所有未知数据从lo1接口发出*/
2R1(config)#router eigrp 100
3R1(config-router)#redistribute static /*重发布静态路由*/
4R1(config-router)#end
5R1#
6 
7/*在R2上查看路由表,可以看到来自外部的默认路由"D*EX"*/
8R2#show ip route
9 
10Gateway of last resort is 12.1.1.1 to network 0.0.0.0
11 
12     1.0.0.0/24 is subnetted, 1 subnets
13D EX    1.1.1.0 [170/2297856] via 12.1.1.1, 00:15:54, Serial0/1
14     2.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
15C       2.2.0.0/24 is directly connected, Loopback0
16D       2.2.0.0/23 is a summary, 00:28:03, Null0
17C       2.2.1.0/24 is directly connected, Loopback1
18     12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
19C       12.1.1.0/24 is directly connected, Serial0/1
20D       12.1.2.0/25 [90/2297856] via 12.1.1.1, 00:56:02, Serial0/1
21D*EX 0.0.0.0/0 [170/2297856] via 12.1.1.1, 00:00:05, Serial0/1

* EIGRP验证

EIGRP配置验证的模式和RIPv2协议一样,在全局配置模式下创建密钥链,在接口中调用密钥链并且制定验证模式,接着上面的实验,在R1和R2之间,使用MD5验证:

1/*R1配置验证*/
2R1(config)#key chain ccnakey1 /*密钥链标识ccnakey1,只具有本地意义*/
3R1(config-keychain)#key 1
4R1(config-keychain-key)#key-string eigrp123456 /*密钥密码,双方需要相同*/
5R1(config-keychain-key)#int s 0/0 /*在和R2相连的接口上调用密钥链,并指MD5加密。*/
6R1(config-if)#ip authentication key-chain eigrp 100 ccnakey1
7R1(config-if)#ip authentication mode eigrp 100 md5
8R1(config-if)#end
9R1#
10 
11/*R2配置验证*/
12R2(config)#key chain ccnakey2
13R2(config-keychain)#key 1
14R2(config-keychain-key)#key
15R2(config-keychain-key)#key-string eigrp123456
16R2(config-keychain-key)#int s 0/1
17R2(config-if)#ip authentication mode eigrp 100 md5
18R2(config-if)#ip authentication key-chain eigrp 100 ccnakey2
19R2(config-if)#end
20R2#

配置完成后,R1和R2邻居关系将重新建立,并且能够交互信息。大家可以将两边的密钥密码配置的不相同,看看它们可不可以交互信息。

* EIGRP性能调整

默认情况下EIGRP使用接口50%的带宽来传递EIGRP信息,可以使用下面的命令来更改EIGRP默认的接口带宽占用率:

1/*将R1的s0/0接口的EIGRP带宽占用率调整成5%*/
2R1(config)#int s 0/0
3R1(config-if)#ip bandwidth-percent eigrp 100 5

————————————————————————————————————

[**] 注:如文中未特别声明转载请注明出自: QingSword.COM

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多