实验10:Cisco(思科)路由器EIGRP协议的基本配置

Post by mrchen, 2010-6-18, Views:
原创文章如转载,请注明:转载自冠威博客 [ http://www.guanwei.org/ ]
本文链接地址:http://www.guanwei.org/post/Cisconetwork/06/EIGRP.html

什么是EIGRP?

EIGRP(Enhanced Interior Gateway Routing Protocol,增强型内部网关路由协议)是Cisco 公司开发的一个平衡混合型路由协议,它融合了距离向量和链路状态两种路由协议的优点,支持 IP、IPX、ApplleTalk 等多种网络层协议。由于 TCP/IP 是当今网络中最常用的协议,因此本文只讨论 IP 网络环境中的 EIGRP。

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 层协议做
特别的配置。

实验步骤

拓扑图

(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之间。

实验调试
(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        218           0
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 上也会收到一条默认路由。

Tags: cisco  思科  路由器  EIGRP  协议  配置 
本文未看懂?联系冠威客服,享受手把手服务,远程、现场任您选。优惠期间,免费服务!
有更好的解决方案?联系冠威客服,加入冠威,成为冠威客。发表文章,赚取佣金!
冠威客服:E-mail:Service@GuanWei.Org QQ:1026092 合作伙伴:淘男网
分类:Cisco笔记 | 评论:0 | 引用:0
分享到:

上一篇:思科(Cisco)CleanPipe防DDOS解决方案
下一篇:RIP 命令汇总

或许你还对下面的文章感兴趣

Comments

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

Hot Articles

New Articles

Last Comments

Guest