实验名称:RIPv2配置

实验目的:

通过本实验可以掌握:

(1)在路由器上启动 RIPv1 路由进程

(2)启用参与路由协议的接口,并且通告网络

(3)理解路由表的含义

(4)查看和调试 RIPv1 路由协议相关信息

拓扑结构

实验拓扑如图 4-1 所示。

wKioL1ghmbXxHOHCAAAuImy6z3E656.png-wh_50


实验步骤:

(1)步骤 1:配置路由器 R1

R1(config)# router rip //启动 RIP 进程

R1(config-router)# version 1 //配置 RIP 版本 1

R1(config-router)# network 1.0.0.0 //通告网络

R1(config-router)# network 192.168.12.0

(2)步骤 2:配置路由器 R2

R2(config)# router rip

R2(config-router)# version 1

R2(config-router)# network 192.168.12.0

R2(config-router)# network 192.168.23.0

(3)步骤 3:配置路由器 R3

R3(config)# router rip

R3(config-router)# version 1

R3(config-router)# network 192.168.23.0

R3(config-router)# network 192.168.34.0

(4)步骤 4:配置路由器 R4

R4(config)# router rip

R4(config-router)# version 1

R4(config-router)# network 192.168.34.0

R4(config-router)# network 4.0.0.0

4.实验调试

(1)  show ip route

该命令用来查看路由表。

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.12.0/24 is directly connected, Serial0/0/0

1.0.0.0/24 is subnetted, 1 subnets

C 1.1.1.0 is directly connected, Loopback0

R 4.0.0.0/8 [120/3] via 192.168.12.2, 00:00:03, Serial0/0/0

R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:03, Serial0/0/0

R 192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:03, Serial0/0/0

R 4.0.0.0/8 [120/3] via 192.168.12.2, 00:00:03, Serial0/0/0

R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:03, Serial0/0/0

R 192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:03, Serial0/0/0

以上输出表明路由器 R1 学到了 3 条 RIP 路由,其中路由条目“R 4.0.0.0/8 [120/3]

via 192.168.12.2, 00:00:03, Serial0/0/0

R 4.0.0.0/8 [120/3]

via 192.168.12.2, 00:00:03, Serial0/0/0”的含义如下:

① R:路由条目是通过 RIP 路由协议学习来的;

② 4.0.0.0/8 :目的网络;

③ 120:RIP 路由协议的默认管理距离;

④ 3: 度量值,从路由器 R1 到达网络 4.0.0.0/8 的度量值为 3 跳;

⑤ 192.168.12.2:下一跳地址;

⑥ 00:00:03:距离下一次更新还有 27(30-3)秒;

⑦ Serial0/0/0:接收该路由条目的本路由器的接口。

同时通过该路由条目的掩码长度可以看到,RIPv1 确实不传递子网信息。

(2)show ip protocols

该命令查看 IP 路由协议配置和统计信息。

R1# show ip protocols

【注意 】

“//”后的信息表示注释,不是输出内容。

Routing Protocol is "rip"

//路由器上运行的路由协议是 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 23 seconds

//更新周期是 30 秒,距离下次更新还有 23 秒

【注意 】

为了防止更新同步,RIP 会以 15%的误差发送更新,即实际发送更新的周期的范围是

25.5-30 秒。

Invalid after 180 seconds, hold down 180, flushed after 240

// invalid after:路由条目如果在 180 秒还没有收到更新,则被标记为无效

【技术要点 】

被标记为无效的路由条目类似如下所示:

R 4.0.0.0/8 is possibly down, routing via 192.168.12.2, Serial0/0/0

可以通过很多方式使路由条目进入无效周期,例如在接口上加拒绝接收 UDP520 端口的

ACL,还比如将接口设置为被动接口等。

// hold down:抑制计时器的时间为 180 秒

// flushed after:路由条目如果在 240 秒还没有收到更新,则从路由表中删除此路由条目

【提示 】

可以通过下面的命令来调整以上三个时间参数:

R1(config-router)# timers basic  update invalid holddown flushed

Redistributing: rip

//只运行 RIP 协议,没有其它的协议重分布进来

Default version control: send version 1, receive version 1

//默认发送版本 1 的路由更新,接收本版 1 的路由更新

Interface Send Recv Triggered RIP Key-chain

Serial0/0/0 1 1

Loopback0 1 1

//以上三行显示了运行 RIP 协议的接口,以及可以接收和发送的 RIP 路由更新的版本

Automatic network summarization is in effect

//RIP 路由协议默认开启自动汇总功能

Maximum path: 4

//RIP 路由协议可以支持 4 条等价路径,最大为 6 条

【提示 】

可以通过下面的命令来修改 RIP 路由协议支持等价路径的条数:

R1(config-router)# maximum-paths number-paths

Routing for Networks:

1.0.0.0

192.168.12.0

//以上三行表明 RIP 通告的网络

Routing Information Sources:

Gateway Distance Last Update

192.168.12.2 120 00:00:03

//以上三行表明路由信息源,其中:

// gateway:学习路由信息的路由器的接口地址,也就是下一跳地址

// distance:管理距离

// last update:更新发生在多长时间以前

Distance: (default is 120)

//默认管理距离是 120

(3)debug ip rip

该命令可以查看 RIP 路由协议的动态更新过程。

R1#clear ip route *

R1#debug ip rip

clear ip route *

R1#debug ip rip

Feb 9 12:43:13.311: RIP: sending request on Serial0/0/0 to 255.255.255.255

Feb 9 12:43:13.315: RIP: sending request on Loopback0 to 255.255.255.255

Feb 9 12:43:13.323: RIP:  received v1 update from 192.168.12.2 on  Serial0/0/0

Feb 9 12:43:13.323: 4.0.0.0 in 3 hops

Feb 9 12:43:13.323: 192.168.23.0 in 1 hops

Feb 9 12:43:13.323: 192.168.34.0 in 2 hops

Feb 9 12:43:15.311: RIP:  sending v1 flash update to  255.255.255.255 via  Loopback0 (1.1.1.1)

Feb 9 12:43:15.311: RIP: build flash update entries

Feb 9 12:43:15.311: network 4.0.0.0 metric 4

Feb 9 12:43:15.311: network 192.168.12.0 metric 1

Feb 9 12:43:15.311: network 192.168.23.0 metric 2

Feb 9 12:43:15.311: network 192.168.34.0 metric 3

Feb 9 12:43:15.311: RIP:  sending v1 flash update to  255.255.255.255 via  Serial0/0/0

(192.168.12.1)

Feb 9 12:43:15.311: RIP: build flash update entries

Feb 9 12:43:15.311: network 1.0.0.0 metric 1

通过以上输出,可以看到 RIPv1 采用广播更新(255.255.255.255),分别向 Loopback0

和 s0/0/0 发送路由更新,同时从 s0/0/0 接收三条路由更新,分别是 4.0.0.0,度量值是 3

跳;192.168.34.0, 度量值是 2 跳;192.168.23.0,度量值是 1 跳。

【技术要点】

flash update

flash update(闪式更新)指的是当网络上某个路径的度量值发生变化,路由器立即

发出更新信息,而不管是否到达常规路由信息更新的周期。

实验过程图:

wKioL1ghmhOiEbXxAAAPWmjdGhQ091.png-wh_50

wKiom1ghmhPyAGqBAAAJMPcwyY4511.png-wh_50

wKioL1ghmhPwnJMiAAAJ1FK5Afc873.png-wh_50

wKiom1ghmhPRIRc6AAApalaLqaw095.png-wh_50

wKioL1ghmhSSmSFgAAAKUOg0zuI729.png-wh_50

wKiom1ghmhSBAhTOAAAlPjBkcM0132.png-wh_50

wKiom1ghmhSi4lqYAAAITg1H2V8122.png-wh_50

wKioL1ghmhTCvZ3rAAAH7M3Pd2c475.png-wh_50