实验目的:
1 掌握ripv1----有类路由协议,不支持VLSM的特性,广播更新--255.255.255.255
2 掌握ripv2----无类路由协议,支持VLSN,组播更新--224.0.0.9,自动汇总特性是开启的,要关闭切记!
3 掌握rip的手工路由汇总及其认证
4 掌握passive-interface特性及其默认路由的注入
实验拓扑:
RIPV1基本配置:
R1配置如下:
router rip
network 11.0.0.0
network 192.168.1.0
R2配置如下:
router rip
network 11.0.0.0
network 12.0.0.0
R3配置如下:
router rip
network 12.0.0.0
network 192.168.1.0
查看路由表如下:
R1#sh ip route
C 11.0.0.0/8 is directly connected, FastEthernet0/0
R 12.0.0.0/8 [120/1] via 11.0.0.2, 00:00:06, FastEthernet0/0
192.168.1.0/27 is subnetted, 2 subnets
C 192.168.1.64 is directly connected, Loopback0
C 192.168.1.32 is directly connected, Loopback1
R2#sh ip route
C 9.0.0.0/8 is directly connected, Loopback0
C 11.0.0.0/8 is directly connected, FastEthernet0/0
C 12.0.0.0/8 is directly connected, FastEthernet0/1
R 192.168.1.0/24 [120/1] via 11.0.0.1, 00:00:04, FastEthernet0/0
[120/1] via 12.0.0.2, 00:00:03, FastEthernet0/1
R3#sh ip route
R 11.0.0.0/8 [120/1] via 12.0.0.1, 00:00:08, FastEthernet0/1
C 12.0.0.0/8 is directly connected, FastEthernet0/1
192.168.1.0/27 is subnetted, 1 subnets
C 192.168.1.96 is directly connected, Loopback0
R3#debug ip rip
00:05:02: RIP: received v1 update from 12.0.0.1 on FastEthernet0/1
00:05:02: 11.0.0.0 in 1 hops
00:05:11: RIP: sending v1 update to 255.255.255.255 via FastEthernet0/1 (12.0.0.2)
00:05:11: RIP: build update entries
00:05:11: network 192.168.1.0 metric 1
00:05:11: RIP: sending v1 update to 255.255.255.255 via Loopback0 (192.168.1.97)
00:05:11: RIP: build update entries
00:05:11: network 11.0.0.0 metric 2
00:05:11: network 12.0.0.0 metric 1
从以上debug信息可以看出RIPV1是广播更新且不携带子网掩码,不支持VLSM
RIPV2实验
R1# sh running-config | begin router rip
router rip
version 2
network 11.0.0.0
network 192.168.1.0
no auto-summary[u1]
R2#sh running-config | begin router rip
router rip
version 2
network 11.0.0.0
network 12.0.0.0
no auto-summary
R3#sh running-config | begin router rip
router rip
version 2
network 12.0.0.0
network 192.168.1.0
no auto-summary
查看路由表如下:
R1#sh ip route rip
R 12.0.0.0/8 [120/1] via 11.0.0.2, 00:00:09, FastEthernet0/0
192.168.1.0/27 is subnetted, 3 subnets
R 192.168.1.96 [120/2] via 11.0.0.2, 00:00:09, FastEthernet0/0
R2#sh ip route rip
192.168.1.0/24 is variably subnetted, 4 subnets, 2 masks
R 192.168.1.96/27 [120/1] via 12.0.0.2, 00:00:24, FastEthernet0/1
R 192.168.1.64/27 [120/1] via 11.0.0.1, 00:00:20, FastEthernet0/0
R 192.168.1.32/27 [120/1] via 11.0.0.1, 00:00:20, FastEthernet0/0
R 192.168.1.0/24 is possibly down,
routing via 11.0.0.1, FastEthernet0/0
为什么是possibly down?失效定时器180秒,刷新定时器240秒
R3#sh ip route rip
R 11.0.0.0/8 [120/1] via 12.0.0.1, 00:00:18, FastEthernet0/1
192.168.1.0/27 is subnetted, 3 subnets
R 192.168.1.64 [120/2] via 12.0.0.1, 00:00:18, FastEthernet0/1
R 192.168.1.32 [120/2] via 12.0.0.1, 00:00:18, FastEthernet0/1
R3#debug ip rip
RIP protocol debugging is on
R3#
00:26:24: RIP: received v2 update from 12.0.0.1 on FastEthernet0/1
00:26:24: 11.0.0.0/8 via 0.0.0.0 in 1 hops
00:26:24: 192.168.1.0/24 via 0.0.0.0 in 2 hops
R3#
00:26:37: RIP: sending v2 update to 224.0.0.9 via FastEthernet0/1 (12.0.0.2)
00:26:37: RIP: build update entries
00:26:37: 192.168.1.96/27 via 0.0.0.0, metric 1, tag 0
00:26:37: RIP: sending v2 update to 224.0.0.9 via Loopback0 (192.168.1.97)
00:26:37: RIP: build update entries
00:26:37: 11.0.0.0/8 via 0.0.0.0, metric 2, tag 0
00:26:37: 12.0.0.0/8 via 0.0.0.0, metric 1, tag 0
00:26:37: 192.168.1.0/24 via 0.0.0.0, metric 3, tag 0
以上debug信息说明RIPV2支持VLSM,携带子网掩码,组播更新
路由汇总及其认证实验
R1#sh running-config int f0/0
interface FastEthernet0/0
ip address 11.0.0.1 255.0.0.0
ip summary-address rip 192.168.1.0 255.255.255.0
接口模式下手工路由汇总,一定要在路由模式下关闭自动汇总切记!!!!!!,不过要注意RIPV2的手工汇总只能汇总到主类网络的边界,严格来说它并不支持CIDR,只是传递CIDR
R2#sh ip route rip
192.168.1.0/24 is variably subnetted, 4 subnets, 2 masks
R 192.168.1.96/27 [120/1] via 12.0.0.2, 00:00:17, FastEthernet0/1
R 192.168.1.64/27 [120/1] via 11.0.0.1, 00:01:48, FastEthernet0/0
R 192.168.1.32/27 [120/1] via 11.0.0.1, 00:01:48, FastEthernet0/0
R 192.168.1.0/24 [120/1] via 11.0.0.1, 00:00:26, FastEthernet0/0
R3#sh ip route rip
R 11.0.0.0/8 [120/1] via 12.0.0.1, 00:00:18, FastEthernet0/1
192.168.1.0/27 is subnetted, 3 subnets
R 192.168.1.64 [120/2] via 12.0.0.1, 00:00:18, FastEthernet0/1
R 192.168.1.32 [120/2] via 12.0.0.1, 00:00:18, FastEthernet0/1
R3#sh ip route rip
R 11.0.0.0/8 [120/1] via 12.0.0.1, 00:00:02, FastEthernet0/1
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
R 192.168.1.0/24 [120/2] via 12.0.0.1, 00:00:02, FastEthernet0/1
对比R3汇总前后路由表的变化
R1#show running-config | begin router rip
router rip
version 2
passive-interface default
no passive-interface FastEthernet0/0
network 11.0.0.0
network 192.168.1.0
no auto-summary
以上配置说明除了F0/0接口,所有的接口只接听更新但不发送更新
R2#sh running-config
key chain ceshi
key 1
key-string cisco
interface FastEthernet0/1
ip rip authentication mode md5
ip rip authentication key-chain ceshi
R3的认证同R2
R2# sh ip protocols
Routing Protocol is "rip"
Sending updates every 30 seconds, next due in 17 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
FastEthernet0/0 2 2
FastEthernet0/1 2 2 ceshi
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
11.0.0.0
12.0.0.0
Routing Information Sources:
Gateway Distance Last Update
11.0.0.1 120 00:00:08
12.0.0.2 120 00:00:16
Distance: (default is 120)
默认路由的注入(1):
R2(config)#ip default-network 9.0.0.0 必须是分类的网络号
R2#sh ip route
C* 9.0.0.0/8 is directly connected, Loopback0[u2]
C 11.0.0.0/8 is directly connected, FastEthernet0/0
C 12.0.0.0/8 is directly connected, FastEthernet0/1
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
R 192.168.1.96/27 [120/1] via 12.0.0.2, 00:00:13, FastEthernet0/1
R 192.168.1.0/24 [120/1] via 11.0.0.1, 00:00:05, FastEthernet0/0
R1#sh ip route rip
R 12.0.0.0/8 [120/1] via 11.0.0.2, 00:00:04, FastEthernet0/0
192.168.1.0/27 is subnetted, 3 subnets
R 192.168.1.96 [120/2] via 11.0.0.2, 00:00:04, FastEthernet0/0
R* 0.0.0.0/0 [120/1] via 11.0.0.2, 00:00:04, FastEthernet0/0
R3#sh ip route rip
R 11.0.0.0/8 [120/1] via 12.0.0.1, 00:00:11, FastEthernet0/1
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
R 192.168.1.0/24 [120/2] via 12.0.0.1, 00:00:11, FastEthernet0/1
R* 0.0.0.0/0 [120/1] via 12.0.0.1, 00:00:11, FastEthernet0/1
默认路由的注入(2):
R2(config)#router rip
R2(config-router)#default-information originate
R2(config-router)#^Z
R2#sh ip route
Gateway of last resort is not set
C 9.0.0.0/8 is directly connected, Loopback0
C 11.0.0.0/8 is directly connected, FastEthernet0/0
C 12.0.0.0/8 is directly connected, FastEthernet0/1
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
R 192.168.1.96/27 [120/1] via 12.0.0.2, 00:00:03, FastEthernet0/1
R 192.168.1.0/24 [120/1] via 11.0.0.1, 00:00:21, FastEthernet0/0
R1#sh ip route rip
R 12.0.0.0/8 [120/1] via 11.0.0.2, 00:00:04, FastEthernet0/0
192.168.1.0/27 is subnetted, 3 subnets
R 192.168.1.96 [120/2] via 11.0.0.2, 00:00:04, FastEthernet0/0
R* 0.0.0.0/0 [120/1] via 11.0.0.2, 00:00:04, FastEthernet0/0
R3#sh ip route rip
R 11.0.0.0/8 [120/1] via 12.0.0.1, 00:00:11, FastEthernet0/1
192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
R 192.168.1.0/24 [120/2] via 12.0.0.1, 00:00:11, FastEthernet0/1
R* 0.0.0.0/0 [120/1] via 12.0.0.1, 00:00:11, FastEthernet0/1
以上2种方式都可以实现默认路由的注入,但是有所区别,用心体会一下
[u1]RIPV2会在有类的网络边界对子网进行自动的汇总,手工关闭,切记!!
[u2]直连的默认,如果R2收到报文没有明确的匹配就匹配此默认