RIP概述
RIP也称距离矢量协议,用信息包所经过的网关来做距离的单位,超过15跳便无法到达
RIP是通过UDP端口520来进行操作的,RIP信息包是封装在UDP segment中的.RIP定义了2种信息类型
Request message(请求信息)和Response message(应答信息).请求信息是用来向邻居请求发送一个update(更新),应答信息运载着这个被请求的update.
RIP的 metric是基于hop count(跳数)的,metric为16代表不可达
RIPv2 与 RIPv1 的区别
- 是个无类的路由协议
- 组播(224.0.0.9)路由更新(不用广播)
- 支持 VLSM(在更新过程中发送掩码)
- 支持手动汇总
- 支持 (MD5) 或者 纯文本认证
RIP 配 置
Router(config)#router rip
激活RIP协议
Router(config-router)# version 2
启用RIPv2
Router(config-router)#network network-number
选择需要激活的接口所在的网段
用试验验证RIPv2的配置:
试验环境如下:
试验环境说明:
R1的ip地址为10.1.1.1 (S0/0) 网络掩码为255.255.255.0
R2的ip地址为 10.1.1. 2 (S0/0) 10.2.2.2 (S0/1) 网络掩码为255.255.255.0
R3的ip地址为 10.2.2.3 (S0/1) 网络掩码为255.255.255.0
R1的S0/0 R2的S0/1 为DCE端
试验要求:在路由器间配置RIPv2 使路由器间相互ping通。
下面开始试验(红色字体为配置内容)
R1
Router>en
Router#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
Router(config)#host r1
r1(config)#int s0/0
r1(config-if)#ip addr 10.1.1.1 255.255.255.0
r1(config-if)#no shut
r1(config-if)#clock rate 64000
r1(config-if)#exit
r1(config)#router rip
r1(config-router)#ver 2
r1(config-router)#network 10.0.0.0
R2
Router>en
Router#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
Router(config)#host r2
r2(config)#int s0/0
r2(config-if)#ip addr 10.1.1.2 255.255.255.0
r2(config-if)#no shut
r2(config-if)#exit
r2(config)#int s0/1
r2(config-if)#ip addr 192.168.1.1 255.255.255.0
r2(config-if)#clock rate 64000
r2(config-if)#no shut
r2(config-if)#exit
r2(config)#router rip
r2(config-router)#ver 2
r2(config-router)#network 10.0.0.0
r2(config-router)#network 192.168.1.0
R3
Router>en
Router#conf t
Enter configuration commands, .e per line. End with CNTL/Z.
Router(config)#host r3
r3(config)#int s0/1
r3(config-if)#ip addr 192.168.1.2 255.255.255.0
r3(config-if)#no shut
r3(config-if)#exit
r3(config)#router rip
r3(config-router)#ver 2
r3(config-router)#network 192.168.1.0
在路由器 R1 R2 R3上show ip route 查看路由表信息
R1
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
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial0/0
R 192.168.1.0/24 [120/1] via 10.1.1.2, 00:00:54, Serial0/0
R2
r2#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
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial0/0
C 192.168.1.0/24 is directly connected, Serial0/1
R3
r3>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
R 10.0.0.0/8 [120/1] via 192.168.1.1, 00:00:15, Serial0/1
C 192.168.1.0/24 is directly connected, Serial0/1
在路由器R1上 show ip protocols 查看路由协议 如下内容所示 路由器之间通讯协议为rip
r1#show ip protocols
Routing Protocol is "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 10 seconds
Invalid after 180 seconds, hold down 180, flushed after 240
Redistributing: rip
Default version control: send version 2, receive version 2
Interface Send Recv Triggered RIP Key-chain
Serial0/0 2 2
Automatic network summarization is in effect
Maximum path: 4
Routing for Networks:
10.0.0.0
Routing Information Sources:
Gateway Distance Last Update
10.1.1.2 120 00:00:16
Distance: (default is 120)
在R1上对R3 R4 进行ping 测试,如下所示,全部ping通啦
r1#ping 10.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 144/402/576 ms
r1#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 140/258/500 ms
r1#ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 356/548/860 ms
OK 试验成功
本文转自 范琳琳 51CTO博客,原文链接:http://blog.51cto.com/fanlinlin/132305,如需转载请自行联系原作者