Cisco允许对地址进行汇总,以通过限制区域间通告的路由来达到节省资源的目的。Cisco路由器支持两种类型的地址汇总:区域间汇总和外部路由汇总。区域间汇总用于在区域间汇总地址,而外部汇总用于收集到某个域中的一系列外部路由的汇总。
// R1 //
int e0/0
ip ad 192.1.1.1 255.255.255.252
router os 1
network 192.1.1.1 0.0.0.0 area 1
// R2 //
int e0/0
ip ad 192.1.1.2 255.255.255.252
int e1/0
ip ad 193.1.1.2 255.255.255.128
int lo0
ip ad 193.1.1.129 255.255.255.192
router os 1
network 192.1.1.2 0.0.0.0 area 1
network 193.1.1.2 0.0.0.0 area 0
network 193.1.1.129 0.0.0.0 area 0
// R3 //
int e1/0
ip ad 193.1.1.3 255.255.255.128
int e0/0
ip ad 194.1.1.1 255.255.255.252
int lo0
ip ad 193.1.1.193 255.255.255.192
router os 1
network 193.1.1.193 0.0.0.0 area 0
network 193.1.1.3 0.0.0.0 area 0
network 194.1.1.1 0.0.0.0 area 2
// R4 //
int e0/0
ip ad 194.1.1.2 255.255.255.252
int e1/0
ip ad 130.1.4.4 255.255.255.0
router os 1
network 194.1.1.2 0.0.0.0 area 2
router rip
network 130.1.0.0
// R5 //
int e1/0
ip ad 130.1.4.5 255.255.255.0
int lo1
ip ad 130.1.1.1 255.255.255.0
int lo2
ip ad 130.1.2.1 255.255.255.0
int lo3
ip ad 130.1.3.1 255.255.255.0
int lo5
ip ad 130.1.5.1 255.255.255.0
int lo6
ip ad 130.1.6.1 255.255.255.0
int lo7
ip ad 130.1.7.1 255.255.255.0
router rip
network 130.1.0.0
基本配置完成后,我们首选来验证一下。
r1#sh ip ro
130.1.0.0/24 is subnetted, 7 subnets
O E2 130.1.3.0 [110/10] via 192.1.1.2, 00:00:03, Ethernet0/0
O E2 130.1.2.0 [110/10] via 192.1.1.2, 00:00:03, Ethernet0/0
O E2 130.1.1.0 [110/10] via 192.1.1.2, 00:00:03, Ethernet0/0
O E2 130.1.7.0 [110/10] via 192.1.1.2, 00:00:03, Ethernet0/0
O E2 130.1.6.0 [110/10] via 192.1.1.2, 00:00:03, Ethernet0/0
O E2 130.1.5.0 [110/10] via 192.1.1.2, 00:00:03, Ethernet0/0
O E2 130.1.4.0 [110/10] via 192.1.1.2, 00:00:03, Ethernet0/0
193.1.1.0/24 is variably subnetted, 3 subnets, 2 masks
O IA 193.1.1.192/26 [110/21] via 192.1.1.2, 00:00:48, Ethernet0/0
O IA 193.1.1.128/26 [110/11] via 192.1.1.2, 00:00:48, Ethernet0/0
O IA 193.1.1.0/25 [110/20] via 192.1.1.2, 00:00:48, Ethernet0/0
192.1.1.0/30 is subnetted, 1 subnets
C 192.1.1.0 is directly connected, Ethernet0/0
194.1.1.0/30 is subnetted, 1 subnets
O IA 194.1.1.0 [110/30] via 192.1.1.2, 00:39:39, Ethernet0/0
在我们汇总完成后,上述结果里,红、蓝色显示部分将会被取代。方法如下:
区域间汇总:
// R2 //
router os 1
area 0 range 193.1.1.0 255.255.255.0
// R3 //
router os 1
area 0 range 193.1.1.0 255.255.255.0
外部路由汇总:
// R4 //
router os 1
summary-address 130.1.0.0 255.255.248.0
验证如下:
r1#sh ip ro
130.1.0.0/21 is subnetted, 1 subnets
O E2 130.1.0.0 [110/10] via 192.1.1.2, 00:00:02, Ethernet0/0
O IA 193.1.1.0/24 [110/11] via 192.1.1.2, 00:00:13, Ethernet0/0
192.1.1.0/30 is subnetted, 1 subnets
C 192.1.1.0 is directly connected, Ethernet0/0
194.1.1.0/30 is subnetted, 1 subnets
O IA 194.1.1.0 [110/30] via 192.1.1.2, 00:47:19, Ethernet0/0