路由信息协议(RIP)
常见的协议的分类:动态的和静态的。
内部网关协议(igp):rip igrp eigrp ospf is-is
外部网关协议(egp):bgp4
RIP是一种分布式的基于距离向量的路由选择协议,是因特网的标准协议,其最大的优点就是简单。RIP协议将“距离”定义为:从一路由器到直接连接的网络的距离定义为1。从一路由器到非直接连接的网络的距离定义为每经过一个路由器则距离加1。“距离”也成为“跳数”。RIP允许一条路径最多只能包含15个路由器,因此,距离等于16时即为不可达。
www.zhishiwu.com
rip协议使用udp的520端口进行消息的交流。
rip的特点:
1:周期更新时间30s
2:采用的是广播(v1 版本 广播,v2版本 组播 224.0.0.9)
3:适合较小规模的网络
4:属于等代价的负载均衡 默认的最大的条数为4条,最大的为6条。
5:计算metric值(最大的条数为16跳)
解决路由环路的机制
a,最大跳 16
b,水平分割
c,路由毒化
d,毒性逆转
e,触发更新 抑制计时器180
拓扑图:
[r1]dis cu
interface Ethernet0
!
interface Ethernet1
loopback
ip address 192.168.1.1 255.255.255.192
rip version 2 multicast
!
interface Serial0
clock DTECLK1
link-protocol ppp
ip address 192.168.4.1 255.255.255.252
rip version 2 multicast
!
interface Serial1
link-protocol ppp
ip address 192.168.4.5 255.255.255.252
rip version 2 multicast
rip
undo summary
network 192.168.4.0
network 192.168.1.0
!
quit
!
return
[r1]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/26 Direct 0 0 192.168.1.1 Ethernet1
192.168.1.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.64/26 RIP 100 1 192.168.4.2 Serial0
192.168.1.128/26 RIP 100 1 192.168.4.6 Serial1
192.168.4.0/30 Direct 0 0 192.168.4.2 Serial0
192.168.4.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.2/32 Direct 0 0 192.168.4.2 Serial0
192.168.4.4/30 Direct 0 0 192.168.4.6 Serial1
192.168.4.5/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.6/32 Direct 0 0 192.168.4.6 Serial1
[r2]dis cu
interface Ethernet1
loopback
ip address 192.168.1.65 255.255.255.192
rip version 2 multicast
!
interface Serial0
link-protocol ppp
ip address 192.168.4.2 255.255.255.252
rip version 2 multicast
rip
undo summary
network 192.168.4.0
network 192.168.1.0
[r2]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/26 RIP 100 1 192.168.4.1 Serial0
192.168.1.64/26 Direct 0 0 192.168.1.65 Ethernet1
192.168.1.65/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.128/26 RIP 100 2 192.168.4.1 Serial0
192.168.4.0/30 Direct 0 0 192.168.4.1 Serial0
192.168.4.1/32 Direct 0 0 192.168.4.1 Serial0
192.168.4.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.4/30 RIP 100 1 192.168.4.1 Serial0
[r3]dis cu
interface Ethernet1
loopback
ip address 192.168.1.129 255.255.255.192
rip version 2 multicast
!
interface Serial1
clock DTECLK1
link-protocol ppp
ip address 192.168.4.6 255.255.255.252
rip version 2 multicast
rip
undo summary
network 192.168.4.0
network 192.168.1.0
[r3]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/26 RIP 100 1 192.168.4.5 Serial1
192.168.1.64/26 RIP 100 2 192.168.4.5 Serial1
192.168.1.128/26 Direct 0 0 192.168.1.129 Ethernet1
192.168.1.129/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.0/30 RIP 100 1 192.168.4.5 Serial1
192.168.4.4/30 Direct 0 0 192.168.4.5 Serial1
192.168.4.5/32 Direct 0 0 192.168.4.5 Serial1
192.168.4.6/32 Direct 0 0 127.0.0.1 LoopBack0
r3的 调试信息
[r3]debu rip pa
Enable Rip packet debugging functions
[r3]
RIP: send from 192.168.1.129 to 224.0.0.9(Ethernet1)组播地址
Packet:vers 2, cmd Response, length 104
dest 192.168.4.0 mask 255.255.255.252,router 0.0.0.0 ,metric 2 所有学习到的路由都从e1接口发布出去啦
dest 192.168.1.0 mask 255.255.255.192,router 0.0.0.0 ,metric 2
dest 192.168.1.64 mask 255.255.255.192,router 0.0.0.0 ,metric 3
dest 192.168.4.4 mask 255.255.255.252,router 0.0.0.0 ,metric 1
dest 192.168.1.128 mask 255.255.255.192,router 0.0.0.0 ,metric 1
RIP: send from 192.168.4.6 to 224.0.0.9(Serial1)
Packet:vers 2, cmd Response, length 44
dest 192.168.4.4 mask 255.255.255.252,router 0.0.0.0 ,metric 1 从s1借口只发布自己直连的路由,学习到的不再发布给从学习到路由的那台路由器 www.zhishiwu.com
dest 192.168.1.128 mask 255.255.255.192,router 0.0.0.0 ,metric 1
RIP:receive Response from 192.168.4.5(Serial1)
Packet:vers 2, cmd Response, length 84
dest 192.168.4.4 mask 255.255.255.252,router 0.0.0.0 ,metric 1
dest 192.168.1.64 mask 255.255.255.192,router 0.0.0.0 ,metric 2
dest 192.168.4.0 mask 255.255.255.252,router 0.0.0.0 ,metric 1
dest 192.168.1.0 mask 255.255.255.192,router 0.0.0.0 ,metric 1
RIP: send from 192.168.1.129 to 224.0.0.9(Ethernet1)
Packet:vers 2, cmd Response, length 104
dest 192.168.4.0 mask 255.255.255.252,router 0.0.0.0 ,metric 2
dest 192.168.1.0 mask 255.255.255.192,router 0.0.0.0 ,metric 2
dest 192.168.1.64 mask 255.255.255.192,router 0.0.0.0 ,metric 3
dest 192.168.4.4 mask 255.255.255.252,router 0.0.0.0 ,metric 1
dest 192.168.1.128 mask 255.255.255.192,router 0.0.0.0 ,metric 1
RIP: send from 192.168.4.6 to 224.0.0.9(Serial1)
Packet:vers 2, cmd Response, length 44
dest 192.168.4.4 mask 255.255.255.252,router 0.0.0.0 ,metric 1
dest 192.168.1.128 mask 255.255.255.192,router 0.0.0.0 ,metric 1
RIP:receive Response from 192.168.4.5(Serial1)
Packet:vers 2, cmd Response, length 84
dest 192.168.4.4 mask 255.255.255.252,router 0.0.0.0 ,metric 1
dest 192.168.1.64 mask 255.255.255.192,router 0.0.0.0 ,metric 2
dest 192.168.4.0 mask 255.255.255.252,router 0.0.0.0 ,metric 1
dest 192.168.1.0 mask 255.255.255.192,router 0.0.0.0 ,metric 1
RIP: send from 192.168.1.129 to 224.0.0.9(Ethernet1)
说明:ripv2版本支持可变长的子网掩码,采用了组播的方式进行信息的交流,减少了网络中的广播包的数量。组播地址是224.0.0.9.