RIP:Routing Information Protocol。RFC1058.

  • 距离矢量协议:有间隔的多少和方向。传递的是路由条目。每个路由器不知道网络的完整拓扑结构,OSPF知道。

  • 度量值:每种协议都有会计算出发点到目的地之间的度量也就是单位。rip的度量值(单位)是跳数。跳数超过15就不往后传播了,也就是无法到达目的地。

  • 每30秒收敛一次。

    收敛:前面的路由会定期把自己的整个路由表发送给后面的路由器。rip是每30秒发送一次。

  • rip有2个版本:

    • V1(版本1:有类路由)使用广播把路由表发送给下一个路由器。只传递ip地址,不传递子网掩码。
    • V2(版本2:无类路由)使用组播,组播地址:224.0.0.9。既传递ip地址,又传递子网掩码。
  • 管理距离(AD):120。

    路由表里中括号里的值就是管理距离。当用不同的协议,获得了相同的路由时,看哪个协议获得的路由的管理距离小,路由表里只能留下一个路由,留管理距离小的路由。

    例如:如果有下面2条路由,则只能留下[1/0]的路由,因为管理距离小。

    S    192.168.1.0/24 [1/0] via 192.168.0.2    192.168.1.0/24 [1/0] via 192.168.0.2
    R 192.168.1.0/24 [100/0] via 192.168.0.2 192.168.1.0/24 [1/0] via 192.168.0.2
  • 使用UDP协议传输

  • 源和目的端口号都是520

  • 报文形式:请求和响应报文,使用的格式相同。

  • 默认支持等价负载均衡:4,最大可调到6.

RIP计时器

  • 更新计时器(update):每30秒接收一次相邻路由器的更新请求(收敛)
  • 无效计时器(invalid):180秒后相邻的路由器不给我路由表,把到这些路由的度量值更新为16,也就是不可达。
  • 刷新计时器(flush):默认240秒后,相邻的路由器不给我路由表,则把这些路由全部删除。
  • 抑制计时器(hold-down):180秒。

RIPv1:

  • 有类路由协议
  • 不支持变长子网掩码(VLSM)
  • 广播方式发包
  • 不支持认证
  • 每个更新包最大支持25条路由条目
  • 路由表查询方式为主类网段
  • 不支持不连续子网

RIPv2:

  • 无类路由协议
  • 支持变长子网掩码
  • 组播方式发包,目的地址:224.0.0.9
  • 支持明文及密文认证(cisco才支持)
  • 路由表查询机制是由小类->大类(按位查询,最长匹配,精准匹配,先检查32位掩码的)
  • 支持不连续子网

添加路由器的loopback(换回接口,类似pc里的127.0.0.1)

添加后,接口立即生效,不需要开启(no sh)。

#interface loopback ?
<0-2147483647> Loopback interface number
R1(config)#interface loopback 0
R1(config-if)#
*Mar 1 00:08:43.587: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up

添加后,在路由器上就多了一个虚拟接口

R1#show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.1.1.1 YES manual up up
Loopback0 1.1.1.1 YES manual up up

给换回接口添加ip,注意子网掩码必须是255.255.255.255.代表主机的意思。

R1(config-if)#ip addr 1.1.1.1 255.255.255.255

启动路由器的RIP协议:

1,进入全局模式,启动rip

R1(config)#router rip
R1(config-router)#

2,指定使用哪个版本的rip。如果不指定版本的话,使用的既不是版本1,也不是版本2,而是1和2中间的版本,具体来说是:以广播方式发送,既能接收广播的也能接收组播的。

R1(config-router)#version 2
R1(config-router)#

3,关闭自动汇总:no auto-summary

R1(config-router)#no auto-summary
R1(config-router)#

什么是自动汇总?接口上的ip假如是12.1.1.1/24 ,自动汇总后,就变成了12.0.0.0/8,就相当于变成了版本1的有类路由协议了,不能精确到子网,所以,才要关闭自动汇总。

4,告诉路由器,我要把本地的哪个直连(C)的接口上的网段,用于rip协议,发送和接收rip包

R1:

R1(config-router)#do show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.1.1.1 YES manual up up
FastEthernet1/0 unassigned YES unset administratively down down
Loopback0 1.1.1.1 YES manual up up
R1(config-router)#do show ip route
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0
R1(config-router)#network 1.1.1.1
R1(config-router)#net 12.1.1.0
R1(config-router)#

R2:

R2#show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.1.1.2 YES manual up up
FastEthernet1/0 23.1.1.2 YES manual up up
Loopback0 2.2.2.2 YES manual up up
R2#show ip route
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#router rip
R2(config-router)#net 2.2.2.2
R2(config-router)#net 23.1.1.0
R2(config-router)#net 12.1.1.0

R3:

R3#show ip int b
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 23.1.1.3 YES manual up up
FastEthernet1/0 unassigned YES unset administratively down down
Loopback0 3.3.3.3 YES manual up up
R3#show ip route
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet0/0
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#router rip
R3(config-router)#ver 2
R3(config-router)#no au
R3(config-router)#net 3.3.3.3
R3(config-router)#net 23.1.1.0

R1,2,3配置完RIP的路由条目结果:

R1的路由条目:

注意:R 3.3.3.3 [120/2]里面的【2】,含义:到目标网络需要2跳

R1#show ip route
1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
2.0.0.0/32 is subnetted, 1 subnets
R 2.2.2.2 [120/1] via 12.1.1.2, 00:00:22, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
R 3.3.3.3 [120/2] via 12.1.1.2, 00:00:22, FastEthernet0/0
23.0.0.0/24 is subnetted, 1 subnets
R 23.1.1.0 [120/1] via 12.1.1.2, 00:00:22, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0

R2的路由条目:

R2#show ip route
1.0.0.0/32 is subnetted, 1 subnets
R 1.1.1.1 [120/1] via 12.1.1.1, 00:00:21, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
3.0.0.0/32 is subnetted, 1 subnets
R 3.3.3.3 [120/1] via 23.1.1.3, 00:00:07, FastEthernet1/0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet1/0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, FastEthernet0/0

R3的路由条目:

R3#show ip route
1.0.0.0/32 is subnetted, 1 subnets
R 1.1.1.1 [120/2] via 23.1.1.2, 00:00:15, FastEthernet0/0
2.0.0.0/32 is subnetted, 1 subnets
R 2.2.2.2 [120/1] via 23.1.1.2, 00:00:15, FastEthernet0/0
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
R 12.1.1.0 [120/1] via 23.1.1.2, 00:00:15, FastEthernet0/0

33-35集讲RIP协议

# c/c++ 学习互助QQ群:877684253
![](https://img2018.cnblogs.com/blog/1414315/201811/1414315-20181106214320230-961379709.jpg)
# 本人微信:xiaoshitou5854

动态路由协议 RIP的更多相关文章

  1. 1.3-动态路由协议RIP①

    Dynamic Routing Protocol:动态路由协议 现代IP网络中,主要的动态路由协议: AD/管理距离: 1:DV/距离向量协议:RIP(120)/IGRP(100) 2:LS/链路状态 ...

  2. 动态路由协议RIP

    RIP Routing Information Protocol,属IGP协议,是距离矢量型动态路由协议(直接发送路由信息的协议为距离矢量型协议),使用UDP协议,端口号520. 贝尔曼福特算法 RI ...

  3. 路由与交换,cisco路由器配置,动态路由协议—RIP

    一.动态路由协议分类 动态路由协议包括IGP(内部网关协议)和EGP(外部网关协议). 1.IGP IGP又包括距离向量路由协议和链路状态路由协议. (1)距离向量路由协议典型代表:RIP (2)链路 ...

  4. HCNA Routing&Switching之动态路由协议RIP

    前文我们了解了动态路由的基本概念,以及动态路由和静态路由的区别,优缺点,动态路由的分类,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/14995317.html ...

  5. 距离矢量路由协议——RIP

    距离矢量路由协议RIP: 众所周知,RIP(Routing Information Protocol),即路由信息协议,是一种距离矢量路由协议,它与IGRP,OSPF等一样都是属于IGP(Interi ...

  6. HCNA Routing&Switching之动态路由协议OSPF基础(一)

    前文我们了解了基于路径矢量算法的动态路由协议RIP防环以及度量值的修改相关话题,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15012895.html:今天我 ...

  7. (ospf、rip、isis、EIGRP)常见的动态路由协议简介

    路由器要转发数据必须先配置路由数据,通常根据网络规模的大小可设置静态路由或设置动态路由.静态路由配置方便,对系统要求低,适用于拓扑结构简单并且稳定的小型网络.缺点是不能自动适应网络拓扑的变化,需要人工 ...

  8. 动态路由协议(RIP)

    虽然静态路由在某些时刻很有用,但是必须手工配置每条路由条目,对于大中型的网络或拓补经常发生变化的清空,配置和维护静态路由的工作量就变得非常繁重,而且不小心还容易出错,因此就需要一种不需要手工配置的路由 ...

  9. rip是典型的距离矢量动态路由协议。Ospf是链路状态型的协议

    网络工程师十个常见面试问题-看准网 https://m.kanzhun.com/k-mianshiwenti/1465113.html 两者都属于IGP协议,rip是典型的距离矢量动态路由协议.Osp ...

随机推荐

  1. ACM-ICPC 2018 徐州赛区网络预赛 Ryuji doesn't want to study

    简单数学变换+线段树 简单数据结构签到题不解释 本来应该贴板子的,鉴于最近写代码太少了,而且由于要用两个线段树,平时板子都是一个的.以及板子在队友那.就当熟悉写代码,自己写了一下. #include ...

  2. cobbler自动安装linux

    1- cobbler简介   cobbler是一个系统启动服务boot server,可以通过pxe得方式用来快速安装.重装系统,支持安装不同linux发行版和windows.   基于python开 ...

  3. 简单理解Linux系统的挂载是什么鬼

    转载自http://c.biancheng.net/view/2859.html Linux系统中“一切皆文件”,所有文件都放置在以根目录为树根的树形目录结构中.在 Linux 看来,任何硬件设备也都 ...

  4. 微信小程序scroll-view去除滚动条

    css代码: .father{ //父元素 width: 100vw; height: 100vh; overflow-x: hidden; overflow-y: auto; } //隐藏滚动条 : ...

  5. Application Characteristics Of LED Keychain

    LED keychains are essential camping and travel accessories. Very useful as a light source. There are ...

  6. JUC之CountDownLatch和CyclicBarrier的区别 (转)

    CountDownLatch和CyclicBarrier的功能看起来很相似,不易区分,有一种谜之的神秘.本文将通过通俗的例子并结合代码讲解两者的使用方法和区别. CountDownLatch和Cycl ...

  7. Python之QRCode

    目录 一.基本介绍 介绍 QRCode二维码版本展示 QRCode方法 常用函数 二.安装QRCode 三.基本案例 生成普通二维码: 生成带有图片的二维码: 四.制作动态二维码 安装 myqr 和 ...

  8. Jmeter-简介及安装

    一.Jmeter简介 Apache Jmeter 是Apache组织的开放源代码项目,是一个纯java桌面应用,用于压力测试和性能测量.它最初被设计用于Web应用测试但后来扩展到其它测试领域. Apa ...

  9. CentOS7利用docker安装MySQL5.7

    CentOS7利用docker安装MySQL5.7 前提条件 centos7 且内核版本高于3.10, 可通过以下命令查看内核版本 uname -r 利用yum 安装docker 安装一些必要的系统工 ...

  10. Openstack 简单梳理,(自用 慎点)

    这个图里面的彩色方块,就是OpenStack最核心的组件. 推荐几个大咖,大家可以百度找他们的博客来看:陈沙克.何明桂.孔令贤,Cloudman.