[本实验环境是Cisco packet tracer模拟器上做的]
如下图搭建好实验路由拓扑:
配置 Router1 :
Router>enable
Router#config terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no logging console
Router(config)#interface fa0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface se0/1/0
Router(config-if)#ip address 192.168.65.1 255.255.255.0
Router(config-if)#clock rate 64000
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
Router(config)#interface se0/0/0
Router(config-if)#ip address 192.168.67.1 255.255.255.0
Router(config-if)#clock rate 64000
Router(config-if)#no shutdown
%LINK-5-CHANGED: Interface Serial0/0/0, changed state to down
Router(config-if)#end
其他路由器如上配置。
在还未配置路由协议之前我们来查看下路由表,以便和配置后的路由表相互比较下
Router#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.5.0/24 is directly connected, FastEthernet0/0
C 192.168.67.0/24 is directly connected, Serial0/0/0
C 192.168.69.0/24 is directly connected, Serial0/0/1
下面的一些路由协议的配置将在以上实验拓扑上实现:
一、配置 RIP 协议
现在在路由器 Router1 上配置 RIP 路由协议:
Router(config)#router rip
Router(config-router)#network 192.168.1.0
Router(config-router)#network 192.168.65.0
Router(config-router)#network 192.168.67.0
Router(config-router)#version 2
Router(config-router)#exit
在路由器 Router0 上配置 RIP 路由协议:
Router(config)#router rip
Router(config-router)#net 192.168.3.0
Router(config-router)#net 192.168.65.0
Router(config-router)#net 192.168.69.0
Router(config-router)#version 2
Router(config-router)#exit
如上在路由器 Router2 上配置 RIP 协议:
Router(config)#router rip
Router(config-router)#network 192.168.5.0
Router(config-router)#network 192.168.67.0
Router(config-router)#network 192.168.69.0
Router(config-router)#version 2
Router(config-router)#exit
配置完 RIP 协议后,就可以查看路由表,如下:
Router>enable
Router#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, FastEthernet0/0
R 192.168.5.0/24 [120/1] via 192.168.67.2, 00:00:17, Serial0/0/0
C 192.168.65.0/24 is directly connected, Serial0/1/0
C 192.168.67.0/24 is directly connected, Serial0/0/0
R 192.168.69.0/24 [120/1] via 192.168.67.2, 00:00:17, Serial0/0/0
和之前的路由表对比信息发现路由器自学到两条路由信息
R 192.168.5.0/24 [120/1] via 192.168.67.2, 00:00:17, Serial0/0/0
R 192.168.69.0/24 [120/1] via 192.168.67.2, 00:00:17, Serial0/0/0
(附:
R : 表示此路由是由 RIP 协议获取的,另外 C 代表直接相连的网段。
192.168.5.0 表示目标网段。
[120/1]:120 是 RIP 路由协议的管理距离,默认是 120 ; 1 是该路由的度量值,即跳数。
Via: 经由的意思
192.168.67.2 表示从当前路由器出发到达目标网的下一跳点的 IP 地址。
00:00:17 表示该条路由产生的时间。
Serial0/0/0 表示该条路由使用的端口。
)
二、配置 IGRP 协议
在路由器 Router1 上配置 IGRP 协议
(在我的 Cisco Packet Tracer 软件中只有 Enhanced Interior Gateway Routing Protocol (EIGRP) ) Router(config)#router eigrp 100
Router(config-router)#network 192.168.1.0
Router(config-router)#network 192.168.65.0
Router(config-router)#network 192.168.67.0
Router(config-router)#exit
如同,在 Router0 上配置 IGRP 协议
Router#config termina
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no router rip
Router(config)#router eigrp 100
Router(config-router)#network 192.168.65.0
Router(config-router)#
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 192.168.65.1 (Serial0/1/0) is up: new adjacency
Router(config-router)#network 192.168.69.0
Router(config-router)#network 192.168.3.0
Router(config-router)#exit
在 Router2 上配置 IGRP 协议
Router#confi term
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#no router rip
Router(config)#router eigrp 100
Router(config-router)#network 192.168.67.0
Router(config-router)#
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 192.168.67.1 (Serial0/0/0) is up: new adjacency
Router(config-router)#network 192.168.5.0
Router(config-router)#network 192.168.69.0
Router(config-router)#
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 192.168.69.1 (Serial0/0/1) is up: new adjacency
Router(config-router)#exit
配置好 IGRP 路由协议后,让我们来看一下 Router0 中的路由表信息:
Router#
Router#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/5634560] via 192.168.65.1, 00:04:14, Serial0/1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
D 192.168.5.0/24 [90/5634560] via 192.168.69.2, 00:00:51, Serial0/0/1
C 192.168.65.0/24 is directly connected, Serial0/1/0
D 192.168.67.0/24 [90/6144000] via 192.168.65.1, 00:04:14, Serial0/1/0
[90/6144000] via 192.168.69.2, 00:00:51, Serial0/0/1
C 192.168.69.0/24 is directly connected, Serial0/0/1
在配置过 RIP 路由协议后,我们发现 IGRP 协议配置与 RIP 协议配置不同,在这里配置接口事需要配置各路由器间链路的带宽。因为带宽是 IGRP 协议的度量值之一 u ,它要根据这些信息来计算不同路径的度量值,而不同于 RIP 只用跳数来作为唯一的度量值。
当我们改变一条链路的带宽时,会发生什么事?
在 Router2 路由器的 se0/0/1 端口上
Router>enable
Router#config term
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface se0/0/1
Router(config-if)#bandwidth 64
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 192.168.69.1 (Serial0/0/1) is down: interface down
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 192.168.69.1 (Serial0/0/1) is up: new adjacency
在 Router0 路由器的 se0/0/1 端口上
Router>
Router>enable
Router#config term
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#interface se0/0/1
Router(config-if)#bandwidth 64
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 192.168.69.2 (Serial0/0/1) is down: interface down
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 192.168.69.2 (Serial0/0/1) is up: new adjacency
配置好后,让我们再来看下 Router0 的路由信息
Router#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/5634560] via 192.168.65.1, 00:17:28, Serial0/1/0
C 192.168.3.0/24 is directly connected, FastEthernet0/0
D 192.168.5.0/24 [90/6146560] via 192.168.65.1, 00:00:46, Serial0/1/0
C 192.168.65.0/24 is directly connected, Serial0/1/0
D 192.168.67.0/24 [90/6144000] via 192.168.65.1, 00:17:28, Serial0/1/0
C 192.168.69.0/24 is directly connected, Serial0/0/1
与之前的路由表信息比较后,你会发现 R0 访问 R2 和 R2 访问 R0 的路由都要经过路由器 R1 转发,
这是因为 IGRP 协议计算度量值时考虑了网络的带宽,它根据所计算出的度量值,选择度量值小的路径保留在路由表中,【 90/5634560 】中的 90 是 IGRP 协议的管理距离。
(注意:这里用的是 EIGRP 路由协议。 EIGRP 协议配置与 IGRP 协议有相似之处,但由于它对于 VLSM (可变长子网掩码)的支持和众多的其他特性,使得在高级配置以及监测和调试方面与 IGRP 有许多不同之处,在配置时应加以注意。)