一:基本配置
r1(config)#router ospf 1
r1(config-router)#net 1.1.0.0 0.0.255.255 area 1
r1(config-router)#net 12.1.1.1 0.0.0.0 area 0
r1(config-router)#redistribute connected subnets
r2(config)#router ospf 1
r2(config-router)#net 12.1.1.2 0.0.0.0 area 0
r2(config-router)#net 2.2.2.2 0.0.0.0 area 0
r2(config-router)#net 23.1.1.1 0.0.0.0 area 2
r3(config)#router ospf 1
r3(config-router)#net 0.0.0.0 255.255.255.255 area 2
r2#show ip ro os
1.0.0.0/32 is subnetted, 2 subnets
O IA 1.1.1.1 [110/65] via 12.1.1.1, 00:00:32, Serial1/0
O IA 1.1.2.1 [110/65] via 12.1.1.1, 00:00:32, Serial1/0
3.0.0.0/32 is subnetted, 2 subnets
O 3.1.2.1 [110/65] via 23.1.1.2, 00:00:32, Serial1/1
O 3.1.1.1 [110/65] via 23.1.1.2, 00:00:32, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
O E2 10.1.1.0 [110/20] via 12.1.1.1, 00:00:32, Serial1/0
30.0.0.0/32 is subnetted, 1 subnets
O 30.1.1.1 [110/65] via 23.1.1.2, 00:00:32, Serial1/1
二,分别修改区域内、区域间、外部路由的管理距离
r2(config)#router ospf 1
r2(config-router)#distance ospf external 177 inter-area 166 intra-area 155
r2#show ip ro os
1.0.0.0/32 is subnetted, 2 subnets
O IA 1.1.1.1 [166/65] via 12.1.1.1, 00:01:08, Serial1/0
O IA 1.1.2.1 [166/65] via 12.1.1.1, 00:01:08, Serial1/0
3.0.0.0/32 is subnetted, 2 subnets
O 3.1.2.1 [155/65] via 23.1.1.2, 00:01:08, Serial1/1
O 3.1.1.1 [155/65] via 23.1.1.2, 00:01:08, Serial1/1
10.0.0.0/24 is subnetted, 1 subnets
O E2 10.1.1.0 [177/20] via 12.1.1.1, 00:01:08, Serial1/0
30.0.0.0/32 is subnetted, 1 subnets
O 30.1.1.1 [155/65] via 23.1.1.2, 00:01:08, Serial1/1
本文出自 “思科技术交流” 博客,转载请与作者联系!