3.1 RIP版本1&2配置

 

3.1 RIP 版本 1&2 配置
 
实验连接图
提要描述
RIP(Routing information Protocol) 是应用较早、使用较普遍的内部网关协议 (Interior Gateway Protocol, 简称 IGP) ,适用于小型同类网络,是典型的距离向量 (distance-vector) 协议。文档见 RFC1058 RFC1723 RIP 通过广播 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
!
 
↓调试配置及监测步骤↓
 
下面分别看看 R1 R2 R3 的路由表
 
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 ,介绍版本 1 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: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 的情况, R2 R3 类似省略
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 配置为版本 2 R2 为默认、 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
!
 
↓调试配置及监测步骤↓
首先我们来看看R1 R2 R3 的路由表情况
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 学习到了R1 R3 的路由
 
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 学到了R1 R2 的路由
 
 
出现上面路由表的结果原因在于:
1 R1#show ip protocols
  Default version control: send version 2, receive version 2
  R1 运行的是版本 2 ,只会发送版本 2 和接受版本 2
2 R2#show ip protocols
  Default version control: send version 1, receive any version
  R2 是默认的版本,它可以发送版本 1 和接受到任何版本
  所以 R2 能够接受到来自 R1 R3 的路由
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 的特性, R2 R3 使用广播更新 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 通R1 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#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 学到了全部路由,且R1 R3 可以互通。

你可能感兴趣的:(网络,配置,职场,休闲,rip)