RIPv1&RIPv2兼容实验

 

 
RIPv1&RIPv2 兼容实验
 

RIPv1&RIPv2兼容实验_第1张图片

一、           概述
RIP(Routing information Protocol)是应用较早、使用较普遍的内部网关协议(Interior Gateway Protocol,简称IGP),适用于小型同类网络,是典型的距离矢量(distance-vector)路由协议。 RIP使用广播通过UDP 520端口交换路由信息,每隔30秒发送一次路由更新;管理距离默认为120;RIP使用跳数(hop count)来衡量路径标准,最多只支持 15跳,16跳则认为路由不可达。
RIPv1和 RIPv2收发机制也是不同的,默认情况为RIPv1,发送版本1信息,接受版本1和2;可以手工指定版本号,若指定为版本1,则发送版本1信息,接受也是版本1信息,若指定为版本2,则发送版本2信息,接受则是版本2信息。
二、           配置
R1配置为版本 2,R2默认配置,R3配置为版本1
R1(config)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#exi
R1(config)#int s0/0
R1(config-if)#ip add 10.12.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exi
R1(config)#int s0/2
R1(config-if)#ip add 10.13.13.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exi
R1(config)#router rip
R1(config-router)#version 2 //手工指定为版本2
R1(config-router)#network 0.0.0.0
R1(config-router)#end
 
 
R2(config)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#exi
R2(config)#int s0/0
R2(config-if)#ip add 10.12.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exi
R2(config)#int s0/1
R2(config-if)#ip add 10.23.23.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exi
R2(config)#router rip    //默认配置
R2(config-router)#network 0.0.0.0
R2(config-router)#end
 
R3(config)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#exi
R3(config)#int s0/1
R3(config-if)#ip add 10.23.23.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exi
R3(config)#int s0/2
R3(config-if)#ip add 10.13.13.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exi
R3(config)#router rip
R3(config-router)#version 1    //手工指定为版本1
R3(config-router)#network 0.0.0.0
R3(config-router)#end
三、           实验调试
R1#show ip protocols
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 16 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
    Serial0/0             2      2                                    
    Serial0/2             2     2              // 发送版本2, 接受版本2                    
    Loopback0             2      2                                    
 Automatic network summarization is in effect
 Maximum path: 4
 Routing for Networks:
    0.0.0.0
 Routing Information Sources:
    Gateway         Distance      Last Update
 Distance: (default is 120)                         //RIP管理距离默认120
 
R1#
 
R2#show ip protocols
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 10 seconds
 Invalid after 180 seconds, hold down 180, flushed after 240
 Redistributing: rip
 Default version control: send version 1, receive any version
    Interface             Send Recv Triggered RIP Key-chain
    Serial0/0             1      1 2                                  
    Serial0/1             1      1 2            //发送版本1,接受版本1、2     
    Loopback0             1      1 2                                  
 Automatic network summarization is in effect
 Maximum path: 4
 Routing for Networks:
    0.0.0.0
 Routing Information Sources:
    Gateway         Distance      Last Update
    10.23.23.3           120       00:00:16
    10.12.12.1           120      00:00:15
  Distance: (default is 120)
 
R2#
 
R3#show ip protocols
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 23 seconds
 Invalid after 180 seconds, hold down 180, flushed after 240
 Redistributing: rip
 Default version control: send version 1, receive version 1
    Interface             Send Recv Triggered RIP Key-chain
    Serial0/1             1      1                                    
    Serial0/2             1      1              //发送版本1,接受版本1         
    Loopback0             1      1                                    
 Automatic network summarization is in effect
 Maximum path: 4
 Routing for Networks:
    0.0.0.0
 Routing Information Sources:
    Gateway         Distance      Last Update
    10.23.23.2           120      00:00:11
 Distance: (default is 120)
 
 
 
由上述分析可以得出:
R1路由表学不到R2、R3的路由信息,R2能够学习到R1、R3的路由信息,R3能够学习到R2的路由信息但不能学习到R1的路由信息。
 
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     1.0.0.0/24 is subnetted, 1 subnets
C        1.1.1.0 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 2 subnets
C        10.13.13.0 is directly connected, Serial0/2
C        10.12.12.0 is directly connected, Serial0/0
R1#
 
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
R     1.0.0.0/8 [120/1] via 10.12.12.1, 00:00:22, Serial0/0
     2.0.0.0/24 is subnetted, 1 subnets
C        2.2.2.0 is directly connected, Loopback0
R     3.0.0.0/8 [120/1] via 10.23.23.3, 00:00:24, Serial0/1
     10.0.0.0/24 is subnetted, 3 subnets
C        10.23.23.0 is directly connected, Serial0/1
R        10.13.13.0 [120/1] via 10.23.23.3, 00:00:24, Serial0/1
                   [120/1] via 10.12.12.1, 00:00:22, Serial0/0
C        10.12.12.0 is directly connected, Serial0/0
R2#
 
 
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
R     1.0.0.0/8 [120/2] via 10.23.23.2, 00:00:25, Serial0/1
R     2.0.0.0/8 [120/1] via 10.23.23.2, 00:00:25, Serial0/1
     3.0.0.0/24 is subnetted, 1 subnets
C        3.3.3.0 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 3 subnets
C        10.23.23.0 is directly connected, Serial0/1
C        10.13.13.0 is directly connected, Serial0/2
R        10.12.12.0 [120/1] via 10.23.23.2, 00:00:25, Serial0/1
 
问:为什么R3能够学到R1的路由信息?
R2能够学习到R1的路由信息,R3通过R2学习到路由信息测试:
R3#ping 2.2.2.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/72/140 ms
R3#
R3#ping 1.1.1.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R3#
 
开启调试信息:
 
R1#debug ip rip
RIP protocol debugging is on
R1#
*Mar 1 00:50:47.427: RIP: sending v2 update to 224.0.0.9 via Loopback0 (1.1.1.1)
*Mar 1 00:50:47.427: RIP: build update entries
*Mar 1 00:50:47.427:    10.0.0.0/8 via 0.0.0.0, metric 1, tag 0
*Mar 1 00:50:47.431: RIP: ignored v2 packet from 1.1.1.1 (sourced from one of our addresses)
R1#
*Mar 1 00:50:55.799: RIP: ignored v1 packet from 10.12.12.2 (illegal version)
R1#
*Mar 1 00:50:56.983: RIP: ignored v1 packet from 10.13.13.3 (illegal version)
R1#
*Mar 1 00:50:59.639: RIP: sending v2 update to 224.0.0.9 via Serial0/0 (10.12.12.1)
*Mar 1 00:50:59.639: RIP: build update entries
*Mar 1 00:50:59.639:    1.0.0.0/8 via 0.0.0.0, metric 1, tag 0
*Mar 1 00:50:59.643:    10.13.13.0/24 via 0.0.0.0, metric 1, tag 0
R1#
*Mar 1 00:51:13.439: RIP: sending v2 update to 224.0.0.9 via Serial0/2 (10.13.13.1)
*Mar 1 00:51:13.439: RIP: build update entries
*Mar 1 00:51:13.439:    1.0.0.0/8 via 0.0.0.0, metric 1, tag 0
*Mar 1 00:51:13.443:    10.12.12.0/24 via 0.0.0.0, metric 1, tag 0
 
 
 
为什么R3路由表里有R1的路由条目,但是ping不通?
 
根据RIP的特性,从邻居学习到路由信息装入到路由表,因为R3是配置的RIP版本1,只能接受版本1 的路由,而R1配置的是版本2,只能发送和接受版本2的路由,从上述调试信息可以看出R1忽略来自R2、R3的路由信息,所以数据包有去无回!
 
那么要解决上述问题,可以手动指定RIP的收发机制。
在接口下更改收发情况
R1(config-if)#int s0/0
R1(config-if)#ip rip receive version 1
R1(config-if)#int s0/2
R1(config-if)#ip rip receive version 1
 
此时R1能够学习到全部路由了,R3也就能够ping通R1了
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     1.0.0.0/24 is subnetted, 1 subnets
C        1.1.1.0 is directly connected, Loopback0
R     2.0.0.0/8 [120/1] via 10.12.12.2, 00:00:07, Serial0/0
R     3.0.0.0/8 [120/1] via 10.13.13.3, 00:00:15, Serial0/2
     10.0.0.0/24 is subnetted, 3 subnets
R        10.23.23.0 [120/1] via 10.13.13.3, 00:00:15, Serial0/2
                   [120/1] via 10.12.12.2, 00:00:07, Serial0/0
C        10.13.13.0 is directly connected, Serial0/2
C        10.12.12.0 is directly connected, Serial0/0
 
 

你可能感兴趣的:(RIPv2,RIPv1)