实验目的:
RIPV2是RIP的第二代协议,它与RIP的主要区别在于一个是RIP发包走的是广播,RIPv2发包走的是组播,另外一个就是 RIPv2支持变长VLSM可扩展的子网掩码,支持手动
汇总,通过实验观察RIPv2如何支持VLSM以及自动
汇总与手动汇总的区别。
实验拓扑:
实验内容:
1.路由器的基本配置
R1上的基本配置
interface Loopback1
ip address 1.1.1.1 255.255.255.0
!
(为了测试RIPV2的汇总我们在这里起用了5个环回接口)
interface Loopback2
ip address 10.1.1.1 255.255.255.0
!
interface Loopback3
ip address 10.1.2.1 255.255.255.0
!
interface Loopback4
ip address 10.1.3.1 255.255.255.0
!
interface Loopback5
ip address 10.1.4.1 255.255.255.0
!
interface Loopback6
ip address 10.1.5.1 255.255.255.0
!
interface Ethernet0
ip address 192.168.10.1 255.255.255.0
interface Serial0
ip address 192.168.2.1 255.255.255.0
clockrate 64000
R2上的基本配置
interface Serial0
ip address 192.168.3.1 255.255.255.0
clockrate 64000
!
interface Serial1
ip address 192.168.2.2 255.255.255.0
R3上的基本配置
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!
interface Ethernet0
ip address 192.168.10.2 255.255.255.0
!
interface Serial0
no ip address
shutdown
!
interface Serial1
ip address 192.168.3.2 255.255.255.0
2.配置RIP,并提升为v2版本,为各个路由器起RIP
将RIP提升为V2版本的命令如下:
router(config )#router rip
router(config-route)#version 2
R1上的RIP配置
router rip
version 2(注:比较与RIPV1的不同,此处多了一个version 2)
network 1.0.0.0
network 10.0.0.0
network 192.168.2.0
network 192.168.10.0
R2上的RIP配置
router rip
version 2
network 192.168.2.0
network 192.168.3.0
R3上的RIP配置
router rip
version 2
network 3.0.0.0
network 192.168.3.0
network 192.168.10.0
3.查看此时的路由表
R1上的路由表
R1#show 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, 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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback1
R 3.0.0.0/8 [120/1] via 192.168.10.2, 00:00:02, Ethernet0
C 192.168.10.0/24 is directly connected, Ethernet0
10.0.0.0/24 is subnetted, 5 subnets
C 10.1.3.0 is directly connected, Loopback4
C 10.1.2.0 is directly connected, Loopback3
C 10.1.1.0 is directly connected, Loopback2
C 10.1.5.0 is directly connected, Loopback6
C 10.1.4.0 is directly connected, Loopback5
C 192.168.2.0/24 is directly connected, Serial0
R 192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:11, Serial0
R2上的路由表
R2#show 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, 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 1.0.0.0/8 [120/1] via 192.168.2.1, 00:00:02, Serial1
R 3.0.0.0/8 [120/1] via 192.168.3.2, 00:00:29, Serial0
R 192.168.10.0/24 [120/1] via 192.168.2.1, 00:00:02, Serial1
R 10.0.0.0/8 [120/1] via 192.168.2.1, 00:00:02, Serial1
C 192.168.2.0/24 is directly connected, Serial1
C 192.168.3.0/24 is directly connected, Serial0
R3上的路由表
R3#show 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, 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 1.0.0.0/8 [120/1] via 192.168.10.1, 00:00:04, Ethernet0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.168.10.0/24 is directly connected, Ethernet0
R 10.0.0.0/8 [120/1] via 192.168.10.1, 00:00:04, Ethernet0
R 192.168.2.0/24 [120/1] via 192.168.3.1, 00:00:13, Serial1
C 192.168.3.0/24 is directly connected, Serial1
因为RIPV2汇总默认是启动的,所以我们在这里看到,在R2上还是汇总以后的路由表。
4.R1上去掉自动路由汇总,然后观察路由表
去掉路由自动汇总的命令:
router(config)#router rip
router(config-route)#no auto-summary
此时再看路由表
R1上的路由表
R1#show 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, 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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback1
R 3.0.0.0/8 [120/1] via 192.168.10.2, 00:00:02, Ethernet0
C 192.168.10.0/24 is directly connected, Ethernet0
10.0.0.0/24 is subnetted, 5 subnets
C 10.1.3.0 is directly connected, Loopback4
C 10.1.2.0 is directly connected, Loopback3
C 10.1.1.0 is directly connected, Loopback2
C 10.1.5.0 is directly connected, Loopback6
C 10.1.4.0 is directly connected, Loopback5
C 192.168.2.0/24 is directly connected, Serial0
R 192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:11, Serial0
R2上的路由表
R2#show 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, 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
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 192.168.2.1, 00:00:01, Serial1
R 1.0.0.0/8 [120/2] via 192.168.3.2, 00:00:01, Serial0
R 3.0.0.0/8 [120/1] via 192.168.3.2, 00:00:01, Serial0
R 192.168.10.0/24 [120/1] via 192.168.3.2, 00:00:01, Serial0
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
R 10.1.3.0/24 [120/1] via 192.168.2.1, 00:00:01, Serial1
R 10.1.2.0/24 [120/1] via 192.168.2.1, 00:00:02, Serial1
R 10.1.1.0/24 [120/1] via 192.168.2.1, 00:00:02, Serial1
R 10.0.0.0/8 [120/2] via 192.168.3.2, 00:00:02, Serial0
R 10.1.5.0/24 [120/1] via 192.168.2.1, 00:00:02, Serial1
R 10.1.4.0/24 [120/1] via 192.168.2.1, 00:00:02, Serial1
C 192.168.2.0/24 is directly connected, Serial1
C 192.168.3.0/24 is directly connected, Serial0
R3上的路由表
R3#show 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, 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 1.0.0.0/8 [120/1] via 192.168.10.1, 00:00:04, Ethernet0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.168.10.0/24 is directly connected, Ethernet0
R 10.0.0.0/8 [120/1] via 192.168.10.1, 00:00:04, Ethernet0
R 192.168.2.0/24 [120/1] via 192.168.3.1, 00:00:13, Serial1
C 192.168.3.0/24 is directly connected, Serial1
观察R2上的路由表变化,当我们去掉R1上的自动汇总以后,R1传给R2的路由将不再是汇总的。
R1上设置手动汇总,观察手动汇总的结果
手动汇总的命令:
R1(config-if)#int s0
R1(config-if)#ip summary-address rip 10.1.0.0 255.255.0.0
观察路由表
R1#show 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, 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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback1
R 3.0.0.0/8 [120/1] via 192.168.10.2, 00:00:02, Ethernet0
C 192.168.10.0/24 is directly connected, Ethernet0
10.0.0.0/24 is subnetted, 5 subnets
C 10.1.3.0 is directly connected, Loopback4
C 10.1.2.0 is directly connected, Loopback3
C 10.1.1.0 is directly connected, Loopback2
C 10.1.5.0 is directly connected, Loopback6
C 10.1.4.0 is directly connected, Loopback5
C 192.168.2.0/24 is directly connected, Serial0
R 192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:11, Serial0
R2上的路由表
R2#show 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, 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
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.0.0.0/8 [120/2] via 192.168.3.2, 00:00:01, Serial0
R 1.1.1.0/24 [120/1] via 192.168.2.1, 00:00:01, Serial1
R 3.0.0.0/8 [120/1] via 192.168.3.2, 00:00:01, Serial0
R 192.168.10.0/24 [120/1] via 192.168.2.1, 00:00:01, Serial1
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 10.0.0.0/8 [120/2] via 192.168.3.2, 00:00:01, Serial0
R 10.1.0.0/16 [120/1] via 192.168.2.1, 00:00:02, Serial1
C 192.168.2.0/24 is directly connected, Serial1
C 192.168.3.0/24 is directly connected, Serial0
再次观察R2上的路由表与手动汇总之前的不同,显然手动汇总已经起了作用。
R3上的路由表
R3#show 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, 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 1.0.0.0/8 [120/1] via 192.168.10.1, 00:00:04, Ethernet0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.168.10.0/24 is directly connected, Ethernet0
R 10.0.0.0/8 [120/1] via 192.168.10.1, 00:00:04, Ethernet0
R 192.168.2.0/24 [120/1] via 192.168.3.1, 00:00:13, Serial1
C 192.168.3.0/24 is directly connected, Serial1
实验总结:
我们通过RIPv2的属性,来看到VLSM的特征,我们使用关闭自动汇总的属性来看到RIPv2的特点,这个实验希望大家能够掌握。