3.1 RIP版本1&2配置
 
实验连接图
3.1 RIP版本1&2配置_RIP
提要描述
RIP(Routing information Protocol)是应用较早、使用较普遍的内部网关协议(Interior Gateway Protocol,简称IGP),适用于小型同类网络,是典型的距离向量(distance-vector)协议。文档见RFC1058RFC1723RIP通过广播UDP报文来交换路由信息,每30秒发送一次路由信息更新。RIP提供跳跃计数(hop count)作为尺度来衡量路由距离,跳跃计数是一个包到达目标所必须经过的路由器的数目。如果到相同目标有二个不等速或不同带宽的路由器,但跳跃计数相同,则RIP认为两个路由是等距离的。RIP最多支持的跳数为15,即在源和目的网间所要经过的最多路由器的数目为15,跳数16表示不可达
实验目标: 查看RIP运行基本情况
RIPv1基本配置
R1的配置
R2的配置
!
hostname R1
!
interface Serial1/1
 ip address 12.1.1.1 255.255.255.0
clock rate 64000
!
router rip
 network 12.0.0.0
!
!
hostname R2
!
interface Serial1/0
 ip address 12.1.1.2 255.255.255.0
!
interface Serial1/1
 ip address 23.1.1.2 255.255.255.0
!
router rip
 network 12.0.0.0
 network 23.0.0.0
!
R3的配置
 
!
hostname R3
!
interface Serial1/0
 ip address 23.1.1.3 255.255.255.0
clock rate 64000
!
router rip
 network 23.0.0.0
!
 
↓调试配置及监测步骤↓
 
下面分别看看R1R2R3的路由表
 
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
 
R    23.0.0.0/8 [120/1] via 12.1.1.2, 00:00:19, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial1/1
 
 
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
 
     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial1/0
 
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
 
     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, Serial1/0
R    12.0.0.0/8 [120/1] via 23.1.1.2, 00:00:17, Serial1/0
 
查看RIP的运行情况
R1#show ip protocols
Routing Protocol is "rip"
  Sending updates every 30 seconds, next due in 25 seconds
  Invalid after 180 seconds, hold down 180, flushed after 240
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Redistributing: rip
  Default version control: send version 1, receive any version
    Interface             Send  Recv  Triggered RIP  Key-chain
    Serial1/1             1     1 2  #RIPv1发送版本1,介绍版本12                 
  Automatic network summarization is in effect
  Maximum path: 4
  Routing for Networks:
    12.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    12.1.1.2             120      00:00:12
  Distance: (default is 120)  #……………rip默认管理距离120
 
R1#ping 23.1.1.3
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.1.1.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/80/136 ms
 
Debug可以打开RIP的排错功能
 
R1#debug ip rip ?
  database  RIP database events
  events    RIP protocol events
  trigger   RIP trigger extension
 
R1#debug ip rip
RIP protocol debugging is on
R1#
*Feb 17 18:22:56.755: RIP: received v1 update from 12.1.1.2 on Serial1/1
*Feb 17 18:22:56.759:      23.0.0.0 in 1 hops
*Feb 17 18:23:06.247: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (12.1.1.1)
*Feb 17 18:23:06.247: RIP: build update entries - suppressing null update
R1#un all
All possible debugging has been turned off
 
 
RIPv2
RIPv2提要描述
RIPv1可以侦听版本1和版本2的数据包,但只发送版本1的更新,如果要Router发送版本2的更新,必须使用版本2命令:Version 2
实验目标: 查看RIPv2运行基本情况
RIPv2基本配置
R1的配置
R2的配置
!
hostname R1
!
interface Serial1/1
 ip address 12.1.1.1 255.255.255.0
clock rate 64000
!
router rip
 version 2
 network 12.0.0.0
!
!
hostname R2
!
interface Serial1/0
 ip address 12.1.1.2 255.255.255.0
!
interface Serial1/1
 ip address 23.1.1.2 255.255.255.0
!
router rip
 version 2
 network 12.0.0.0
 network 23.0.0.0
!
R3的配置
 
!
hostname R3
!
interface Serial1/0
 ip address 23.1.1.3 255.255.255.0
clock rate 64000
!
router rip
 version 2
 network 23.0.0.0
!
 
↓调试配置及监测步骤↓
下面看看R1的情况,R2R3类似省略
R1#show ip protocols
Routing Protocol is "rip"
  Sending updates every 30 seconds, next due in 2 seconds
  Invalid after 180 seconds, hold down 180, flushed after 240
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Redistributing: rip
  Default version control: send version 2, receive version 2
    Interface             Send  Recv  Triggered RIP  Key-chain
    Serial1/1             2     2                                   
  Automatic network summarization is in effect
  Maximum path: 4
  Routing for Networks:
    12.0.0.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    12.1.1.2             120      00:00:13
  Distance: (default is 120)
 
R1#sh 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    23.0.0.0/8 [120/1] via 12.1.1.2, 00:00:00, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial1/1
 
R1#debug ip rip
RIP protocol debugging is on
R1#
*Mar  3 23:22:26.671: RIP: received v2 update from 12.1.1.2 on Serial1/1
*Mar  3 23:22:26.675:      23.0.0.0/8 via 0.0.0.0 in 1 hops
R1#
*Mar  3 23:22:45.099: RIP: sending v2 update to 224.0.0.9 via Serial1/1 (12.1.1.1)
*Mar  3 23:22:45.099: RIP: build update entries - suppressing null update
 
 
RIP版本1、版本2、默认互操作
提要描述
R1配置为版本2R2为默认、R3为版本1
实验目标: 查看三种配置的情况
基本配置
R1的配置
R2的配置
!
hostname R1
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface Serial1/1
 ip address 12.1.1.1 255.255.255.0
clock rate 64000
!
router rip
 version 2
 network 0.0.0.0
!
!
hostname R2
!
interface Loopback0
 ip address 2.2.2.2 255.255.255.0
!
interface Serial1/0
 ip address 12.1.1.2 255.255.255.0
!
interface Serial1/1
 ip address 23.1.1.2 255.255.255.0
!
router rip
 network 0.0.0.0
!
R3的配置
 
!
hostname R3
!
interface Loopback0
 ip address 1.1.1.1 255.255.255.0
!
interface Serial1/0
 ip address 23.1.1.3 255.255.255.0
clock rate 64000
!
router rip
 version 1
 network 0.0.0.0
!
 
↓调试配置及监测步骤↓
首先我们来看看R1R2R3的路由表情况
R1#sh ip route
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial1/1
R1没有学习到路由
 
R2#show ip route
R    1.0.0.0/8 [120/1] via 12.1.1.1, 00:00:13, Serial1/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 23.1.1.3, 00:00:13, Serial1/1
     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial1/0
R2学习到了R1R3的路由
 
R3#show ip route
R    1.0.0.0/8 [120/2] via 23.1.1.2, 00:00:20, Serial1/0
R    2.0.0.0/8 [120/1] via 23.1.1.2, 00:00:20, Serial1/0
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, Serial1/0
R    12.0.0.0/8 [120/1] via 23.1.1.2, 00:00:20, Serial1/0
R3学到了R1R2的路由
 
 
出现上面路由表的结果原因在于:
1R1#show ip protocols
  Default version control: send version 2, receive version 2
  R1运行的是版本2,只会发送版本2和接受版本2
2R2#show ip protocols
  Default version control: send version 1, receive any version
  R2是默认的版本,它可以发送版本1和接受到任何版本
  所以R2能够接受到来自R1R3的路由
3: R3#show ip protocols
  Default version control: send version 1, receive version 1
  R3运行指定是版本1,只会发生和接受版本1
  所以R3只能够收到版本1的路由。
4:细心留意会发现,R3只会接受版本1,为什么会学到R1的路由??这是因为R2学到了R1的路由后,发送给R3,所以R3也学到了R1的路由。
 
下面使用Debug看看各个路由器的信息:
R1#debug ip rip events
RIP event debugging is on
R1#
*Mar  4 00:11:52.275: RIP: ignored v1 packet from 12.1.1.2 (illegal version)  #可以看到R1忽略了R2发过来版本1的数据
R1#
*Mar  4 00:12:02.851: RIP: sending v2 update to 224.0.0.9 via Serial1/1 (12.1.1.1)
*Mar  4 00:12:02.851: RIP: Update contains 1 routes
*Mar  4 00:12:02.855: RIP: Update queued
*Mar  4 00:12:02.855: RIP: Update sent via Serial1/1
*Mar  4 00:12:03.047: RIP: sending v2 update to 224.0.0.9 via Loopback0 (1.1.1.1)
*Mar  4 00:12:03.047: RIP: Update contains 1 routes
*Mar  4 00:12:03.051: RIP: Update queued
*Mar  4 00:12:03.051: RIP: Update sent via Loopback0
*Mar  4 00:12:03.055: RIP: ignored v2 packet from 1.1.1.1 (sourced from one of our addresses) #源来自同一个路由器也忽略
 
 
R2#debug ip rip events
RIP event debugging is on
R2#
*Mar  4 00:12:07.783: RIP: received v2 update from 12.1.1.1 on Serial1/0 #收到来自R1的更新
*Mar  4 00:12:07.787: RIP: Update contains 1 routes
*Mar  4 00:12:07.903: RIP: received v1 update from 23.1.1.3 on Serial1/1 #收到来自R3的更新
*Mar  4 00:12:07.907: RIP: Update contains 1 routes
R2#
*Mar  4 00:12:21.715: RIP: sending v1 update to 255.255.255.255 via Loopback0 (2.2.2.2)
*Mar  4 00:12:21.719: RIP: Update contains 4 routes
*Mar  4 00:12:21.719: RIP: Update queued
*Mar  4 00:12:21.719: RIP: Update sent via Loopback0
R2#
*Mar  4 00:12:24.571: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (12.1.1.2)
*Mar  4 00:12:24.575: RIP: Update contains 3 routes
*Mar  4 00:12:24.575: RIP: Update queued
*Mar  4 00:12:24.575: RIP: Update sent via Serial1/0
R2#
*Mar  4 00:12:32.515: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (23.1.1.2)
*Mar  4 00:12:32.519: RIP: Update contains 3 routes
*Mar  4 00:12:32.519: RIP: Update queued
*Mar  4 00:12:32.519: RIP: Update sent via Serial1/1
 
 
R3#debug ip rip events
RIP event debugging is on
R3#
*Mar  4 00:12:32.375: RIP: received v1 update from 23.1.1.2 on Serial1/0 #收到来自R2的更新
*Mar  4 00:12:32.379: RIP: Update contains 3 routes
R3#
*Mar  4 00:12:34.819: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (23.1.1.3)
*Mar  4 00:12:34.823: RIP: Update contains 1 routes
*Mar  4 00:12:34.823: RIP: Update queued
*Mar  4 00:12:34.823: RIP: Update sent via Serial1/0
R3#
*Mar  4 00:12:53.891: RIP: sending v1 update to 255.255.255.255 via Loopback0 (3.3.3.3)
*Mar  4 00:12:53.895: RIP: Update contains 4 routes
*Mar  4 00:12:53.895: RIP: Update queued
*Mar  4 00:12:53.895: RIP: Update sent via Loopback0
 
上面的debug信息中R1使用的是组播更新224.0.0.9)版本2的特性,R2R3使用广播更新255.255.255.255
 
使用ping看看互通性:
R1#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 0 percent (0/5)
R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R1学不到任何路由,所以ping不通是正常。
 
R2#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 100 percent (5/5), round-trip min/avg/max = 4/50/96 ms
R2#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/55/132 ms
R2学到了全部路由,所以可以ping 通R1R3
 
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#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 = 12/45/80 ms
这里发生了一个有趣的现象,R3学到了全部路由,ping R2通,但却ping不通R1????
这是因为R3学到R1的路由信息是从R2学到的,R3有到达R1的路由信息,但R1却不知道如何到达R3,数据包有去无回。
当然我们可以通过在接口下指定接受和发送的情况:
R1(config)#int s1/1 
R1(config-if)#ip rip ?
  receive         advertisement reception
  send            advertisement transmission
R1(config-if)#ip rip receive version ?
  1  RIP version 1
  2  RIP version 2
  <cr>
R1(config-if)#ip rip receive version 1
看看R1指定了接受版本1之后的路由表和互通性情况:
R1#show ip route
     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 12.1.1.2, 00:00:23, Serial1/1
R    3.0.0.0/8 [120/2] via 12.1.1.2, 00:00:23, Serial1/1
R    23.0.0.0/8 [120/1] via 12.1.1.2, 00:00:23, Serial1/1
     12.0.0.0/24 is subnetted, 1 subnets
C       12.1.1.0 is directly connected, Serial1/1
R1#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 = 16/51/80 ms
R1#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/70/112 ms
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 100 percent (5/5), round-trip min/avg/max = 24/54/84
从结果可以看到,通过在接口下指定了接收情况,R1学到了全部路由,且R1R3可以互通。