第一步:配置R1的预配置 R1(config)#int lo0 R1(config-if)#ip add 1.1.1.1 255.255.255.0 R1(config-if)#int lo1 R1(config-if)#ip add 172.17.0.1 255.255.255.0 R1(config-if)#int lo2 R1(config-if)#ip add 172.16.2.1 255.255.255.0 R1(config-if)#int lo3 R1(config-if)#ip add 172.16.1.1 255.255.255.0 R1(config-if)#^Z R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#int s1/2 R1(config-if)#ip add 172.16.3.1 255.255.255.0 R1(config-if)#no sh 第二步:配置R2的预配置 R2(config)# R2(config)#int lo0 R2(config-if)#ip add 2.2.2.2 255.255.255.0 R2(config-if)#exit R2(config)#int lo1 R2(config-if)#ip add 127.17.1.2 255.255.255.0 Not a valid host address - 127.17.1.2 R2(config-if)#exit
R2(config)#int s2/1 R2(config-if)#ip ad 172.16.3.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#exit 实验过程: 第一步:在R1上启动RIP协议 R1(config)# R1(config)#router rip R1(config-router)#network 1.1.1.1 R1(config-router)#network 127.17.0.1 R1(config-router)#network 172.16.1.1 R1(config-router)#exit R1(config)# 第二步:在R2上启动RIP协议 R2(config)#router rip R2(config-router)#network 2.2.2.2 R2(config-router)#network 172.17.1.2 R2(config-router)#network 172.16.3.2 R2(config-router)#exit 第三步:在R2上进行调试 R2#debug ip rip RIP protocol debugging is on R2#c R2#cl R2#cla R2#cle R2#clear ip route * R2# 00:18:34: RIP: sending general request on Serial2/1 to 255.255.255.255 00:18:34: RIP: sending general request on Serial2/1 to 224.0.0.9 00:18:34: RIP: sending general request on Loopback0 to 255.255.255.255 00:18:34: RIP: sending general request on Loopback0 to 224.0.0.9 00:18:34: RIP: ignored v2 packet from 2.2.2.2 (sourced from one of our addresses) 00:18:34: RIP: received v1 update from 172.16.3.1 on Serial2/1 00:18:34: 172.16.1.0 in 1 hops 00:18:34: 172.16.2.0 in 1 hops 00:18:34: 1.0.0.0 in 1 hops 00:18:34: RIP: sending v1 update to 255.255.255.255 via Serial2/1 (172.16.3.2) 00:18:34: network 2.0.0.0, metric 1 00:18:34: RIP: sending v1 update to 255.255.255.255 via Loopback0 (2.2.2.2) 00:18:34: network 1.0.0.0, metric 2 00:18:34: network 172.16.0.0, metric 1 00:18:34: RIP: received v1 update from 172.16.3.1 on Serial2/1 00:18:34: 172.16.1.0 in 1 hops 00:18:34: 172.16.2.0 in 1 hops 00:18:34: 1.0.0.0 in 1 hops R2# R2#sho ip rou 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, * - candidate default U - per-user static route, o - ODR T - traffic engineered route

Gateway of last resort is not set

R 1.0.0.0/8 [120/1] via 172.16.3.1, 00:00:22, Serial2/1 2.0.0.0/24 is subnetted, 1 subnets C 2.2.2.0 is directly connected, Loopback0 172.16.0.0/24 is subnetted, 3 subnets R 172.16.1.0 [120/1] via 172.16.3.1, 00:00:22, Serial2/1 R 172.16.2.0 [120/1] via 172.16.3.1, 00:00:22, Serial2/1 C 172.16.3.0 is directly connected, Serial2/1 R2#

② R:路由条目是通过 RIP 路由协议学习来的; ② 1.0.0.0/8:目的网络; ③ 120:RIP路由协议的默认管理距离; ④ 1: 度量值,从路由器 R1 到达网络 4.0.0.0/8 的度量值为 1跳; ⑤ 172.16.3.1:下一跳地址; ⑥ 00:00: 22:距离下一次更新还有 8(30-3)秒; ⑦ Serial2/1:接收该路由条目的本路由器的接口。 同时通过该路由条目的掩码长度可以看到,RIPv1 确实不传递子网信息。