RIPv2

  1. 基础知识
  • 距离矢量路由协议并不了解网络拓扑。
  • 定义一个最大值:定义跳数的最大值15跳,16跳为不可达,以避免路由选择环路。
  • 通过水平分割消除路由选择环路
  • 简单水平分割的规则是,从某接口发送的更新消息不包含从该接口收到的更新所包含的网络。
  • 路由中毒

当172.16.3.0/24挂掉的时候,R3会立即发一条路由中毒消息(172.16.3.0 16跳)然后通告出去;R2收到这条中毒消息后,将172.16.3.0从路由表里抹除,但仍存在在RIP database里,状态是possible down,垃圾收集时间(Garnage colletion cisco 默认60S)到后,路由被从B的database抹除。

  • 毒性逆转

同上图,172.16.3.0挂掉后,R3会发送中毒消息,理论上172.16.3.0的路由是R3通告给R2的,根据水平分割原则,R2不能向R3通告172.16.3.0的信息,但是带毒性逆转的水平分割打破了这个原则,R2会定期向R3发送172.16.3.0的毒性逆转消息,以让R3知道,它的邻居知道了172.16.3.0挂掉的消息并且等着172.16.3.0恢复正常,这样做的另一个好处是避免环路,至少R3不会从R2再去访问172.16.3.0了。

  • 用触发更新避免路由选择环路

新的路由表一般是定期发送给邻居路由器的,而触发更新则是立即发送以响应路由表的变化。

  • 用抑制定时器防止路由选择环路

当一个router从邻居router收到一条更新,指示以前可达的网络现在不可达了,或有一个更大跳数的路由,则这个router标该路由为不可达并启动一个抑制定时器,如果在定时器满以前收到该路由又可达的更新,或者比以前的记录有更好的度量值,则该router标识这个路由可达并删除定时器。

实验拓扑:

  • 实验拓扑如图所示,PC使用VPC模拟。
  • 实现R1、R2、R3、运行RIPv2,PC1、PC2能够相互通信,并实现全网可达。
  1. PC1、PC2配置接口IP、GW:

PC1> ip 10.1.10.1/24 10.1.10.254

Checking for duplicate address...

PC1 : 10.1.10.1 255.255.255.0 gateway 10.1.10.254

PC2> ip 10.1.20.1/24 10.1.20.254

Checking for duplicate address...

PC2 : 10.1.20.1 255.255.255.0 gateway 10.1.20.254

  1. R1、R2、R3运行RIPv2

R1的配置如下:

R1(config)#router rip                                                     #创建RIP进程

R1(config-router)#version 2                                             #将RIP设置为版本2

R1(config-router)#network 10.1.10.0                               #G0/0口激活RIPv2

R1(config-router)#network 172.16.12.0                           #G0/1口激活RIPv2

R2的配置如下:

R1(config)#router rip

R1(config-router)#version 2

R1(config-router)#network 172.16.23.0

R1(config-router)#network 172.16.12.0

R2的配置如下:

R2(config)#router rip

R2(config-router)#version 2

R2(config-router)#network 172.16.23.0

R2(config-router)#network 172.16.12.0

R3的配置如下:

R3(config)#router rip

R3(config-router)#version 2

R3(config-router)#network 172.16.23.0

R3(config-router)#network 10.1.20.0

注意的是RIP在使用network命令指定网段时,只支持通告主类网络。

检查运行的情况:

R1#sh ip protocols

*** IP Routing is NSF aware ***

Routing Protocol is "application"

  Sending updates every 0 seconds

  Invalid after 0 seconds, hold down 0, flushed after 0

  Outgoing update filter list for all interfaces is not set

  Incoming update filter list for all interfaces is not set

  Maximum path: 32

  Routing for Networks:

  Routing Information Sources:

    Gateway         Distance      Last Update

  Distance: (default is 4)

Routing Protocol is "rip"

  Outgoing update filter list for all interfaces is not set

  Incoming update filter list for all interfaces is not set

  Sending updates every 30 seconds, next due in 22 seconds

  Invalid after 180 seconds, hold down 180, flushed after 240

  Redistributing: rip

  Default version control: send version 2, receive version 2

    Interface             Send  Recv  Triggered RIP  Key-chain

    GigabitEthernet0/0    2     2            #两个接口激活RIPv2

    GigabitEthernet0/1    2     2                                                    

  Automatic network summarization is in effect    #自动汇总功能默认开启

  Maximum path: 4

  Routing for Networks:                       #路由网段

    10.0.0.0

    172.16.0.0

  Routing Information Sources:

    Gateway         Distance      Last Update

    172.16.12.2          120      00:00:13

  Distance: (default is 120)                                                     #管理距离120

此时PC1  ping一下PC2,发现ping不通。那么为什么不通呢?此时应该查看一下R1的路由表:

R1#sh ip route

      10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        10.1.10.0/24 is directly connected, GigabitEthernet0/1

L        10.1.10.254/32 is directly connected, GigabitEthernet0/1

      172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks

C        172.16.12.0/24 is directly connected, GigabitEthernet0/0

L        172.16.12.1/32 is directly connected, GigabitEthernet0/0

R        172.16.23.0/24 [120/1] via 172.16.12.2, 00:00:04, GigabitEthernet0/0

R1已经学到R2-R3互联网段段路由172.16.23.0/24,但是没有学到PC2接口的路由。为什么会这样?

       R2#sh  ip route

R     10.0.0.0/8 [120/1] via 172.16.23.3, 00:00:22, GigabitEthernet0/1

                 [120/1] via 172.16.12.1, 00:00:29, GigabitEthernet0/0

      172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks

C        172.16.12.0/24 is directly connected, GigabitEthernet0/0

L        172.16.12.2/32 is directly connected, GigabitEthernet0/0

C        172.16.23.0/24 is directly connected, GigabitEthernet0/1

L        172.16.23.2/32 is directly connected, GigabitEthernet0/1

R2出现了一个奇怪的现象,路由表显示它从R1及R3都学习到了10.0.0.0/8路由,并且R2将这两条路由都装载进了路由表里,进行“等价负载均衡”。这个现象将造成什么问题呢?R2会认为,到达10.0.0.0网络即可从R1走又可以从R3走,那么问题来了,R2要去往10.1.10.0/24,也就是R1下联的网段,如果从R3走就肯定无法走通了,这就是问题的所在了。出现这样问题,其实是RIPv2的自动汇总机制导致的。由于R1、R3都处于“主类网络边界”,拿R1来说,有直连网络10.1.10.0/24、172.16.12.0/24,因此R1就是两个主类网络的边界,RIPv2在将子网路由10.1.10.0/24通告给172.16.12.0/24网络时,会将其进行自动汇总,汇总成10.0.0.0/8,R3也是类似的动作,就造成了R2路由表的诡异现象。

其实自动汇总的本意是为了减小路由条目,优化路由表,减小设备资源的损耗。此实验的解决办法是关闭自动汇总。

R1、R2、R3关闭自动汇总:

R1、R2、R3配置如下:

R1\2\3(config)#router rip

R1\2\3(config-router)#no auto-summary

R1路由表如下:

R1#sh ip route

Gateway of last resort is not set

 

      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks

C        10.1.10.0/24 is directly connected, GigabitEthernet0/1

L        10.1.10.254/32 is directly connected, GigabitEthernet0/1

R        10.1.20.0/24 [120/2] via 172.16.12.2, 00:00:03, GigabitEthernet0/0

      172.16.0.0/16 is variably subnetted, 3 subnets, 2 masks

C        172.16.12.0/24 is directly connected, GigabitEthernet0/0

L        172.16.12.1/32 is directly connected, GigabitEthernet0/0

R        172.16.23.0/24 [120/1] via 172.16.12.2, 00:00:15, GigabitEthernet0/0

R2路由表如下:

R2#sh ip route

Gateway of last resort is not set

 

      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks

R        10.0.0.0/8 [120/1] via 172.16.23.3, 00:01:17, GigabitEthernet0/1

                    [120/1] via 172.16.12.1, 00:01:23, GigabitEthernet0/0

R        10.1.10.0/24 [120/1] via 172.16.12.1, 00:00:27, GigabitEthernet0/0

R        10.1.20.0/24 [120/1] via 172.16.23.3, 00:00:25, GigabitEthernet0/1

      172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks

C        172.16.12.0/24 is directly connected, GigabitEthernet0/0

L        172.16.12.2/32 is directly connected, GigabitEthernet0/0

C        172.16.23.0/24 is directly connected, GigabitEthernet0/1

L        172.16.23.2/32 is directly connected, GigabitEthernet0/1

PC1与PC2相互通信:

PC1> ping 10.1.20.1

84 bytes from 10.1.20.1 icmp_seq=1 ttl=61 time=9.138 ms

84 bytes from 10.1.20.1 icmp_seq=2 ttl=61 time=2.998 ms

84 bytes from 10.1.20.1 icmp_seq=3 ttl=61 time=3.994 ms

84 bytes from 10.1.20.1 icmp_seq=4 ttl=61 time=4.570 ms

84 bytes from 10.1.20.1 icmp_seq=5 ttl=61 time=3.180 ms

RIP的手工汇总,需要RIPv2的支持,另外需要先走RIP进程中no auto-summary关闭自动汇总功能,然后再在接口上配置手工汇总命令,注意,该命令配置在汇总路由欲对外发布的那个接口上。

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值