一.实验环境
- GNS3模拟器(CRT终端)
- 两台VPCs(winpcap)
- 三台C3725路由器
二.实验原理和目的
- 原理:动态路由就是使用某种路由协议(如RIP,OSPF,BGP等),使路由器之间能够相互学习路由表。由此减少了任务管理,但是路由器互相发送路由表广播时,也占用了带宽。
- 目的:本实验使用RIP协议,使连接在不同路由器上的PC能相互通信。
- RIP路由协议具体信息

三.网络拓扑图
四.实验步骤
-
配置R2
- 配置R2的接口地址
R2#conf t
R2(config)#int f0/0
R2(config-if)#ip add 192.168.10.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int f0/1
R2(config-if)#ip add 192.168.20.1 255.255.255.0
R2(config-if)#no shut
- 给R2配置RIP协议,开启RIP协议
R2(config)#router rip
- 开启RIP路由协议中的V-2,并且关闭路由汇总功能,使路由支持不连续子网
R2(config-router)#version 2
R2(config-router)#no auto-summary
- 宣告直连网段的网络号
R2(config-router)#network 192.168.10.0
R2(config-router)#network 192.168.20.0
- 查看路由表
R2(config)#do 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
R 192.168.30.0/24 [120/1] via 192.168.20.2, 00:00:10, FastEthernet0/1
C 192.168.10.0/24 is directly connected, FastEthernet0/0
R 192.168.40.0/24 [120/2] via 192.168.20.2, 00:00:10, FastEthernet0/1
C 192.168.20.0/24 is directly connected, FastEthernet0/1
-
配置R1
- 配置R1接口的IP地址
R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.20.2 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int f0/1
R1(config-if)#ip add 192.168.30.1 255.255.255.0
R1(config-if)#no shut
- 配置RIP路由协议
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.20.0
R1(config-router)#network 192.168.30.0
- 查看路由表
R1#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.30.0/24 is directly connected, FastEthernet0/1
R 192.168.10.0/24 [120/1] via 192.168.20.1, 00:00:01, FastEthernet0/0
R 192.168.40.0/24 [120/1] via 192.168.30.2, 00:00:24, FastEthernet0/1
C 192.168.20.0/24 is directly connected, FastEthernet0/0
-
配置R3
- 配置R3的接口IP地址
R3#conf t
R3(config)#int f0/0
R3(config-if)#ip add 192.168.30.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int f0/1
R3(config-if)#ip add 192.168.40.1 255.255.255.0
R3(config-if)#no shut
- 配置RIP路由协议
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#network 192.168.30.0
R3(config-router)#network 192.168.40.0
- 查看路由表
R3#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.30.0/24 is directly connected, FastEthernet0/0
R 192.168.10.0/24 [120/2] via 192.168.30.1, 00:00:06, FastEthernet0/0
C 192.168.40.0/24 is directly connected, FastEthernet0/1
R 192.168.20.0/24 [120/1] via 192.168.30.1, 00:00:06, FastEthernet0/0
-
依据拓扑图给PC1,PC2配置IP地址和网关
PC1> ip 192.168.10.10 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.10 255.255.255.0 gateway 192.168.10.1
PC2> ip 192.168.40.40 192.168.40.1
Checking for duplicate address...
PC1 : 192.168.40.40 255.255.255.0 gateway 192.168.40.1
五.实验结果
- PC1,PC2互ping的结果
由此可见,RIP路由协议生效了