实验10: RIP

 

  实验7-1 :  RIPV1

     实验目的
通过本实验可以掌握:
1. 在路由器上启动RIPv1 路由进程
2. 启用参与路由协议的接口,并且通告网络
3. 理解路由表的含义
4. 查看和调试RIPv1 路由协议相关信息

     实验拓扑

 

 

 实验步骤
n     步骤1:配置路由器R2
router(config)#host R2
R2(config)#no ip do lo
R2(config)#int s1/0
R2(config-if)#ip add 192.168.12.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int lo0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config)#router rip
R2(config-router)#version 1
R2(config-router)#network 2.0.0.0
R2(config-router)#network 192.168.12.0
R2(config-router)#passive-interface lo0

n     步骤2:配置路由器R1
router(config)#host R1
R1(config)#no ip do lo
R1(config)#int s1/0
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no sh
R1(config)#int s1/1
R1(config-if)#ip add 192.168.13.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no sh

R1(config-if)#int lo0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config)#router rip
R1(config-router)#version 1
R1(config-router)#network 1.0.0.0
R1(config-router)#network 192.168.12.0
R1(config-router)#network 192.168.13.0
R1(config-router)#passive-interface lo0
        
n     步骤3:配置路由器R3
router(config)#host R3
R3(config)#no ip do lo
R3(config)#int s1/0
R3(config-if)#ip add 192.168.13.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int lo0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config)#router rip
R3(config-router)#version 1
R3(config-router)#network 3.3.3.0
R3(config-router)#network 192.168.13.0
R3(config-router)#passive-interface lo0

     实验调试

n     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

C    192.168.12.0/24 is directly connected, Serial1/0
     1.0.0.0/24 is subnetted, 1 subnets
C    1.1.1.0 is directly connected, Loopback0
C    192.168.13.0/24 is directly connected, Serial1/1
R    2.0.0.0/8 [120/1] via 192.168.12.2, 00:00:08, Serial1/0
R    3.0.0.0/8 [120/1] via 192.168.13.3, 00:00:08, Serial1/1

n    R1#debug ip rip

RIP protocol debugging is on
*Mar  1 00:39:09.591: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.13.1)
*Mar  1 00:39:09.595: RIP: build update entries
*Mar  1 00:39:09.595:   network 1.0.0.0 metric 1
*Mar  1 00:39:09.599:   network 2.0.0.0 metric 1
*Mar  1 00:39:09.599:   network 192.168.12.0 metric 1
*Mar  1 00:39:17.423: RIP: received v1 update from 192.168.13.3 on Serial1/1
*Mar  1 00:39:17.427:      3.0.0.0 in 1 hops
*Mar  1 00:39:19.327: RIP: received v1 update from 192.168.12.2 on Serial1/0
*Mar  1 00:39:19.331:      2.0.0.0 in 1 hops
*Mar  1 00:39:22.967: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (192.168.12.1)
*Mar  1 00:39:39.011: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.13.1)

【测试】
R2(config)#router rip
R2(config-router)#passive-interface s1/0
R2#debug ip rip
查看R2能否接收到来自R1的rip更新通告
R1#debug ip rip
查看R1能否接收到来自s1/0的rip更新通告
R2(config)#router rip
R2(config-router)#neighbor 192.168.12.1
R1#debug ip rip
查看R1能否接收到来自s1/0的rip更新通告

【提示】
被动接口只能接收路由更新,不能以广播或组播方式发送更新,但是可以以单播的方式发送更新,配置单播更新的命令如下:

R2(config)#router rip
R2(config-router)#passive-interface s1/0
R2(config-router)#neighbor 192.168.12.1

 

实验7-2   RIPV2

     实验目的
通过本实验可以掌握:

(1)在路由器上启动RIPv2 路由进程
(2)启用参与路由协议的接口,并且通告网络
(3)auto-summary 的开启和关闭
(4)查看和调试RIPv2 路由协议相关信息
   

     实验拓扑

 

 

 

 实验步骤
n    路由器R2的主要配置
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 2.2.2.0
R2(config-router)#network 192.168.12.0

n    路由器R1的主要配置
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 192.168.12.0
R1(config-router)#network 192.168.13.0
R1(config-router)#network 1.1.1.0


n    路由器R3的主要配置
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#no auto-summary
R3(config-router)#network 192.168.13.0
R3(config-router)#network 3.3.3.0

     实验调试
n       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

C    192.168.12.0/24 is directly connected, Serial1/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
C    192.168.13.0/24 is directly connected, Serial1/1
     2.0.0.0/24 is subnetted, 1 subnets
R       2.2.2.0 [120/1] via 192.168.12.2, 00:00:28, Serial1/0
     3.0.0.0/24 is subnetted, 1 subnets
R       3.3.3.0 [120/1] via 192.168.13.3, 00:00:07, Serial1/1

以上输出表明路由器R1 学到了2条RIP 路由,其中路由条目”R  3.3.3.0 [120/1] via 192.168.13.3, 00:00:07, Serial1/1”含义如下:
n    R:路由条目是通过RIP 路由协议学习来的;
n    3.3.3.0/24:目的网络;
n    120:RIP 路由协议的默认管理距离;
n    1: 度量值,从路由器R1 到达网络3.3.3.0/24 的度量值为1 跳;
n    192.168.13.3:下一跳地址;
n    00:00:07:距离下一次更新还有23(30-7)秒;
n    Serial1/0:接收该路由条目的本路由器的接口
【提示】可以看到auto-summary关闭后,通过RIPv2学到的不再是汇总到major-net的路由
                   

n     R1#show ip protocol             //查看路由器协议配置和统计信息
  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 24 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
    Serial1/0             2     2                                    
    Serial1/1             2     2                                    
    Loopback0             2     2                                    
  Automatic network summarization is not in effect
  Maximum path: 4
  Routing for Networks:
    1.0.0.0
    192.168.12.0
    192.168.13.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.13.3         120      00:00:04
    192.168.12.2         120      00:00:27
     Distance: (default is 120)
   
 Routing Protocol is "rip"
//路由器上运行的路由协议是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 24 seconds
//更新周期是30 秒,距离下次更新还有24 秒
//为了防止更新同步,RIP 会以15%的误差发送更新,即实际发送更新的周期的范围是25.5-30 秒。

Invalid after 180 seconds, hold down 180, flushed after 240
//invalid after:路由条目在180 秒没有收到更新,则被标记为无效
//hold down:抑制计时器的时间为180 秒
//flushed after:路由条目如果在240 秒还没有收到更新,则从路由表中删除此路由条目

Redistributing: rip
//只运行RIP 协议,没有其它的协议重分布进来

Default version control: send version 2, receive version 2
//默认发送版本2的路由更新,接收本版2 的路由更新


Interface Send Recv Triggered RIP Key-chain
Serial1/0   2   2
Serial1/1   2   2
Loopback0   2   2
//以上三行显示了运行RIP 协议的接口,以及可以接收和发送的RIP 路由更新的版本RIPv2

【提示】 默认情况下只接收和发送版本2 的路由更新,可以通过命令“ip rip send version”和“ip rip receive version”来控制在路由器接口上接收和发送的版本,例如在s1/0 接口上接收版本1 和2 的路由更新,但是只发送版本2 的路由更新,配置如下:
R1(config-if)#ip rip send version 2
R1(config-if)#ip rip receive version 1 2

Automatic network summarization is not in effect
//RIP 路由协议关闭自动汇总功能
Maximum path: 4
//RIP 路由协议可以支持4 条等价路径,最大为6 条

【提示】可以通过下面的命令来修改RIP 路由协议支持等价路径的条数:
R1(config-router)#maximum-paths number-paths
Routing for Networks:
 1.0.0.0
 192.168.12.0
 192.168.13.0
//以上三行表明RIP 通告的网络
Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.13.3         120      00:00:04
    192.168.12.2         120      00:00:27
//以上三行表明路由信息源,其中:
//gateway:学习路由信息的路由器的接口地址,也就是下一跳地址
//distance:管理距离
//last update:更新发生在多长时间以前
Distance: (default is 120)
//默认管理距离是120


 

实验7-3 : RIPV2 认证和触发更新

     实验目的
通过本实验可以掌握:

(1)RIPv2 明文认证的配置和匹配原则
(2)RIPv2 MD5 认证的配置和匹配原则
(3)RIPv2 触发更新   

     实验拓扑

 

 

 

 实验步骤
n    步骤1:配置路由器R2
R2(config)#key chain test //配置钥匙链
R2(config-keychain)#key 1 //配置KEY ID
R2(config-keychain-key)#key-string cisco //配置KEY ID 的密匙
R2(config)#interface s1/0
R2(config-if)#ip rip authentication mode md5   
//启用认证,认证模式为密文,默认认证模式是明文,所以也可以不用指定
R2(config-if)#ip rip authentication key-chain test //在接口上调用钥匙链
R2(config-if)#ip rip triggered //在接口上启用触发更新
n    步骤2:配置路由器R1
R1(config)#key chain test
R1(config-keychain)#key 1
R1(config-keychain-key)#key-string cisco
R1(config)#interface s1/0
R1(config-if)#ip rip authentication mode md5
R1(config-if)#ip rip authentication key-chain test
R1(config-if)#ip rip triggered
R1(config-if)#interface s1/1
R1(config-if)#ip rip authentication mode md5
R1(config-if)#ip rip authentication key-chain test
R1(config-if)#ip rip triggered
n    步骤3:配置路由器R3
R3(config)#key chain test
R3(config-keychain)#key 1
R3(config-keychain-key)#key-string cisco
R3(config)#interface s1/1
R3(config-if)#ip rip authentication mode md5
R3(config-if)#ip rip authentication key-chain test
R3(config-if)#ip rip triggered


     实验调试
(1)R1#show ip protocol
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 0, flushed after 240
 // 由于触发更新,hold down 计时器自动为0
  Redistributing: rip
  Default version control: send version 2, receive version 2
    Interface             Send  Recv  Triggered RIP  Key-chain
    Serial1/0             2     2          Yes       test            
    Serial1/1             2     2          Yes       test            
    Loopback0           2     2                                    
//以上两行表明s1/0 和s1/1 接口启用了认证和触发更新
  Automatic network summarization is not in effect
  Maximum path: 4
  Routing for Networks:
    1.0.0.0
    192.168.12.0
    192.168.13.0
  Routing Information Sources:
    Gateway         Distance      Last Update
    192.168.13.3         120      00:02:03
    192.168.12.2         120      00:03:16
  Distance: (default is 120)
        
(2)R1#debug ip rip
RIP protocol debugging is on
R1#clear ip route *
*Mar  1 01:15:11.099: RIP: sending triggered request on Serial1/0 to 224.0.0.9
*Mar  1 01:15:11.115: RIP: sending triggered request on Serial1/1 to 224.0.0.9
*Mar  1 01:15:11.119: RIP: sending request on Loopback0 to 224.0.0.9
*Mar  1 01:15:11.143: RIP: send v2 triggered flush update to 192.168.12.2 on Serial1/0 with no route
*Mar  1 01:15:11.143: RIP: start retransmit timer of 192.168.12.2
*Mar  1 01:15:11.143: RIP: send v2 triggered flush update to 192.168.13.3 on Serial1/1 with no route
*Mar  1 01:15:11.143: RIP: start retransmit timer of 192.168.13.3
*Mar  1 01:15:11.187: RIP: received packet with MD5 authentication
*Mar  1 01:15:11.191: RIP: received v2 triggered update from 192.168.12.2 on Serial1/0
*Mar  1 01:15:11.191: RIP: sending v2 ack to 192.168.12.2 via Serial1/0 (192.168.12.1),
     flush, seq# 5
*Mar  1 01:15:11.199:      2.2.2.0/24 via 0.0.0.0 in 1 hops
*Mar  1 01:15:11.207: RIP: received packet with MD5 authentication
*Mar  1 01:15:11.211: RIP: received v2 triggered update from 192.168.12.2 on Serial1/0
*Mar  1 01:15:11.211: RIP: sending v2 ack to 192.168.12.2 via Serial1/0 (192.168.12.1),
     flush, seq# 6
*Mar  1 01:15:11.231:      2.2.2.0/24 via 0.0.0.0 in 1 hops
*Mar  1 01:15:11.235: RIP: received packet with MD5 authentication
*Mar  1 01:15:11.235: RIP: received v2 triggered ack from 192.168.12.2 on Serial1/0
     flush seq# 4
*Mar  1 01:15:11.239: RIP: send v2 triggered update to 192.168.12.2 on Serial1/0
*Mar  1 01:15:11.243: RIP: build update entries
*Mar  1 01:15:11.243:   route 37: 1.1.1.0/24 metric 1, tag 0
*Mar  1 01:15:11.247:   route 39: 192.168.13.0/24 metric 1, tag 0
*Mar  1 01:15:11.247: RIP: Update contains 2 routes, start 37, end 43
*Mar  1 01:15:11.251: RIP: start retransmit timer of 192.168.12.2
*Mar  1 01:15:11.279: RIP: received packet with MD5 authentication
*Mar  1 01:15:11.283: RIP: received v2 triggered update from 192.168.13.3 on Serial1/1
*Mar  1 01:15:11.287: RIP: sending v2 ack to 192.168.13.3 via Serial1/1 (192.168.13.1),
     flush, seq# 5
*Mar  1 01:15:11.291:      3.3.3.0/24 via 0.0.0.0 in 1 hops
*Mar  1 01:15:11.295: RIP: received packet with MD5 authentication
*Mar  1 01:15:11.299: RIP: received v2 triggered update from 192.168.13.3 on Serial1/1
*Mar  1 01:15:11.303: RIP: sending v2 ack to 192.168.13.3 via Serial1/1 (192.168.13.1),
     flush, seq# 6
*Mar  1 01:15:11.307:      3.3.3.0/24 via 0.0.0.0 in 1 hops
*Mar  1 01:15:11.311: RIP: received packet with MD5 authentication
*Mar  1 01:15:11.311: RIP: received v2 triggered ack from 192.168.13.3 on Serial1/1
     flush seq# 3
【提示】 从上面的输出可以看出,在R1 上,虽然我们打开了debug ip rip,但是由于采用触发更新,所以并没有看到每30 秒更新一次的信息,而是清除了路由表这件事件触发了路由更新。而且所有的更新中都有“triggered”的字样,同时在接收的更新中带有“MD5 authentication”的字样,证明接口s1/0 和s1/1 启用了触发更新和密文认证
(3) R1#show ip rip database
1.0.0.0/8    auto-summary
1.1.1.0/24    directly connected, Loopback0
2.0.0.0/8    auto-summary
2.2.2.0/24  
[1] via 192.168.12.2, 00:14:59 (permanent), Serial1/0
   * Triggered Routes:
- [1] via 192.168.12.2, Serial1/0
3.0.0.0/8    auto-summary
3.3.3.0/24
    [1] via 192.168.13.3, 00:14:59 (permanent), Serial1/1
   * Triggered Routes:
     - [1] via 192.168.13.3, Serial1/1
192.168.12.0/24    auto-summary
192.168.12.0/24    directly connected, Serial1/0
192.168.13.0/24    auto-summary
192.168.13.0/24    directly connected, Serial1/1
以上输出进一步说明了在s1/0 和s1/1 启用了触发更新。

(4) R1#show run | begin router rip
 router rip
 version 2
 timers basic 30 180 0 240
//由于触发更新,在配置中自动加入上面一行,且hold down 计时器被设置为0
 network 1.0.0.0
 network 192.168.12.0
 network 192.168.13.0
 no auto-summary


 


 

 

posted @ 2017-12-09 18:27  钟桂耀  阅读(584)  评论(0编辑  收藏  举报