[本实验环境是Cisco packet tracer模拟器上做的]
如下图搭建好实验路由拓扑:
配置Router1:
Router>enable
Router#configterminal
Enter configurationcommands, one per line. End with CNTL/Z.
Router(config)#nologging console
Router(config)#interfacefa0/0
Router(config-if)#ipaddress 192.168.1.1 255.255.255.0
Router(config-if)#noshutdown
Router(config-if)#exit
Router(config)#interfacese0/1/0
Router(config-if)#ipaddress 192.168.65.1 255.255.255.0
Router(config-if)#clockrate 64000
Router(config-if)#noshutdown
%LINK-5-CHANGED:Interface Serial0/0/0, changed state to down
Router(config)#interfacese0/0/0
Router(config-if)#ipaddress 192.168.67.1 255.255.255.0
Router(config-if)#clockrate 64000
Router(config-if)#noshutdown
%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 - OSPFexternal 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-userstatic route, o - ODR
P - periodic downloaded static route
Gateway of lastresort 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)#routerrip
Router(config-router)#network192.168.1.0
Router(config-router)#network192.168.65.0
Router(config-router)#network192.168.67.0
Router(config-router)#version2
Router(config-router)#exit
在路由器Router0上配置RIP路由协议:
Router(config)#routerrip
Router(config-router)#net192.168.3.0
Router(config-router)#net192.168.65.0
Router(config-router)#net192.168.69.0
Router(config-router)#version2
Router(config-router)#exit
如上在路由器Router2上配置RIP协议:
Router(config)#routerrip
Router(config-router)#network192.168.5.0
Router(config-router)#network192.168.67.0
Router(config-router)#network192.168.69.0
Router(config-router)#version2
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 - OSPFexternal 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-userstatic route, o - ODR
P - periodic downloaded static route
Gateway of lastresort 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)#network192.168.1.0
Router(config-router)#network192.168.65.0
Router(config-router)#network192.168.67.0
Router(config-router)#exit
如同,在Router0上配置IGRP协议
Router#configtermina
Enter configurationcommands, one per line. End with CNTL/Z.
Router(config)#norouter rip
Router(config)#routereigrp 100
Router(config-router)#network192.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)#network192.168.69.0
Router(config-router)#network192.168.3.0
Router(config-router)#exit
在Router2上配置IGRP协议
Router#confi term
Enter configurationcommands, one per line. End with CNTL/Z.
Router(config)#norouter rip
Router(config)#routereigrp 100
Router(config-router)#network192.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)#network192.168.5.0
Router(config-router)#network192.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 - OSPFexternal 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-userstatic route, o - ODR
P - periodic downloaded static route
Gateway of lastresort is not set
D 192.168.1.0/24 [90/5634560] via192.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] via192.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] via192.168.65.1, 00:04:14, Serial0/1/0
[90/6144000] via192.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 configurationcommands, one per line. End with CNTL/Z.
Router(config)#interfacese0/0/1
Router(config-if)#bandwidth64
%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 configurationcommands, one per line. End with CNTL/Z.
Router(config)#
Router(config)#interfacese0/0/1
Router(config-if)#bandwidth64
%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 - OSPFexternal 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-userstatic route, o - ODR
P - periodic downloaded static route
Gateway of lastresort is not set
D 192.168.1.0/24 [90/5634560] via192.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] via192.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] via192.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有许多不同之处,在配置时应加以注意。)