RIP (Routing Information Protocol)
――路由信息协议
RIP
分两个版本(
RIPv1
和
RIPv2
)
RIP
概述:
Hop
(跳数
)
计算(最大15跳)
路由器每隔
30
秒更新
最多支持相同
hop
数的
6
条路径
RIP
是以跳数为度量值的距离矢量路由协议:
30
秒更新一次(更新计时器)
180
秒失效(失效计时器)
240
秒路由从路由表中删除
(刷新计时器)
RIP
的缺陷:
以跳数为依据过于简单,经常获得非最优路径
度量值以
15
为限,不能适合大的网络
安全性差,接收来自任何路由设备的路由更新
收敛缓慢。经常大于
5
分钟
RIPv1
利用广播更新路由信息,消耗带宽大
RIPv1
和
RIPv2
的区别:
RIPv1 RIPv2
有类路由协议
无类路由协议
不支持
VLSM(可变长子网掩码)
支持
VLSM
不支持不连续网络
支持不连续网络
以广播方式
通告信息
以组播方式通告信息
RIP
配置:
启用RIP
Router(config)#router rip
Router (config-router)#network
本地网段
启用RIPv2
Router (config-router)#version 2
为抑制RIP传播
Router (config-router)#passive-interface fa0/0
试验环境:
R1的ip地址是172.16.1.1/24(S0/0)
R2的ip地址是172.16.1.2/24 (S0/0) 172.32.1.1/24(S0/1)
R3的ip地址是172.32.1.2/24(S0/0)
先用RIPv1来做配置
R1
的基本配置:
Router> en
Router# conf t
Router(config)# host R1
r1 (config)#int s0/0
r1(config-if)#ip address 172.16.1.1 255.255.255.0
r1(config-if)#no shut
r1 (config)#router rip
r1(config-router)# network 172.16.1.0
R2
的基本配置
:
Router> en
Router#conf t
Router(config)#host r2
r2(config)#int s0/0
r2 (config-if)#ip address 172.16.1.1 255.255.255.0
r2 (config-if)#no shut
r2(config)#int s0/1
r2(config-if)#ip add 172.32.1.1 255.255.255.0
r2(config-if)#no shut
r2(config)#router rip
r2(config-router)# network 172.16.1.0
r2(config-router)# network 172.32.1.0
R3
的基本配置:
Router>en
Router#conf t
Router(config)#host r3
r3(config)#int s0/0
r3(config-if)#ip add 172.32.1.2 255.255.255.0
r3(config-if)#no shut
r3(config)#router rip
r3(config-router)# network 172.32.1.0
查看:
R1
r1#sh ip route
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, 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.1.0 is directly connected, Serial0/0
R 172.32.0.0/16 [120/1] via 172.16.1.2, 00:00:16,Serial0/0
R2
r2#sh ip route
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, 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.1.0 is directly connected, Serial0/0
172.32.0.0/24 is subnetted, 1 subnets
C 172.32.1.0 is directly connected, Serial0/1
R3
r1# sh ip route
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, 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
R 172.16.0.0/16 [120/1] via 172.32.1.1, 00:00:15, Serial0/0
172.32.0.0/24 is subnetted, 1 subnets
C 172.32.1.0 is directly connected, Serial0/0
测试:
r1#ping 172.16.1.2
r1#ping 172.32.1.1
r1#ping 172.32.1.2
再用
RIPv2
来做配置
R1
的基本配置:
Router> en
Router# conf t
Router(config)# host R1
r1 (config)#int s0/0
r1(config-if)#ip address 172.16.1.1 255.255.255.0
r1(config-if)#no shut
r1 (config)#router rip
r1(config-router)#version 2
r1(config-router)# network 172.16.1.0
R2
的基本配置
:
Router> en
Router#conf t
Router(config)#host r2
r2(config)#int s0/0
r2 (config-if)#ip address 172.16.1.1 255.255.255.0
r2 (config-if)#no shut
r2(config)#int s0/1
r2(config-if)#ip add 172.32.1.1 255.255.255.0
r2(config-if)#no shut
r2(config)#router rip
r2(config-router)#version 2
r2(config-router)# network 172.16.1.0
r2(config-router)# network 172.32.1.0
R3
的基本配置:
Router>en
Router#conf t
Router(config)#host r3
r3(config)#int s0/0
r3(config-if)#ip add 172.32.1.2 255.255.255.0
r3(config-if)#no shut
r3(config)#router rip
r3(config-router)#version 2
r3(config-router)# network 172.32.1.0
查看
r1#sh run
r1#sh ip protocols
r2#sh run
r2#sh ip protocols
r3#sh run
r3#sh ip protocols
r1#ping 172.32.1.2
完成
本文出自 “李俊鹏” 博客,转载请与作者联系!