网络工程师交换试验手册之九:RIP单播和被动接口实验

实验目的:
根据实验的内容我们可以掌握,被动接口在RIP中的作用,什么是被动接口,以及起了被动接口有什么好处,另外,单播与被动接口有什么关系,二者如何配合使用。
实验拓扑:


实验内容:
1. 路由器的基本RIP配置
r1#sh run
Building configuration...
Current configuration : 457 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname r1
!
!
ip subnet-zero
!
!
!
!
interface Ethernet0
ip address 199.99.1.1 255.255.255.0
!
interface Serial0
no ip address
shutdown
!
interface Serial1
ip address 199.99.2.1 255.255.255.0
clockrate 64000
!
router rip
network 199.99.1.0
network 199.99.2.0
!
no ip http server
ip classless
!
!
line con 0
line aux 0
line vty 0 4
!
end
r2#sh run
Building configuration...
00:51:56: %SYS-5-CONFIG_I: Configured from console by console
Current configuration : 599 bytes
!
version 12.2
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname r2
!
!
ip subnet-zero
!
!
!
!
interface Loopback0
ip address 198.98.98.1 255.255.255.0
!
interface Loopback1
ip address 198.98.97.1 255.255.255.0
!
interface Ethernet0
ip address 199.99.3.1 255.255.255.0
!
interface Serial0
ip address 199.99.2.2 255.255.255.0
!
interface Serial1
no ip address
shutdown
!
router rip
network 198.98.97.0
network 198.98.98.0
network 199.99.2.0
network 199.99.3.0
!
ip http server
ip classless
!
!
line con 0
line aux 0
line vty 0 4
!
end
2.查看两台路由器的路由表,看路由表象是否已经全。
r1#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       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    199.99.3.0/24 [120/1] via 199.99.2.2, 00:00:25, Serial1
C    199.99.2.0/24 is directly connected, Serial1
C    199.99.1.0/24 is directly connected, Ethernet0
R    198.98.97.0/24 [120/1] via 199.99.2.2, 00:00:25, Serial1
R    198.98.98.0/24 [120/1] via 199.99.2.2, 00:00:25, Serial1
r2#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       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    199.99.3.0/24 is directly connected, Ethernet0
C    199.99.2.0/24 is directly connected, Serial0
R    199.99.1.0/24 [120/1] via 199.99.2.1, 00:00:11, Serial0
C    198.98.97.0/24 is directly connected, Loopback1
C    198.98.98.0/24 is directly connected, Loopback0
3.查看两台路由器的数据库,其实数据库才应该是我们真正关心的东西,能够进入数据库就一定可以进入路由表。
r1#sh ip rip da
198.98.97.0/24    auto-summary
198.98.97.0/24
    [1] via 199.99.2.2, 00:00:18, Serial1
198.98.98.0/24    auto-summary
198.98.98.0/24
    [1] via 199.99.2.2, 00:00:18, Serial1
199.99.1.0/24    auto-summary
199.99.1.0/24    directly connected, Ethernet0
199.99.2.0/24    auto-summary
199.99.2.0/24    directly connected, Serial1
199.99.3.0/24    auto-summary
199.99.3.0/24
[1] via 199.99.2.2, 00:00:18, Serial1
r2#sh ip rip da
198.98.97.0/24    auto-summary
198.98.97.0/24    directly connected, Loopback1
198.98.98.0/24    auto-summary
198.98.98.0/24    directly connected, Loopback0
199.99.1.0/24    auto-summary
199.99.1.0/24
    [1] via 199.99.2.1, 00:00:07, Serial0
199.99.2.0/24    auto-summary
199.99.2.0/24    directly connected, Serial0
199.99.3.0/24    auto-summary
199.99.3.0/24    directly connected, Ethernet0
4.查看R1中的debug信息,看RIP发包的情况。
r1#
00:57:40: RIP: ignored v1 update from bad source 199.99.3.1 on Ethernet0
00:57:40: RIP: received v1 update from 199.99.2.2 on Serial1
00:57:40:      198.98.97.0 in 1 hops
00:57:40:      198.98.98.0 in 1 hops
00:57:40:      199.99.3.0 in 1 hops
r1#
00:57:49: RIP: sending v1 update to 255.255.255.255 via Ethernet0 (199.99.1.1)
00:57:49: RIP: build update entries
00:57:49:  network 198.98.97.0 metric 2
00:57:49:  network 198.98.98.0 metric 2
00:57:49:  network 199.99.2.0 metric 1
00:57:49:  network 199.99.3.0 metric 2
00:57:49: RIP: sending v1 update to 255.255.255.255 via Serial1 (199.99.2.1)
00:57:49: RIP: build update entries
00:57:49:  network 199.99.1.0 metric 1
我们发现R1把收到的所有的包,以广播的形式向自己直连的接口进行扩散,达到路由学习的目的,如果我们不允许R1的这种扩散,我们需要通过被动接口来实现。
5.被动接口与debug信息
r1(config)#router rip
r1(config-router)#passive-interface default  配置所有的接口为被动,所谓被动就是只收不发。
这时候看debug得出:
00:57:40: RIP: ignored v1 update from bad source 199.99.3.1 on Ethernet0
00:57:40: RIP: received v1 update from 199.99.2.2 on Serial1
00:57:40:      198.98.97.0 in 1 hops
00:57:40:      198.98.98.0 in 1 hops
00:57:40:      199.99.3.0 in 1 hops
它只是收到数据包,而不发包,这个时候,我们重新计算R1与R2的路由表
r1#clear ip route *
r2#clear ip route *
查看r2的路由表发现没有任何路由信息了
r2#sh ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
       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    199.99.3.0/24 is directly connected, Ethernet0
C    199.99.2.0/24 is directly connected, Serial0
R    199.99.1.0/24 is possibly down, routing via 199.99.2.1, Serial0
我们惊喜的发现路由现在的状态是possibly down了,观察这个现象。
C    198.98.97.0/24 is directly connected, Loopback1
C    198.98.98.0/24 is directly connected, Loopback0
这时候我们发现ping也不通了,这时候我们只想保证R1与R2的直连接口之间发送数据包,而R1不想向其他接口扩散。
r1(config-router)#neighbor 199.99.2.2
r1(config-router)#õ
r2(config)#router rip
r2(config-router)#nei
r2(config-router)#neighbor 199.99.2.1
r1#clear ip route *
r2#clear ip route *
再次看R1的debug
r1#debug ip rip
RIP protocol debugging is on
r1#
r1#
r1#
01:10:03: RIP: ignored v1 update from bad source 199.99.3.1 on Ethernet0
01:10:03: RIP: received v1 update from 199.99.2.2 on Serial1
01:10:03:      198.98.97.0 in 1 hops
01:10:03:      198.98.98.0 in 1 hops
01:10:03:      199.99.3.0 in 1 hops
01:10:03: RIP: received v1 update from 199.99.2.2 on Serial1
01:10:03:      198.98.97.0 in 1 hops
01:10:03:      198.98.98.0 in 1 hops
01:10:03:      199.99.3.0 in 1 hops
01:10:12: RIP: sending v1 update to 199.99.2.2 via Serial1 (199.99.2.1)
01:10:12: RIP: build update entries
01:10:12:       network 199.99.1.0 metric 1
我们已经发现两端可以互相发和接受了,但是R1不向其他的接口扩散。
实验总结:
通过这个扩展实验的训练,我们更加清楚的认识到RIP的特性,这个实验是比较重要的,希望大家可以完成。

你可能感兴趣的:(职场,休闲,交换,网络工程师,试验手册)