一.RIP协议简介
1.三个版本RIPV1和RIPV2 (在IPV4中使用), RIPNG (在IPV6中使用)
2.原理简介
二.配置
1.启用Rip 并指定进程ID (进程ID 只具有本地意义)
2.选择版本
3.Network 通告并测试
4.缺省配置(路由无法到达时使用)
RIPV1:是一种有类别的距离矢量型路由协议
RIPV2:是一种无类别的距离矢量型路由协议
(1)通过发送数据包进行路由信息的交互, 路由器启动rip协议,向周围邻居路由器传递request (请求) response (响应)报文,周围路由器收到后发回回复报文,回复报文内包含有周围路由器自身的rip路由表,路由器收到周围路由器的恢复后修改自己的路由表。
(2)数据包封装基于UDP发送,端口号520 (RIPNG 521)
(3)发送方式:周期性发送, 周期更新时间为 30s ,RIPV1 使用255.255.255.255广播,RIPV2发送路由更新地址 224.0.0.9
(4)cost 计算方式: 每经过一次路由器的转发, cost值增加 1 , 最大值为15 ,16不可达。
(5)更新方式——异步更新方式(25.5-30s),每经过一个路由器后产生一个随机值(0-0.15),用这个值去乘更新时间(30s),最终得到异步更新时间范围,更新时间变化则异步更新时间跟随变化
(6)分割机制介绍
水平分割机制,适合于距离矢量型路由协议,表示不能通过接收数据的端口再将数据发出去
带毒性逆转的水平分割机制,适合于距离矢量型路由协议,cost值为16的路由(毒化路由)被路由器与路由器之间传递,并且破坏水平分割机制,通过接收接口发回确认报文,不确认则会一直传递这条毒化路由。
(7)传输时间节点
update 更新 30s
invalid 无效 180s 路由器未收到上一段路由的报文,这个路由器6次未收到报文(识别为报文丢失)后将识别上一段路由为可能不存在,放到回收计时器
垃圾回收计时器 180+120s 放入回收计时器120秒后仍未收到路由报文,则删去路由
[r1]display ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 10.1.1.1/24 up up
[r2]display ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 20.1.1.1/24 up up
GigabitEthernet0/0/1 10.1.1.2/24 up up
[r3]display ip interface brief
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/1 20.1.1.2/24 up up
[r1]rip 100
[r2]rip 100
[r3]rip 100
[r1-rip-100]version 2
[r2-rip-100]version 2
[r3-rip-100]version 2
network 1.0.0.0
(1)将本路由器上接口IP地址以1开头所有接口激活(激活代表着能发送并接收RIP的相关数据包)
(2)将激活的接口所对应的路由通告写入RIP协议
[r1-rip-100]network 1.0.0.0
[r1-rip-100]network 10.0.0.0
[r2-rip-100]network 2.0.0.0
[r2-rip-100]network 10.0.0.0
[r2-rip-100]network 20.0.0.0
[r3-rip-100]network 3.0.0.0
[r3-rip-100]network 20.0.0.0
[r2]ping 1.1.1.1
PING 1.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=10 ms
Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
--- 1.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/24/30 ms
[r2]ping 3.3.3.3
PING 3.3.3.3: 56 data bytes, press CTRL_C to break
Reply from 3.3.3.3: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=3 ttl=255 time=30 ms
Reply from 3.3.3.3: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 3.3.3.3: bytes=56 Sequence=5 ttl=255 time=10 ms
--- 3.3.3.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/20/30 ms
(1)新建环回,此时周围路由器都无法到达,符合使用缺省路由条件
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 6.6.6.6 24
(2)进入rip,写入命令
[r1]interface LoopBack 1
[r1-LoopBack1]ip address 6.6.6.6 24
(3)测试
[r2]display ip routing-table protocol rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
Destinations : 3 Routes : 3
RIP routing table status :
Destinations : 3 Routes : 3
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 RIP 100 1 D 10.1.1.1 GigabitEthernet
0/0/1
1.1.1.0/24 RIP 100 1 D 10.1.1.1 GigabitEthernet
0/0/1
3.3.3.0/24 RIP 100 1 D 20.1.1.2 GigabitEthernet
0/0/0
RIP routing table status :
Destinations : 0 Routes : 0
[r2]ping 6.6.6.6
PING 6.6.6.6: 56 data bytes, press CTRL_C to break
Reply from 6.6.6.6: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 6.6.6.6: bytes=56 Sequence=2 ttl=255 time=40 ms
Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 6.6.6.6: bytes=56 Sequence=4 ttl=255 time=10 ms
Reply from 6.6.6.6: bytes=56 Sequence=5 ttl=255 time=40 ms
--- 6.6.6.6 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/26/40 ms