rip简介:
rip: routing information protocol 路由信息协议
rip属于动态路由协议的一种,是距离矢量类路由协议,以跳数作为计算到达目标
的优劣,最多为15跳,16跳时不可达。
这是一个而比较古老的路由协议,缺点: 收敛速度慢,它已经慢慢被OSPF取代了
静态路由缺点
1 配置麻烦
2 不够灵活
3 不可冗余
动态路由的原理
动态路由会与相邻路由器共享路由表(每30秒发送存活信息报文)
并且自动在自身路由表添加路由信息
rip实验拓扑图:
基础配置:
R1:
[R1]un in en
[R1]int e0/0/0
[R1-Ethernet0/0/0]ip add 192.168.1.1 24
[R1-Ethernet0/0/0]int e0/0/1
[R1-Ethernet0/0/1]ip add 12.1.1.2 24
相邻设备ping测试:
[R1-Ethernet0/0/1]ping 12.1.1.1
PING 12.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 12.1.1.1: bytes=56 Sequence=1 ttl=255 time=30 ms
[R1-Ethernet0/0/1]ping 192.168.1.10
PING 192.168.1.10: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.10: bytes=56 Sequence=1 ttl=128 time=40 ms
R2:
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.10.1 24
[R2-GigabitEthernet0/0/0]int e0/0/0
[R2-Ethernet0/0/0]ip add 12.1.1.1 24
[R2-Ethernet0/0/0]int e0/0/1
[R2-Ethernet0/0/1]ip add 23.1.1.1 24
相邻设备ping测试:
[R2-Ethernet0/0/1]ping 192.168.10.10
PING 192.168.10.10: 56 data bytes, press CTRL_C to break
Reply from 192.168.10.10: bytes=56 Sequence=1 ttl=128 time=80 ms
[R2-Ethernet0/0/1]ping 23.1.1.2
PING 23.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 23.1.1.2: bytes=56 Sequence=1 ttl=255 time=50 ms
[R2-Ethernet0/0/1]ping 12.1.1.2
PING 12.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 12.1.1.2: bytes=56 Sequence=1 ttl=255 time=50 ms
R3:
[R3]int e0/0/0
[R3-Ethernet0/0/0]ip add 23.1.1.2 24
[R3]int e0/0/1
[R3-Ethernet0/0/1]ip add 172.16.1.1 24
相邻设备连通性测试
[R3-Ethernet0/0/1]ping 23.1.1.1
PING 23.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 23.1.1.1: bytes=56 Sequence=1 ttl=255 time=80 ms
[R3-Ethernet0/0/1]ping 172.16.1.10
PING 172.16.1.10: 56 data bytes, press CTRL_C to break
Reply from 172.16.1.10: bytes=56 Sequence=1 ttl=128 time=80 ms
rip协议配置:
R1 rip配置:
[R1]rip 1
[R1-rip-1]version 2
[R1-rip-1]network 192.168.1.0 [宣告网段]
[R1-rip-1]network 12.0.0.0 ##注意这里如果写成network 12.1.1.0是会报错的,因为它是A类地址,必须使用A类地址段
查看rip配置情况:
[R1-rip-1]dis this
#
rip 1
version 2 #---这里的rip版本必须一致,否则不可通信
network 192.168.1.0 # 宣告相邻网段
network 12.0.0.0
#
return
R2 rip配置:
[R2]rip 1
[R2-rip-1]version 2
[R2-rip-1]network 192.168.10.0
[R2-rip-1]network 12.0.0.0
[R2-rip-1]network 23.0.0.0
[R2-rip-1]dis this
#
rip 1
version 2
network 192.168.10.0
network 12.0.0.0
network 23.0.0.0
#
return
R3 rip配置:
[R3]rip 1
[R3-rip-1]version 2
[R3-rip-1]network 23.0.0.0
[R3-rip-1]netwotk 172.16.0.0
[R3-rip-1]dis this
#
rip 1
version 2
network 23.0.0.0
network 172.16.0.0
#
return
PC1测试ping PC2
PC1测试ping PC3
可以看看路由表信息,能够ping通,路由表一定存在
[R2-rip-1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 10 Routes : 10
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.1.1.0/24 Direct 0 0 D 12.1.1.1 Ethernet0/0/0
12.1.1.1/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0
23.1.1.0/24 Direct 0 0 D 23.1.1.1 Ethernet0/0/1
23.1.1.1/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
172.16.1.0/24 RIP 100 1 D 23.1.1.2 Ethernet0/0/1
192.168.1.0/24 RIP 100 1 D 12.1.1.2 Ethernet0/0/0
192.168.10.0/24 Direct 0 0 D 192.168.10.1 GigabitEthernet 0/0/0
192.168.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0
至此rip协议配置完成
注意:
路由器中rip协议配置好之后,每隔30s相邻路由器会发送路由更新包,使用dis this 查看配置
dis rip 1 route 查看rip路由表
rip 计时器(路由老化时间)
更新时间:update 30s
老化时间: Aging 180s
垃圾收集时间: Garbage120s
抑制时间: 120s
注意:
rip协议版本必须一致,否则路由无法传输
rip防环机制
16跳不可达
水平分割 int xx rip split
毒性逆转 int xx rip poi
抑制计时器
rip防环 - 水平分割
拓扑图
rip认证
为接口配置认证,保证数据传输安全性
注意:
rip协议版本必须一致,否则路由无法传输
基础配置:
R1:
un in en
interface Ethernet0/0/0
ip address 12.1.1.1 255.255.255.0
interface Ethernet0/0/1
ip address 23.1.1.1 255.255.255.0
interface LoopBack1
ip address 192.168.10.1 255.255.255.0
R2:
un in en
interface Ethernet0/0/0
ip address 192.168.1.1 255.255.255.0
interface Ethernet0/0/1
ip address 12.1.1.2 255.255.255.0
R3:
un in en
interface Ethernet0/0/1
ip address 172.16.1.1 255.255.255.0
interface Ethernet0/0/0
ip address 23.1.1.2 255.255.255.0
rip配置:
rip版本需要一致,否则无法通信,这里使用rip v2
R1:
rip 1
version 2
network 192.168.10.0
network 23.0.0.0
network 12.0.0.0
R2:
rip 1
version 2
network 192.168.1.0
network 12.0.0.0
R3:
rip 1
version 2
network 23.0.0.0
network 172.16.0.0
配置完成后测试ping
PC1配置:
PC2配置:
PC1 ping pc2:
PC>ping 172.16.1.10
Ping 172.16.1.10: 32 data bytes, Press Ctrl_C to break
From 172.16.1.10: bytes=32 seq=1 ttl=125 time=79 ms
From 172.16.1.10: bytes=32 seq=2 ttl=125 time=78 ms
From 172.16.1.10: bytes=32 seq=3 ttl=125 time=78 ms
From 172.16.1.10: bytes=32 seq=4 ttl=125 time=79 ms
From 172.16.1.10: bytes=32 seq=5 ttl=125 time=78 ms
--- 172.16.1.10 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/78/79 ms
PC1pingR3:
PC>ping 23.1.1.2
Ping 23.1.1.2: 32 data bytes, Press Ctrl_C to break
From 23.1.1.2: bytes=32 seq=1 ttl=253 time=47 ms
From 23.1.1.2: bytes=32 seq=2 ttl=253 time=62 ms
--- 23.1.1.2 ping statistics ---
2 packet(s) transmitted
2 packet(s) received
0.00% packet loss
round-trip min/avg/max = 47/54/62 ms
简单rip配置完成
rip协议的简单查看:dis rip 1 route
<Huawei>dis rip 1 route |-----查看当前路由器的rip协议配置相关信息
Route Flags : R - RIP
A - Aging, G - Garbage-collect
----------------------------------------------------------------------------
Peer 12.1.1.1 on Ethernet0/0/1
Destination/Mask Nexthop Cost Tag Flags Sec
192.168.10.0/24 12.1.1.1 1 0 RA 13
23.1.1.0/24 12.1.1.1 1 0 RA 13
172.16.1.0/24 12.1.1.1 2 0 RA 13
rip计时器:
概念:
在多个路由器之间 ,如果一个rip协议失效了,但是路由表依旧存在
在这个期间,路由表不会呗更新,即使rip协议失效。
计时器时间:
更新时间: update 30s 更新路由
老化时间: Aging 180s 路由老化时间之后路由才会消失
垃圾收集时间: Garbage 120s 进入垃圾手机时间路由表的路由会消失,此时路由器rip的路由在另一张表里以然存在,此时路由以然会讲该路由更新并传递给邻居。只是路由更新里的cost值变为了16,而16就是不可达,用于防止环路
抑制时间: 120s
查看[Sec为路由更新时间计时器]:
当cost值变为16时 rip路由就会呗彻底清空
实验2:
配置与实验1一样 只是中间假了一台hub集线器,增加了一个心的 13.1.1.0网段
R2新增配置:
[Huawei-Ethernet0/0/0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 13.1.1.1 24
[Huawei-GigabitEthernet0/0/0]dis this
#
interface GigabitEthernet0/0/0
ip address 13.1.1.1 255.255.255.0
#
测试:
[Huawei-GigabitEthernet0/0/0]ping 13.1.1.2
PING 13.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 13.1.1.2: bytes=56 Sequence=1 ttl=255 time=50 ms
Reply from 13.1.1.2: bytes=56 Sequence=2 ttl=255 time=20 ms
R3新增配置
[Huawei-Ethernet0/0/0]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 13.1.1.2 24
[Huawei-GigabitEthernet0/0/0]dis this
#
interface GigabitEthernet0/0/0
ip address 13.1.1.2 255.255.255.0
#
return
测试:
[Huawei-GigabitEthernet0/0/0]ping 13.1.1.1
PING 13.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 13.1.1.1: bytes=56 Sequence=1 ttl=255 time=40 ms
Reply from 13.1.1.1: bytes=56 Sequence=2 ttl=255 time=50 ms
R2 R3 rip宣告:
R2:
[Huawei]rip 1
[Huawei-rip-1]network 13.0.0.0
[Huawei-rip-1]dis this
#
rip 1
version 2
network 192.168.1.0
network 12.0.0.0
network 13.0.0.0
#
return
------------------------------------
R3:
[Huawei-GigabitEthernet0/0/0]rip 1
[Huawei-rip-1]network 13.0.0.0
[Huawei-rip-1]dis this
#
rip 1
version 2
network 23.0.0.0
network 172.16.0.0
network 13.0.0.0
#
return
问题: 他们之间跑了rip路由协议,rip默认是走开销最短的一条路,现在断开一条路,他会怎么选择?
可以发现 断开之后 他无法自动切换到另一条线路,这个切换的过程会非常长 时间大概10分钟左右
注意这个实验,必须确保两边rip协议相同,否则无法通信,他门版本无法兼容。
恢复后截图:
这个时间 也就是我们的重点 rip计时器
通过
dis rip 1 route
查看等待时间R2 查看路由: <Huawei>dis rip 1 route Route Flags : R - RIP A - Aging, G - Garbage-collect ---------------------------------------------------------------------------- Peer 13.1.1.2 on GigabitEthernet0/0/0 Destination/Mask Nexthop Cost Tag Flags Sec 172.16.1.0/24 13.1.1.2 1 0 RA 29 23.1.1.0/24 13.1.1.2 1 0 RA 29 192.168.10.0/24 13.1.1.2 2 0 RA 29
此时已经看到路由选择切换为了 13.1.1.2 而不再是12.1.1.1 因为他已经发现12.1.1.1 挂掉了。
重新连接线路后查看:
<Huawei>dis rip 1 route Route Flags : R - RIP A - Aging, G - Garbage-collect ---------------------------------------------------------------------------- Peer 12.1.1.1 on Ethernet0/0/1 Destination/Mask Nexthop Cost Tag Flags Sec 192.168.10.0/24 12.1.1.1 1 0 RA 1 23.1.1.0/24 12.1.1.1 1 0 RA 1 Peer 13.1.1.2 on GigabitEthernet0/0/0 Destination/Mask Nexthop Cost Tag Flags Sec 172.16.1.0/24 13.1.1.2 1 0 RA 12 23.1.1.0/24 13.1.1.2 1 0 RA 12
<Huawei>dis rip 1 route Route Flags : R - RIP A - Aging, G - Garbage-collect ---------------------------------------------------------------------------- Peer 12.1.1.1 on Ethernet0/0/1 Destination/Mask Nexthop Cost Tag Flags Sec 192.168.10.0/24 12.1.1.1 1 0 RA 1 23.1.1.0/24 12.1.1.1 1 0 RA 1 Peer 13.1.1.2 on GigabitEthernet0/0/0 Destination/Mask Nexthop Cost Tag Flags Sec 172.16.1.0/24 13.1.1.2 1 0 RA 12 23.1.1.0/24 13.1.1.2 1 0 RA 12
学习rip协议了解计时器即可,本实验只是让读者能更直观的查看到rip计时器的作用,在计时器时间180到达后,会重新选择路由
抑制计时器:
抑制计时器[Suppress timr] : 当RIP设备收到对端的路由更新,cost值为16,对应路由进入抑制状态
并启动抑制计时器,用于防止路由震荡,在抑制定时超时之前,即使再次收到对端路由cost小于16
的更新,也不会接受,当抑制定时器超时后,就允许接收对端发送的路由更新报文。
也就是简单理解,为了让他不环路,让指定路由进入垃圾收集时间,并发送一个cost值为16的小心, 让其进入抑制状态,这样就不会再产生环路,默认不会走这条线路了。
rip防环机制
16跳不可达
为了防止环路,默认经过一个路由器cost值减少1,到0 的时候丢弃,为了防止报文在网络中无限传输
水平分割
开启水平分割命令: rip split-horizon
关闭水平分割命令: undo rip split-horizon
从接口收到的路由更新,默认不会再从这个接口发送出去,rip v2版本默认开启,
rip v1 配置: rip split-horizon
查看 :
[Huawei]dis rip 1 interface g0/0/0 verbose GigabitEthernet0/0/0(13.1.1.1) 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 [Huawei]
毒性逆转:
毒性逆转开启
int xxxx
rip poison-reverse [默认毒性逆转为关闭状态,该命令打开 关闭就在命令前加 undo]
原理: 接口开启毒性逆转后,对于用对端收到的路由,再回传,回传时讲路由的cost值改为16,让该链路不可用,防止路由环路。
rip认证:
rip在两端配置认证密码,保证两端认证后的合法性,认证失败则不允许
开启rip认证:
rip authentication-mode [选项]
md5 MD5 authentication 普通md5加密
simple Simple text authentication 明文
rip authentication-mode md5
nonstandard Nonstandard MD5 authentication packet format (IETF) -- 通用md5加密
usual Huawei MD5 authentication packet format -- 华为自有的加密方式[一般用这个]
rip authentication-mode md5 usual 123456 将rip协议密码设置为 123456
抓包看到的加密报文:


发表评论