OSPF多区域配置实验,本实验划分了3个区域,area0/area1/area2如下拓扑图 。
划分区域的好处就是把利用洪泛法交换链路状态信息的范围局限于每一个区域而不是整个的自治系统,这就减少了整个网络上的通信量。在一个区域内部的路由器只知道本区域的完整网络拓扑,而不需知道其他区域的网络拓扑的情况。
拓扑图如下:
拓扑图中配置IP的步骤省略,主要记录配置OSPF的命令
一、配置area0
area0区域有三个路由器R1/R2/R3
R1
R1#conf t
R1(config)#router ospf 1
R1(config-router)#network 40.0.0.0 0.255.255.255 area 0
R2
R2#conf t
R2(config)#router ospf 1
R2(config-router)#network 40.0.0.0 0.0.255.255 area 0
R3
R3#confi t
R3(config)#router ospf 1
R3(config-router)#network 40.0.0.0 0.0.255.255 area 0
二、配置area1
area1区域有三个路由器R2/R4/R5
R2
R2#conf t
R2(config)#router ospf 1
R2(config-router)#network 40.1.0.0 0.0.255.255 area 1
R4
R4#conf t
R4(config)#router ospf 1
R4(config-router)#network 40.1.0.0 0.0.255.255 area 1
R5
R5#conf t
R5(config)#router ospf 1
R5(config-router)#network 40.1.0.0 0.0.255.255 area 1
三、配置area2
area2区域有三个路由器R3/R6/R7
R3
R3#confi t
R3(config)#router ospf 1
R3(config-router)#network 40.2.0.0 0.0.255.255 area 2
R6
R6#conf t
R6(config)#router ospf 1
R6(config-router)#network 40.2.0.0 0.0.255.255 area 2
R7
R7#conf t
R7(config)#router ospf 1
R7(config-router)#network 40.2.0.0 0.0.255.255 area 2
四、配置完成查看路由
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
40.0.0.0/24 is subnetted, 10 subnets
O IA 40.2.2.0 [110/128] via 40.0.1.2, 00:05:52, Serial2/1
O IA 40.1.1.0 [110/128] via 40.0.0.2, 00:05:52, Serial2/0
C 40.0.0.0 is directly connected, Serial2/0
O IA 40.2.3.0 [110/129] via 40.0.1.2, 00:05:52, Serial2/1
C 40.0.1.0 is directly connected, Serial2/1
O IA 40.1.3.0 [110/129] via 40.0.0.2, 00:05:52, Serial2/0
O IA 40.2.1.0 [110/128] via 40.0.1.2, 00:05:52, Serial2/1
O IA 40.1.2.0 [110/128] via 40.0.0.2, 00:05:52, Serial2/0
O IA 40.1.4.0 [110/129] via 40.0.0.2, 00:05:54, Serial2/0
O IA 40.2.4.0 [110/129] via 40.0.1.2, 00:05:21, Serial2/1
五、在区域边界路由器上进行路由汇总
边界路由器R2/R3
R2
R2#confi t
R2(config)#router ospf 1
R2(config-router)#area 1 range 40.1.0.0 255.255.0.00
R3
R3#confi t
R3(config)#router ospf 1
R3(config-router)#area 2 range 40.2.0.0 255.255.0.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
40.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C 40.0.0.0/24 is directly connected, Serial2/0
O IA 40.1.0.0/16 [110/128] via 40.0.0.2, 00:26:56, Serial2/0
C 40.0.1.0/24 is directly connected, Serial2/1
O IA 40.2.0.0/16 [110/128] via 40.0.1.2, 00:26:17, Serial2/1
可以看出area1 路由汇总为40.1.0.0/16
area2 路由汇总为40.2.0.0/16