R0 :
R0(config)#int lo0
R0(config-if)#ip add 1.1.1.1 255.255.255.0
R0(config-if)#no sh
R0(config-if)#int s0/0
R0(config-if)#ip add 12.1.1.1 255.255.255.0
R0(config-if)#clo r 64000
R0(config-if)#no sh
R0(config-if)#exit
R0(config)#router rip
//启动
RIP进程
R0(config-router)#v 1
//配置
RIP版本1
R0(config-router)#network 1.0.0.0
//通告网络
R0(config-router)#network 12.0.0.0
R1 :
R1(config)#int lo0
R1(config-if)#ip add 2.2.2.2 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int s0/1
R1(config-if)#ip add 12.1.1.2 255.255.255.0
R1(config-if)#no sh
R1(config-if)#int s0/0
R1(config-if)#ip add 13.1.1.1 255.255.255.0
R1(config-if)#clo r 64000
R1(config-if)#no sh
R1(config-if)#exit
R1(config)#router rip
R1(config-router)#version 1
R1(config-router)#network 2.0.0.0
R1(config-router)#network 12.0.0.0
R1(config-router)#network 13.0.0.0
R2 :
R2(config)#int lo0
R2(config-if)#ip add 3.3.3.3 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int s0/1
R2(config-if)#ip add 13.1.1.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#exit
R2(config)#router rip
R2(config-router)#version 1
R2(config-router)#network 13.0.0.0
R2(config-router)#network 3.0.0.0
(1) show ip route
该命令用来查看路由表。
R0#sh ip ro
R0#sh 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
1.0.0.0/24 is subnetted, 1 subnets
C
1.1.1.0 is directly connected, Loopback0
R
2.0.0.0/8 [120/1] via 12.1.1.2, 00:00:14, Serial0/0
R
3.0.0.0/8 [120/1] via 12.1.1.2, 00:00:14, Serial0/0
12.0.0.0/24 is subnetted, 1 subnets
C
12.1.1.0 is directly connected, Serial0/0
R 13.0.0.0/8 [120/1] via 12.1.1.2, 00:00:14, Serial0/0
注意:
R:路由条目是通过RIP路由协议学习来的;
13.0.0.0/8:目的网络;
120:RIP路由协议的默认管理距离;
1: 度量值,从路由器R0到达网络13.0.0.0/8的度量值为1跳;
12.1.1.2:下一跳地址;
00:00:14:距离下一次更新还有16(30-14)秒;
Serial0/0:接收该路由条目的本路由器的接口。
同时通过该路由条目的掩码长度可以看到,RIPv1确实不传递子网信息。
(2)show ip protocols
该命令查看IP路由协议配置和统计信息。
R0#sh ip pro
R0#sh 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 18 seconds
//更新周期是30秒距离下次更新还有18秒
Invalid after 180 seconds, hold down 180, flushed after 240
//路由条目在180秒没有收到更新则被标记为无效, hold down:抑制计时器的时间为180秒, 在240秒还没有收到更新,则从路由表中删除此路由条目
Redistributing: rip
//只运行RIP,没其他协议重分布进来
Default version control: send version 1, receive version 1
//默认发送接受版本1路由更新。
Interface Send Recv Triggered RIP Key-chain
Serial0/0 1 1
Loopback0 1 1
Automatic network summarization is in effect
//RIP默认开启自动汇总功能
Maximum path: 4
//RIP路由协议可以支持4条等价路径,最大6条。
Routing for Networks:
//RIP通告的网络
1.0.0.0
12.0.0.0
Routing Information Sources:
//gateway:学习路由信息的路由器的接口地址,也就是下一跳地址
Gateway
Distance Last Update //distance:
管理距离
12.1.1.2 120 00:00:25 //last update:
距离上次更新时间
Distance: (default is 120)
//默认管理距离是120
(3)debug ip rip
该命令可以查看RIP路由协议的动态更新过程
R0#debug ip rip
RIP protocol debugging is on
R0#
*Mar 1 00:37:00.495: RIP: sending v1 update to 255.255.255.255 via Loopback0 (1.1.1.1)
*Mar 1 00:37:00.499: RIP: build update entries
*Mar 1 00:37:00.499:
network 2.0.0.0 metric 1
*Mar 1 00:37:00.503:
network 3.0.0.0 metric 1
*Mar 1 00:37:00.503:
network 12.0.0.0 metric 1
*Mar 1 00:37:00.507:
network 13.0.0.0 metric 1
R0#clear ip ro
R0#clear ip route *
R0#
*Mar 1 00:37:12.979: RIP: sending request on Serial0/0 to 255.255.255.255
*Mar 1 00:37:12.983: RIP: sending request on Serial0/0 to 255.255.255.255
*Mar 1 00:37:12.991: RIP: sending request on Loopback0 to 255.255.255.255
*Mar 1 00:37:12.995: RIP: sending request on Loopback0 to 255.255.255.255
*Mar 1 00:37:13.055: RIP: sending request on Loopback0 to 255.255.255.255
*Mar 1 00:37:13.055: RIP: sending request on Serial0/0 to 255.255.255.255
*Mar 1 00:37:13.127: RIP: received v1 update from 12.1.1.2 on Serial0/0
*Mar 1 00:37:13.131:
2.0.0.0 in 1 hops
*Mar 1 00:37:13.135:
3.0.0.0 in 1 hops
*Mar 1 00:37:13.139:
13.0.0.0 in 1 hops
R0#
*Mar 1 00:37:13.143: RIP: received v1 update from 12.1.1.2 on Serial0/0
*Mar 1 00:37:13.147:
2.0.0.0 in 1 hops
*Mar 1 00:37:13.147:
3.0.0.0 in 1 hops
*Mar 1 00:37:13.151:
13.0.0.0 in 1 hops
*Mar 1 00:37:13.151: RIP: received v1 update from 12.1.1.2 on Serial0/0
*Mar 1 00:37:13.155:
2.0.0.0 in 1 hops
*Mar 1 00:37:13.155:
3.0.0.0 in 1 hops
*Mar 1 00:37:13.159:
13.0.0.0 in 1 hops
R0#
*Mar 1 00:37:15.007: RIP: sending v1 flash update to 255.255.255.255 via Loopback0 (1.1.1.1)
*Mar 1 00:37:15.011: RIP: build flash update entries
*Mar 1 00:37:15.011:
network 2.0.0.0 metric 1
*Mar 1 00:37:15.015:
network 3.0.0.0 metric 1
*Mar 1 00:37:15.015:
network 12.0.0.0 metric 1
*Mar 1 00:37:15.019:
network 13.0.0.0 metric 1
*Mar 1 00:37:15.019: RIP: sending v1 flash update to 255.255.255.255 via Serial0/0 (12.1.1.1)
*Mar 1 00:37:15.023: RIP: build flash update entries
*Mar 1 00:37:15.023:
network 1.0.0.0 metric 1
R0#
*Mar 1 00:37:20.663: RIP: received v1 update from 12.1.1.2 on Serial0/0
*Mar 1 00:37:20.667:
2.0.0.0 in 1 hops
*Mar 1 00:37:20.671:
3.0.0.0 in 1 hops
*Mar 1 00:37:20.671:
13.0.0.0 in 1 hops
总结:RIPv1采用广播更新(255.255.255.255),分别向Loopback0 和s0/0发送路由更新,同时从s0/0接收三条路由更新。