实验的目的:
RIPV2是RIP的升级版,它与RIP的主要区别有:RIP发送数据包的路径是广播,而RIPV2即是组播;RIPV2支持变长扩展子网掩码,即VLSM,还支持手动汇总.本次实验将介绍RIPV2是如何支持VLSM及自动汇总与手动汇总的区别.
实验拓扑图:
实验内容:
一、路由器上的配置
R1上的配置
Router>en
Router#conf t
粘贴上常用的路由基本命令
Router(config)#enable password cisco
Router(config)#no ip domain-lookup
Router(config)#line con 0
Router(config-line)# exec-timeout 0 0
Router(config-line)# logging synchronous
Router(config-line)#
Router(config-line)#line aux 0
Router(config-line)# exec-timeout 0 0
Router(config-line)# logging synchronous
Router(config-line)#line vty 0 4
Router(config-line)#
Router(config-line)#
Router(config-line)# exec-timeout 0 0
Router(config-line)# password cisco
Router(config-line)#
Router(config-line)# login
Router(config-line)#
Router(config-line)#
Router(config-line)#alias exec a sh ip int bri
Router(config)#alias exec b sh ip route
Router(config)#alias exec c sh ip route rip
Router(config)#alias exec d sh run
设置名称,建立几条虚链路来连接到R2,等下用来验证汇总信息
Router(config)#hostname R1
R1(config)#interface loopback 1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 2
R1(config-if)#ip address 10.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 3
R1(config-if)#ip address 10.1.2.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 4
R1(config-if)#ip address 10.1.3.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 5
R1(config-if)#ip address 10.1.4.1 255.255.255.0
R1(config-if)#exit
R1(config)#interface loopback 6
R1(config-if)#ip address 10.1.5.1 255.255.255.0
R1(config)#interface e0/0
R1(config-if)#ip address 172.16.10.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface s1/0
R1(config-if)#ip address 172.16.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R1(config-if)#exit
R上的配置
Router(config)#hostname R2
R2(config)#interface s1/0
R2(config-if)#ip address 172.16.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface s1/1
R2(config-if)#ip address 172.16.3.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#exit
R3上的配置
outer(config)#hostname R3
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#exit
R3(config)#interface e0/0
R3(config-if)#ip address 172.16.10.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface s1/1
R3(config-if)#ip address 172.16.3.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
二、好了,到这里可以开始配置RIP了,注意要升级到V2版本,再给每个路由器配置RIP
R1上的配置
R1(config)#router rip
R1(config-router)#version 2
注意在这里与RIP的不同,要加上一个Version 2
R1(config-router)#network 1.0.0.0
R1(config-router)#network 10.0.0.0
R1(config-router)#network 172.16.2.0
R1(config-router)#network 172.16.10.0
R2上的配置
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 172.16.2.0
R2(config-router)#network 172.16.3.0
R3上的配置
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 3.0.0.0
R3(config-router)#network 172.16.3.0
R3(config-router)#network 172.16.10.0
三、查看路由表
R1的路由表
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
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 172.16.10.2, 00:00:04, Ethernet0/0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
C 172.16.2.0 is directly connected, Serial1/0
R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:25, Serial1/0
[120/1] via 172.16.10.2, 00:00:04, Ethernet0/0
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
R2上的路由表
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
R 1.0.0.0/8 [120/1] via 172.16.2.1, 00:00:10, Serial1/0
R 3.0.0.0/8 [120/1] via 172.16.3.2, 00:00:13, Serial1/1
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:10, Serial1/0
[120/1] via 172.16.3.2, 00:00:13, Serial1/1
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Serial1/1
R 10.0.0.0/8 [120/1] via 172.16.2.1, 00:00:10, Serial1/0
R3上的路由表
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
R 1.0.0.0/8 [120/1] via 172.16.10.1, 00:00:05, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
R 172.16.2.0 [120/1] via 172.16.10.1, 00:00:05, Ethernet0/0
[120/1] via 172.16.3.1, 00:00:03, Serial1/1
C 172.16.3.0 is directly connected, Serial1/1
R 10.0.0.0/8 [120/1] via 172.16.10.1, 00:00:05, Ethernet0/0
R3#
由于RIPV2默认启动路由汇总的,在R2的路由表上可以看到它已经汇总了路由表.
四、在R1上去掉自动路由汇总,然后再查看下路由表
去掉路由自动汇总的命令是:no auto-summary
R1(config)#router rip
R1(config-router)#no auto-summary
查看下R1上的路由表
R1#show ip route
*Mar 1 01:00:00.451: %SYS-5-CONFIG_I: Configured from console by console
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
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 172.16.10.2, 00:00:03, Ethernet0/0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
C 172.16.2.0 is directly connected, Serial1/0
R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:22, Serial1/0
[120/1] via 172.16.10.2, 00:00:03, Ethernet0/0
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
R2上的路由表
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
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
R 1.0.0.0/8 [120/1] via 172.16.2.1, 00:00:28, Serial1/0
R 3.0.0.0/8 [120/1] via 172.16.3.2, 00:00:21, Serial1/1
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
[120/1] via 172.16.3.2, 00:00:21, Serial1/1
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
R 10.1.3.0/24 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
R 10.1.2.0/24 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
R 10.1.1.0/24 [120/1] via 172.16.2.1, 00:00:02, Serial1/0
R 10.0.0.0/8 [120/1] via 172.16.2.1, 00:00:32, Serial1/0
R 10.1.5.0/24 [120/1] via 172.16.2.1, 00:00:06, Serial1/0
R 10.1.4.0/24 [120/1] via 172.16.2.1, 00:00:06, Serial1/0
R3上的路由表
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
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 1.0.0.0/8 [120/1] via 172.16.10.1, 00:00:43, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
R 172.16.2.0 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
[120/1] via 172.16.3.1, 00:00:10, Serial1/1
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
R 10.1.3.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 10.1.2.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 10.1.1.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 10.0.0.0/8 [120/1] via 172.16.10.1, 00:00:43, Ethernet0/0
R 10.1.5.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
R 10.1.4.0/24 [120/1] via 172.16.10.1, 00:00:14, Ethernet0/0
注意观察R2上的路由表的变化,当我们去掉R1上的路由自动汇总后,R1传给R2的路由已经不再是汇总的了.
现在让我们在R1上设置手动汇总,观察手动汇总的结果.
手动汇总的命令是:ip summary-address rip
R1(config)#int s1/0
R1(config-if)#ip summary-address rip 10.1.0.0 255.255.0.0
观察路由表
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
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback1
R 1.0.0.0/8 [120/2] via 172.16.10.2, 00:00:15, Ethernet0/0
[120/2] via 172.16.2.2, 00:00:08, Serial1/0
R 3.0.0.0/8 [120/1] via 172.16.10.2, 00:00:15, Ethernet0/0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
C 172.16.2.0 is directly connected, Serial1/0
R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:08, Serial1/0
[120/1] via 172.16.10.2, 00:00:15, Ethernet0/0
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C 10.1.3.0/24 is directly connected, Loopback4
C 10.1.2.0/24 is directly connected, Loopback3
C 10.1.1.0/24 is directly connected, Loopback2
R 10.0.0.0/8 [120/2] via 172.16.10.2, 00:00:15, Ethernet0/0
[120/2] via 172.16.2.2, 00:00:08, Serial1/0
C 10.1.5.0/24 is directly connected, Loopback6
C 10.1.4.0/24 is directly connected, Loopback5
R2上的路由表
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
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.2.1, 00:00:21, Serial1/0
R 1.0.0.0/8 [120/2] via 172.16.3.2, 00:00:08, Serial1/1
R 3.0.0.0/8 [120/1] via 172.16.3.2, 00:00:08, Serial1/1
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:21, Serial1/0
[120/1] via 172.16.3.2, 00:00:08, Serial1/1
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 7 subnets, 3 masks
R 10.1.3.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
R 10.1.2.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
R 10.1.1.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
R 10.0.0.0/8 [120/2] via 172.16.3.2, 00:00:08, Serial1/1
R 10.1.0.0/16 [120/1] via 172.16.2.1, 00:00:21, Serial1/0
R 10.1.5.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
R 10.1.4.0/24 is possibly down,
routing via 172.16.2.1, Serial1/0
再次观察R2上的路由表与手动汇总之前的不同,可以看到手动汇总已经起了作用.可能这里是用模拟器做的实验,手动汇总的结果显示得比较慢吧.实验上多多少少已经在上起到作用的了.再等几分钟再看下路由表,果然如此,呵呵
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
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.2.1, 00:00:19, Serial1/0
R 1.0.0.0/8 [120/2] via 172.16.3.2, 00:00:06, Serial1/1
R 3.0.0.0/8 [120/1] via 172.16.3.2, 00:00:06, Serial1/1
172.16.0.0/24 is subnetted, 3 subnets
R 172.16.10.0 [120/1] via 172.16.2.1, 00:00:19, Serial1/0
[120/1] via 172.16.3.2, 00:00:06, Serial1/1
C 172.16.2.0 is directly connected, Serial1/0
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 10.0.0.0/8 [120/2] via 172.16.3.2, 00:00:06, Serial1/1
R 10.1.0.0/16 [120/1] via 172.16.2.1, 00:00:19, Serial1/0
最后看下R3的路由表
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
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 1.1.1.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 1.0.0.0/8 [120/2] via 172.16.3.1, 00:00:02, Serial1/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.10.0 is directly connected, Ethernet0/0
R 172.16.2.0 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
[120/1] via 172.16.3.1, 00:00:02, Serial1/1
C 172.16.3.0 is directly connected, Serial1/1
10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
R 10.1.3.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 10.1.2.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 10.1.1.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 10.0.0.0/8 [120/2] via 172.16.3.1, 00:00:02, Serial1/1
R 10.1.5.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
R 10.1.4.0/24 [120/1] via 172.16.10.1, 00:00:12, Ethernet0/0
五、实验总结
通过试验RIPV2的属性,可以看到VLSM的特征.同时,使用关闭自动汇总属性也看到了RIPV2的特点.
本文转自 独钩寒江雪 51CTO博客,原文链接:http://blog.51cto.com/bennie/101519,如需转载请自行联系原作者