扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
1. 实验目的
1) 掌握RIP v1和RIP v2的配置方法
2) 观测动态路由的建立过程
3) 比较RIP v1和RIP v2特点
2. 实验原理
RIP(Routing information Protocol)是应用较早、使用较普遍的内部网关 协议(Interior Gateway Protocol,简称IGP),适用于小型同类网络,是典型的距离向量(distance-vector)协议。文档见RFC1058、RFC1723。
RIP通过广播UDP报文来交换路由信息,每30秒发送一次路由信息更新。RIP提供跳跃计数(hop count)作为尺度来衡量路由距离,跳跃计数是一个包到达目标所必须经过的路由器的数目。如果到相同目标有二个不等速或不同带宽的路由器,但跳跃计数相同,则RIP认为两个路由是等距离的。RIP最多支持的跳数为15,即在源和目的网间所要经过的最多路由器的数目为15,跳数16表示不可达。
RIP v2 由 RIP v1 而来,属于 RIP 协议的补充协议,主要用于扩大 RIP 2 信息装载的有用信息的数量,同时增加其安全性能。RIP 2 是一种基于 UDP 的协议。在 RIP2 下,每台主机通过路由选择进程发送和接受来自 UDP 端口520的数据包。
3. 实验过程
3.1.配置路由器各个接口IP地址
London(config)#int s0/0/1
London(config-if)#ip add 10.3.3.1 255.255.255.0
London(config-if)#no sh
London(config-if)#int lo 0
London(config-if)#ip add 10.1.1.1 255.255.255.0
London(config-if)#no sh
London(config-if)#int lo 1
London(config-if)#ip add 10.2.2.1 255.255.255.224
London(config-if)#no sh
London(config-if)#
London#ping 10.3.3.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.3.3.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/16/16 ms
3.2.配置RIP v1
London(config)#router rip
London(config-router)#net 10.0.0.0
London#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
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.3.3.0/24 is directly connected, Serial0/0/1
C 10.2.2.0/27 is directly connected, Loopback1
C 10.1.1.0/24 is directly connected, Loopback0
C 192.168.100.0/24 is directly connected, FastEthernet0/1
London#show cdp neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater
Device ID Local Intrfce Holdtme Capability Platform Port ID
Denver Ser 0/0/0 172 R S I 2811 Ser 0/0/1
sw5 Fas 0/1 126 S I WS-C3560- Fas 0/3
Florence Ser 0/0/1 159 R S I 2811 Ser 0/0/0
London#show ip rip database
10.0.0.0/8 auto-summary
10.1.1.0/24 directly connected, Loopback0
10.2.2.0/27 directly connected, Loopback1
10.3.3.0/24 directly connected, Serial0/0/1
3.3.查看Florence上的路由信息
Florence#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
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.3.0 is directly connected, Serial0/0/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.3.3.0 is directly connected, Serial0/0/0
C 192.168.1.0/24 is directly connected, Loopback0
C 192.168.100.0/24 is directly connected, FastEthernet0/1
现在是没有10.2.20/27和172.16.2.0/27这个两个IP路由信息。这是因为RIP v1不能识别子网网络地址,不支持变长子网掩码。
3.4.将RIP v1升级为RIP v2再看看网络联通情况
London(config)#router rip
London(config-router)#version 2
London#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 10.3.3.2 to network 172.16.0.0
R* 172.16.0.0/16 [120/1] via 10.3.3.2, 00:00:06, Serial0/0/1
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.3.3.0/24 is directly connected, Serial0/0/1
C 10.2.2.0/27 is directly connected, Loopback1
C 10.1.1.0/24 is directly connected, Loopback0
R 192.168.1.0/24 [120/1] via 10.3.3.2, 00:00:06, Serial0/0/1
C 192.168.100.0/24 is directly connected, FastEthernet0/1
London#show ip protocol
Routing Protocol is "ospf 1"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 10.1.1.1
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Maximum path: 4
Routing for Networks:
192.23.1.0 0.0.0.255 area 0
192.34.1.0 0.0.0.255 area 0
Reference bandwidth unit is 100 mbps
Routing Information Sources:
Gateway Distance Last Update
Distance: (default is 110)
Routing Protocol is "rip"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Sending updates every 30 seconds, next due in 8 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Default version control: send version 2, receive version 2
Interface Send Recv Triggered RIP Key-chain
Serial0/0/1 2 2
Loopback0 2 2
Loopback1 2 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
10.0.0.0
172.16.0.0
Routing Information Sources:
Gateway Distance Last Update
10.3.3.2 120 00:00:20
Distance: (default is 120)
3.5.在Florence上关闭路由自动汇总功能
London#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 10.3.3.2 to network 172.16.0.0
* 172.16.0.0/16 is variably subnetted, 4 subnets, 3 masks
R* 172.16.0.0/16 [120/1] via 10.3.3.2, 00:00:49, Serial0/0/1
R 172.16.1.0/24 [120/2] via 10.3.3.2, 00:00:22, Serial0/0/1
R 172.16.2.0/27 [120/2] via 10.3.3.2, 00:00:22, Serial0/0/1
R 172.16.3.0/24 [120/1] via 10.3.3.2, 00:00:22, Serial0/0/1
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.3.3.0/24 is directly connected, Serial0/0/1
C 10.2.2.0/27 is directly connected, Loopback1
C 10.1.1.0/24 is directly connected, Loopback0
R 192.168.1.0/24 [120/1] via 10.3.3.2, 00:00:22, Serial0/0/1
C 192.168.100.0/24 is directly connected, FastEthernet0/1
多了很多一样的路由信息,这就给路由表多了很多冗余信息,并且也增加了数据包转发的时间。
3.6.将物理接口配置为passive-interface模式
London(config)#router rip
London(config-router)#passive-interface s0/0/1
London#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
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.3.3.0/24 is directly connected, Serial0/0/1
C 10.2.2.0/27 is directly connected, Loopback1
C 10.1.1.0/24 is directly connected, Loopback0
C 192.168.100.0/24 is directly connected, FastEthernet0/1
这里由于使用passive-interface命令告知动态路由协议不要通过该接口发送网络广播,各个路由器上的路由表都没有动态更新了。
3.7.使用neighbor命令配置RIP的单播更新
London(config)#router rip
London(config-router)#neighbor 10.3.3.2
London#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
* 172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks
R 172.16.1.0/24 [120/2] via 10.3.3.2, 00:00:15, Serial0/0/1
R 172.16.2.0/27 [120/2] via 10.3.3.2, 00:00:15, Serial0/0/1
R 172.16.3.0/24 [120/1] via 10.3.3.2, 00:00:15, Serial0/0/1
10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C 10.3.3.0/24 is directly connected, Serial0/0/1
C 10.2.2.0/27 is directly connected, Loopback1
C 10.1.1.0/24 is directly connected, Loopback0
R 192.168.1.0/24 [120/1] via 10.3.3.2, 00:00:15, Serial0/0/1
C 192.168.100.0/24 is directly connected, FastEthernet0/1
London#
London#ping 172.16.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/32 ms
使用neighbor命令可以配置RIP的单播更新,这样就可以让网络重新互通。
4. 实验分析与总结
通过这次实验让我们更深刻的了解了路由表中动态路由的用法和好处。同时我们又多接触了一些Cisco IOS命令。
下面对RIP动态路由协议总结一下:
动态路由协议分为距离向量路由协议和链路状态路由协议,两种协议各有特点,下面对距离向量路由协议作简要叙述。
RIP协议最初是为Xerox网络系统的Xerox parc通用协议而设计的,是Internet中常用的路由协议。RIP采用距离向量算法,即路由器根据距离选择路由,所以也称为距离向量协议。路由器收集所有可到达目的地的不同路径,并且保存有关到达每个目的地的最少站点数的路径信息,除到达目的地的最佳路径外,任何其它信息均予以丢弃。同时路由器也把所收集的路由信息用RIP协议通知相邻的其它路由器。这样,正确的路由信息逐渐扩散到了全网。
RIP使用非常广泛,它简单、可靠,便于配置。但是RIP只适用于小型的同构网络,因为它允许的最大站点数为15,任何超过15个站点的目的地均被标记为不可达。而且RIP每隔30s一次的路由信息广播也是造成网络的广播风暴的重要原因之一。
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者