华为设备RIP实施和理论详解

1.路由协议基础
共同的目的:更新、维护和控制3层的路由
工作机制:
RIP,封装在UDP这个协议上,端口号520(优先级100)
OSPF,封装在IP层,协议号89(优先级,内部10,外部是150-ASE)
中间系统到中间系统,OSI模型上的路由协议,直接封装在2层上,直接把协议报文发到0014(L1)/0015(Level2)上,优先级15
BGP,封装在TCP这协议上的,端口号179(优先级255)

RIP到底工作在3层还是4层?

优先级本地有效(不能影响其他路由器的协议竞争路由表)
2.RIP 基础配置
报文:request、response(command)
基本的配置:
[R2]dis current-configuration configuration rip
[V200R003C00]
#
rip 1
network 10.0.0.0
network 22.0.0.0
[R2]dis rip 1 neighbor

IP Address Interface Type Last-Heard-Time

10.1.12.1 Serial2/0/0 RIP 0:0:10
Number of RIP routes : 2
RIP每个30s来发送一次response
[R2]dis ip rou pro rip
Route Flags: R - relay, D - download to fib

Public routing table : RIP
Destinations : 3 Routes : 3

RIP routing table status : <Active>
Destinations : 3 Routes : 3

Destination/Mask Proto Pre Cost(HOP) Flags NextHop Interface

    1.0.0.0/8   RIP     100  1           D   10.1.12.1       Serial2/0/0
   10.1.1.0/24  RIP     100  1           D   10.1.12.1       Serial2/0/0
   11.0.0.0/8   RIP     100  1           D   10.1.12.1       Serial2/0/0

<R2>dis rip 1 route
Route Flags : R - RIP
A - Aging, G - Garbage-collect

Peer 10.1.12.1 on Serial2/0/0
Destination/Mask Nexthop Cost Tag Flags Sec
11.1.1.1/32 10.1.12.1 1 0 RA 180
10.1.1.0/24 10.1.12.1 1 0 RA 180
1.1.1.1/32 10.1.12.1 1 0 RA 180 //老话时间aging time到时,会切换到垃圾收集时间,此时路由消失,但是DB中依旧存在:<R2>dis ip rou pro rip
<R2>
<R2>dis rip 1 route
Route Flags : R - RIP
A - Aging, G - Garbage-collect

Peer 10.1.12.1 on Serial2/0/0
Destination/Mask Nexthop Cost Tag Flags Sec
11.1.1.1/32 10.1.12.1 16 0 RG 84
10.1.1.0/24 10.1.12.1 16 0 RG 84
1.1.1.1/32 10.1.12.1 16 0 RG 84 //进入120s的垃圾收集时间,意味着该表项中存在于RIP路由表,而全局路由表早已消失
[R2-rip-1]timers rip 29 179 119 //修改RIP的时间值

3.防环机制:
1)水平分割(split horizon),从某个接口收到了路由。就不会再把该路由从接口发出去(被动方式)
<R2>dis rip 1 int ver
Serial2/0/0(10.1.12.2)
State : UP MTU : 500
Metricin : 0 
Metricout : 1 
Input : Enabled Output : Enabled 
Protocol : RIPv2 Multicast
Send version : RIPv2 Multicast Packets 
Receive version : RIPv2 Multicast and Broadcast Packets
Poison-reverse : Disabled 
Split-Horizon : Enabled //水平分割开启
Authentication type : None 
Replay Protection : Disabled
2)毒性逆转,发送不可达路由告知邻居路由器(主动方式,坏消息总比没有消息强)
interface Serial2/0/0
link-protocol ppp
ip address 10.1.12.2 255.255.255.0 
rip poison-reverse //开启毒性逆转
3)触发更新

拍错:
rip metricin 15 //入方向度量值15
[R2]display rip 1 database //验证数据库

Advertisement State : [A] - Advertised
[I] - Not Advertised/Withdraw 代表消失

1.0.0.0/8, cost 16, ClassfulSumm
1.1.1.1/32, cost 16, [I], nexthop 10.1.12.1
10.0.0.0/8, cost 0, ClassfulSumm
10.1.1.0/24, cost 16, [I], nexthop 10.1.12.1
10.1.12.0/24, cost 0, [A], Rip-interface
11.0.0.0/8, cost 16, ClassfulSumm
11.1.1.1/32, cost 16, [I], nexthop 10.1.12.1
[R1-Serial2/0/0]rip metricout 9 
interface Serial2/0/0
link-protocol ppp
ip address 10.1.12.1 255.255.255.0 
rip metricout 2000 8 //精准的对acl 2000匹配的路由来进行度量值的修改
[R1]dis acl all
Total quantity of nonempty ACL number is 1

4.静默端口(RIP、OSPF、中间系统到中间系统都存在)
不在发送某种协议的报文,通常用在环回接口以及连接终端的接口上,用于构建邻居的物理接口上。
rip 1
version 2
network 10.0.0.0
network 22.0.0.0
silent-interface all //静默所有接口
silent-interface disable Serial2/0/0//排除物理接口,物理接口不要静默,用于构建邻居

Basic ACL 2000, 1 rule
Acl's step is 5
rule 10 permit source 1.1.1.1 0 (3 matches)

5.汇总:在路由可用的前提下减少路由条目数
RIP可以在任何一个设备做汇总,要在路由更新出去的接口来实施
11.1.1.1 0000,0001
11.1.1.2 0000.0010
11.1.1.3 0000,0011
11.1.1.0 255.255.255.252
[R1-Serial2/0/0]rip summary-address 11.1.1.0 255.255.255.252 //推荐使用手工汇总
[R2-rip-1]dis ip rou pro rip
Route Flags: R - relay, D - download to fib

Public routing table : RIP
Destinations : 3 Routes : 3

RIP routing table status : <Active>
Destinations : 3 Routes : 3

Destination/Mask Proto Pre Cost Flags NextHop Interface

    1.1.1.1/32  RIP     100  8           D   10.1.12.1       Serial2/0/0
   10.1.1.0/24  RIP     100  1           D   10.1.12.1       Serial2/0/0 
   11.1.1.0/30  RIP     100  1           D   10.1.12.1       Serial2/0/0 

不推荐的自动汇总,把路由汇总到主类的边界
[R2-rip-1]summary always 
[R2-rip-1]dis ip rou pro rip
Route Flags: R - relay, D - download to fib

Public routing table : RIP
Destinations : 3 Routes : 3

RIP routing table status : <Active>
Destinations : 3 Routes : 3

Destination/Mask Proto Pre Cost Flags NextHop Interface

    1.0.0.0/8   RIP     100  1           D   10.1.12.1       Serial2/0/0
   10.1.1.0/24  RIP     100  1           D   10.1.12.1       Serial2/0/0 //为什么这条路由没有自动汇总呢?
   11.0.0.0/8   RIP     100  1           D   10.1.12.1       Serial2/0/0

RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
如果需要汇总的网络和RIP构建邻居的接口同一个主类网络,则不会汇总

需求:
1.两个设备各自通告自身的环回接口,建立邻居之后手工汇总环回接口到/16
2.静默所有接口,请使用单播来建立邻居关系,使用单播来更新RIP报文
3.R1增加一个额外的环回接口1.1.1.1,R2上得到这一条路由的度量为15



本文转自EnderJoe 51CTO博客,原文链接:http://blog.51cto.com/enderjoe/2057525

原文地址:https://www.cnblogs.com/twodog/p/12138712.html