在本实验中演示使用RIP协议处理不连续的子网和VLSM的情况。

1.实验目的

通过本实验,读者可以掌握以下技能:

使用RIP协议处理不连续的子网;

使用RIP协议处理VLSM;

查看RIP协议配置信息;

使用Debug命令。

2. 设备需求

本实验的设备需求与实验1相同。

3. 拓扑结构及配置说明

本实验拓扑结构如图5-2所示,大都与5-1相同,所不同的是IP地址分配。

IP地址分配如下:

R1:E0 172.18.1.1,s0 172.16.12.1,S1 172.16.]3.1;

R2:E0 172.18.2.2,S0 172.16.12.2,S1 172.16.23.2;

R3:E0 172.18.3.3,S0 172.16.13.3,S1 172.16.23.3。

子网掩码均为255.255.255.0。

使用RIP协议处理不连续的子网和VLSM

这是一个典型的不连续子网的情况,实验要求通过对RIP协议的配置,实现全网的连通性。

在完成上述实验的基础上,我们还将对可变长子网掩码 (VLSM)的情况进行配置。

4.实验配置及监测结果

我们首先在完成实验1的基础上,配置3台路由器的E0接口,更改其IP地址。实验记录是从这个操作完成之后开始的,见配置清单5-3。

配置清单5-3使用RIP协议处理不连续的子网

R3#cle ip route *

R3#sh ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, 0 - 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

172.16.0.0/24 is subnetted, 3 subnets

R 172.16.23.0 is directly connected. Serial 1

C 172.16.12.0 [120/1] via 172.16.13.1, 00:00:01, Serial0

C 172.16.13.0 is directly connected, Serial0

172.18.0,0/24 is subnetted, 1 subnets

C 172.18.3.0 is directly connected, Ethemet0

R3#conft

Enter configuration commands, one per line. End with CNTL/Z.

R3(config)#router rip

R3(config-router)#version 2

R3(config-router)#

Term_Server>2

[Resuming connection 2 to R2 ... ]

R2(config-router)#router rip

R2(config-router)#version 2

R2(config-router)#

Term_Server>1

[Resuming connection 1 to R1 ...]

R1(config-router)#router rip

R1(config-router)#version 2

R1(config-router)#

R1(config-router)#^Z

R1#cle lp route *

R1#debug ip rip

RIP protocol debugging is on

R1#

01:38:59: RIP: received v2updatefrom 172.16.12.2 on Serial0

01:38:59: 172.16.23.0/24 via 0.0.0.0 in 1 hops

01:38:59: 172.18.0.0/16 Via 0.0.0.0 in 1 hops

01:39:10: RIP: received v2updatefrom 172.16.13.3 on Serial1

01:39:10: 172.16.23.0/24 via 0.0.0.0 in 1 hops

01:39:10: 172.18.0/16 via 0.0.0.0 in 1 hops

01:39:12: RIP: sending v2updateto 224.0.0.9 Via Serial0 (172.16.12.1)

01:39:12: RIP: buildupdateentries

01:39:12: 172.16.13.0/24 via0.0.0.0,metric 1,tag 0

01:39:12: RIP: rending v2updateto 224.0.0.9 via Serial1 (172.16.13.1)

01:39:12: RIP: buildupdateeyries

01:39:12: 172.16.12.0/24 via 0.0.0.0, metric 1, tag.0

R1#undebug all

All possible debugging has been turned off

R1#sh ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, 0 - 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

172.16.0.0/24 is subnetted, 3 subnets

R 172.16.23.0 [120/1] via 172.16.12.2, 00:00:07, Serial0

[120/1] via 172.16.13.3, 00:00:23, Serial1

C 172.16.12.0 is directly connected, Serial0

C 172.16.13.0 is directly connected, Serial1

172.18.0.0/16 is variably subnetted, 2 subnets, 2 masks

C 172.18.1.0/24 is directly connected, Ethernet0

R1#ping 172.18.2.2

Type escape sequence to abort.

Sending 5,100-byte ICMP Echos to 172.18.2.2,timeout is 2 seconds:

!!!!!

Success rate is 100 percent(5/5),round-trip min/avg/max=8/23/48 ms

(1)使用clear ip route,命令清除路由表,目的是重新生成路由表,以便反映最新的变化,而不必等待原有路由表项的超时。

(2)当3台路由器的E0接口都配置了172.18.0.0网络的不同网段的时候。实际上就意味着172.18.0.0的网络被172.16.0.0的网络所隔开,从而形成不连续的于网。

show ip route命令显示了R3路由器没有学习到172.18.2.0和172.18.3.0网段存在的信息,因为路由表中没有通过RIP协议得到的172.18.0.0相关项。

产生上述结果的原因是RIP v1没有传送于网掩码的能力,同时在类的边界进行自动汇总操作,这样会把由S0和S1接口收到的关于]72.18.0.0的路由表项滤掉,不进入路由表,因为从R3的角度来看,对于172.18.0.0网络它有更好的路由通过E0接口直接相连的路由。

(3)通过在RIP协议配置模式下使用version2命令指定其版本号为3后,可以解决上面遇到的问题。因为RIPv2支持不连续的于网。

(4)同样使用clear ip route本命令以便反映最新的变化。

(5)使用debug ip rip命令监测RIP更新操作,结果表明RIPv2使用组播地址(224.0.0.9)进行路由更新,同时在路由更新中包含了于网掩码的信息,这样RIPv2便可以处理存在不连续的子网的拓扑。

(6)ship route显示RIP版本2的使用解决了不连续子网的问题。

接下来我们演示使用RIP处理VLSM的情形。

为3台路由器的不同接口分配相应的吧地址和于网掩码如下

R1 E0 172.18.1.1 255.255.255.240

R1 S0 172.16.123.1 255.255.255.252

R1: S1 172.16.123.5 255.255.255.252

R2, E0 172.18.2.2 255.255.255.240

R2, S0 172.16.123.2 255.255.255.252

R2: S1 172.16.123.9 255.255.255.252

R3: E0 172.18.3.3 255.255.255.0

R3: S0 172.16.123.6 255.255.255.252

R3: S1 172.16.123.10 255.255.255.252

网段划分和拓扑结构如图5-3所示。

首先把IP地址按要求配置到各接口上,并且启动RIP路由协议并声明网络,接下来的实验操作见监测清单5-2。

使用RIP协议处理不连续的子网和VLSM

首先把IP地址按要求配置到各接口上,并且启动RIP路由协议并声明网络,接下来的实验操作见监测清单5-2。

监测清单5-2使用RIP协议处理VLSM和配置被动接口

第1段:RIPv1配置下的路由表

R3#sh ip route rip

172.16.0.0/30 is subnetted, 3 subnets

R 172.16.123.0 [120/1] via l72.16.123.5,00:00:12,Serial0

[120/1] via l72.16.123.9,00:00:12,Serial1

第2段:配置RIPv2和no summary

R3#conft

Enter configuration commands, one per line. End with CNTL/Z.

R3(config)#router rip

R3(config-router)#ver 2

R3 (config-router)#no auto-summary

Term_Server>2

[Resuming connection 2 to R2 ... ]

R2#conf t

Enter configuration commands, one per line. End with CNTL/Z.

R2(config)#router rip

R2(config-router)#ver 2

R2(config-router)#no auto-summary