ripv1与ripv2路由协议更新机制是什么


    rip协议的V1和V2的更新机制
    

    
    

    
    

    实验拓扑:
    实验步骤 :
    R1:
    router rip
    network 1.0.0.0
    network 192.168.12.0
    R2:
    router rip
    network 2.0.0.0
    network 192.168.12.0
    如果没有在路由配置模式下,敲命令Version 2的话,运行的是RIP version 1版本。
    在R2上debug ip rip
    R2(config)#router rip
    R2(config-router)# network 2.0.0.0
    R2(config-router)# network 192.168.12.0
    R2(config-router)#
    *Jun 4 09:40:46.279: RIP: add Loopback2 to RIP idb list
    *Jun 4 09:40:46.279: RIP: sending request on Loopback2 to 255.255.255.255 //发送广播更新
    *Jun 4 09:40:47.099: RIP: add Serial1/0 to RIP idb list
    *Jun 4 09:40:47.099: RIP: sending request on Serial1/0 to 255.255.255.255
    *Jun 4 09:40:47.143: RIP: received v1 update from 192.168.12.1 on Serial1/0
    *Jun 4 09:40:47.147: RIP: Update contains 1 routes
    *Jun 4 09:40:48.279: RIP: sending v1 flash update to 255.255.255.255 via Loopback2 (2.2.2.2)
    *Jun 4 09:40:48.279: RIP: Update contains 2 routes
    *Jun 4 09:40:48.279: RIP: Update queued
    *Jun 4 09:40:48.279: RIP: sending v1 flash update to 255.255.255.255 via Serial1/0 (192.168.12.2)
    *Jun 4 09:40:48.279: RIP: Update contains 1 routes
    *Jun 4 09:40:48.279: RIP: Update queued
    *Jun 4 09:40:48.279: RIP: Update sent via Loopback2
    *Jun 4 09:40:48.279: RIP: Update sent via Serial1/0
    R1:
    *Jun 4 09:44:47.695: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.12.1)
    *Jun 4 09:44:47.699: RIP: Update contains 1 routes//只向邻居通告直接的接口地址
    *Jun 4 09:44:47.699: RIP: Update queued
    *Jun 4 09:44:47.699: RIP: Update sent via Serial1/1
    R1#
    *Jun 4 09:44:52.631: RIP: sending v1 update to 255.255.255.255 via Loopback0 (1.1.1.1)
    *Jun 4 09:44:52.635: RIP: Update contains 2 routes
    *Jun 4 09:44:52.635: RIP: Update queued
    *Jun 4 09:44:52.635: RIP: Update sent via Loopback0//只向邻居通告直接的接口地址
    R1#
    *Jun 4 09:45:13.543: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.12.1)
    *Jun 4 09:45:13.547: RIP: Update contains 1 routes
    *Jun 4 09:45:13.547: RIP: Update queued
    *Jun 4 09:45:13.547: RIP: Update sent via Serial1/1
    *Jun 4 09:45:13.595: RIP: received v1 update from 192.168.12.2 on Serial1/1
    *Jun 4 09:45:13.599: RIP: Update contains 1 routes
    R1#
    *Jun 4 09:45:20.487: RIP: sending v1 update to 255.255.255.255 via Loopback0 (1.1.1.1)
    *Jun 4 09:45:20.491: RIP: Update contains 2 routes
    *Jun 4 09:45:20.491: RIP: Update queued
    *Jun 4 09:45:20.491: RIP: Update sent via Loopback0
    红色字体表明rip V1会每30s左右(debug信息中显示27s)发送一次更新
    如果此时在R2上添加一个loopback 0 地址为22.22.22.22/24的话,从debug ip rip events中看出:
    *Jun 4 09:50:12.159: RIP: sending v1 flash update to 255.255.255.255 via Loopback0 (22.22.22.22) - suppressing null update
    *Jun 4 09:50:12.163: RIP: Update sent via Loopback2
    此时R1上已经有22.0.0.0的路由了
    R1#show ip route rip
    R 2.0.0.0/8 [120/1] via 192.168.12.2, 00:00:13, Serial1/1
    R 22.0.0.0/8 [120/1] via 192.168.12.2, 00:00:13, Serial1/1
    如果将R2的loopback 0端口给关闭了,此时在180s后将此条路由跳数设置为16,如果过了240s后,还没有收到此条更新的话,这条路由将彻底在路由表中删除!
    此时将R2的RIP改为V2后,会发生什么情况呢?
    *Jun 4 09:57:22.151: RIP: ignored v2 packet from 2.2.2.2 (sourced from one of our addresses)
    *Jun 4 09:57:24.467: RIP: ignored v1 packet from 192.168.12.1 (illegal version) //提示版本不兼容
    *Jun 4 09:57:47.503: RIP: sending v2 update to 224.0.0.9 via Serial1/0 (192.168.12.2)
    *Jun 4 09:57:47.507: RIP: Update contains 1 routes
    *Jun 4 09:57:47.507: RIP: Update queued
    *Jun 4 09:57:47.507: RIP: Update sent via Serial1/0
    *Jun 4 09:57:50.219: RIP: sending v2 update to 224.0.0.9 via Loopback2 (2.2.2.2)
    *Jun 4 09:57:50.219: RIP: Update contains 2 routes
    *Jun 4 09:57:50.223: RIP: Update queued
    *Jun 4 09:57:50.223: RIP: Update sent via Loopback2
    *Jun 4 09:57:50.227: RIP: ignored v2 packet from 2.2.2.2 (sourced from one of our addresses)
    *Jun 4 09:57:50.563: RIP: ignored v1 packet from 192.168.12.1 (illegal version)
    此时要么改R1的版本,要么在R2的接口模式下修改:
    interface Serial1/0
    ip address 192.168.12.2 255.255.255.0
    ip rip send version 1 //发送是版本1
    ip rip receive version 1 //接收是版本2
    debug信息显示如下:
    R2#
    *Jun 4 09:59:41.907: RIP: received v1 update from 192.168.12.1 on Serial1/0
    *Jun 4 09:59:41.911: RIP: Update contains 1 routes
    R2#
    *Jun 4 09:59:43.639: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (192.168.12.2)
    *Jun 4 09:59:43.639: RIP: Update contains 1 routes
    *Jun 4 09:59:43.639: RIP: Update queued
    *Jun 4 09:59:43.639: RIP: Update sent via Serial1/0
    *Jun 4 09:59:43.663: RIP: sending v2 update to 224.0.0.9 via Loopback2 (2.2.2.2)
    *Jun 4 09:59:43.663: RIP: Update contains 2 routes
    *Jun 4 09:59:43.667: RIP: Update queued
    *Jun 4 09:59:43.667: RIP: Update sent via Loopback2
    *Jun 4 09:59:43.671: RIP: ignored v2 packet from 2.2.2.2 (sourced from one of our addresses)
    R2#show ip route rip
    R 1.0.0.0/8 [120/1] via 192.168.12.1, 00:00:02, Serial1/0
    修改R1为版本1后在debug上看到的信息:
    R1(config-router)#
    *Jun 4 10:03:07.779: RIP-TIMER: sending timer on Loopback0 expired
    *Jun 4 10:03:07.779: RIP: sending v2 update to 224.0.0.9 via Loopback0 (1.1.1.1)//组播发送更新
    *Jun 4 10:03:07.783: RIP: Update contains 3 routes
    *Jun 4 10:03:07.783: RIP: Update queued
    *Jun 4 10:03:07.787: RIP: Update sent via Loopback0
    *Jun 4 10:03:07.787: RIP: ignored v2 packet from 1.1.1.1 (sourced from one of our addresses)
    R1(config-router)#
    *Jun 4 10:03:14.519: RIP-TIMER: age timer expired
    R1(config-router)#
    *Jun 4 10:03:15.691: RIP: received v2 update from 192.168.12.2 on Serial1/1
    *Jun 4 10:03:15.695: RIP-DB: network_update with 2.0.0.0/8 succeeds//注意与下面的红色字体的区别。
    *Jun 4 10:03:15.695: RIP-DB: adding 2.0.0.0/8 (metric 1) via 192.168.12.2 on Serial1/1 to RIP database
    *Jun 4 10:03:15.699: RIP-DB: network_update with 22.0.0.0/8 succeeds
    *Jun 4 10:03:15.699: RIP-DB: adding 22.0.0.0/8 (metric 1) via 192.168.12.2 on Serial1/1 to RIP database
    *Jun 4 10:03:15.699: RIP: Update contains 2 routes
    R1(config-router)#
    *Jun 4 10:03:17.191: RIP-TIMER: sending timer on Serial1/1 expired
    *Jun 4 10:03:17.191: RIP: sending v2 update to 224.0.0.9 via Serial1/1 (192.168.12.1)
    *Jun 4 10:03:17.195: RIP: Update contains 1 routes
    *Jun 4 10:03:17.195: RIP: Update queued
    *Jun 4 10:03:17.199: RIP: Update sent via Serial1/1
    在R1,R2上打了no auto-summary后 在R1上看到的debug ip rip database信息:
    R1(config-router)#
    *Jun 4 10:04:42.087: RIP: received v2 update from 192.168.12.2 on Serial1/1
    *Jun 4 10:04:42.091: RIP-DB: network_update with 2.2.2.0/24 succeeds
    *Jun 4 10:04:42.091: RIP-DB: adding 2.2.2.0/24 (metric 1) via 192.168.12.2 on Serial1/1 to RIP database
    *Jun 4 10:04:42.095: RIP-DB: add 2.2.2.0/24 (metric 1) via 192.168.12.2 on Serial1/1
    *Jun 4 10:04:42.095: RIP-DB: Adding new rndb entry 2.2.2.0/24
    *Jun 4 10:04:42.099: RIP-DB: network_update with 22.22.22.0/24 succeeds
    *Jun 4 10:04:42.099: RIP-DB: adding 22.22.22.0/24 (metric 1) via 192.168.12.2 on Serial1/1 to RIP database
    *Jun 4 10:04:42.103: RIP-DB: add 22.22.22.0/24 (metric 1) via 192.168.12.2 on Serial1/1