OSPF划分区域优点:
减小LSDB(lsa泛洪),同时保证到达目标网络的可达性
减小路由震荡
stub(末节网络)区域特点
1. 一个区域配置为stub时,所有相关路由器都需要配置该属性
2. 如果stub区域边界有多个ABR时,注意选路(修改cost)
3. 该区域不接受4、5类路由
4. 不能出现ASBR
5. 不能为区域0
6. 虚连接不能出现在该区域
7. ABR会自动下发一条缺省路由
实验拓扑
需求
1. A1配置为stub区域,查看到R5的路由情况(在R3的ospf进程中引入rip路由)
2. 查看各个区域都存在几类路由
3. R1、R2的loopback发布在0区,R3的loopback发布在2区,R5的loopback发布在rip中
完成ip网络基本配置,以及ospf邻居建立,查看邻居情况如下:
#R1
<R1>dis ospf peer brief
OSPF Process 1 with Router ID 1.1.1.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Serial0/0/1 2.2.2.2 Full
0.0.0.2 Serial0/0/0 3.3.3.3 Full
----------------------------------------------------------------------------
<R1>
#R2
<R2>dis ospf peer brief
OSPF Process 1 with Router ID 2.2.2.2
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 Serial0/0/0 1.1.1.1 Full
0.0.0.1 Serial0/0/1 4.4.4.4 Full
----------------------------------------------------------------------------
<R2>
#R3
<R3>dis ospf peer brief
OSPF Process 1 with Router ID 3.3.3.3
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.2 Serial0/0/0 1.1.1.1 Full
----------------------------------------------------------------------------
<R3>
#R4
<R4>dis ospf peer brief
OSPF Process 1 with Router ID 4.4.4.4
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.1 Serial0/0/1 2.2.2.2 Full
----------------------------------------------------------------------------
<R4>
ospf邻居建立正常
#查看R3是否学到R5的loopback
<R3>dis ip routing-table p rip
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
Destinations : 1 Routes : 1
RIP routing table status : <Active>
Destinations : 1 Routes : 1
Destination/Mask Proto Pre Cost Flags NextHop Interface
51.1.1.0/24 RIP 100 1 D 35.1.1.5 Serial0/0/1
RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
<R3>
R3已学到R5的loopback路由,直接到最左侧R4上查看路由情况
<R4>dis ospf lsdb
OSPF Process 1 with Router ID 4.4.4.4
Link State Database
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 4.4.4.4 4.4.4.4 701 60 80000004 1562
Router 2.2.2.2 2.2.2.2 702 48 80000003 1562
Sum-Net 21.1.1.1 2.2.2.2 712 28 80000002 0
Sum-Net 12.1.1.0 2.2.2.2 712 28 80000002 1562
Sum-Net 11.1.1.1 2.2.2.2 712 28 80000002 1562
Sum-Net 31.1.1.1 2.2.2.2 712 28 80000002 3124
Sum-Net 13.1.1.0 2.2.2.2 712 28 80000002 3124
Sum-Asbr 3.3.3.3 2.2.2.2 712 28 80000002 3124
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 51.1.1.0 3.3.3.3 698 36 80000002 1
External 35.1.1.0 3.3.3.3 700 36 80000002 1
<R4>
可以看到已经学到R5的外部路由,R4上存在1、3、4、5类lsa(lsa2存在于MA网络)
注意此处的External路由的cost,在R3的ospf上引入rip时需要注意type1、type2的区别
*type1,经过的路径会累加cost值,可以反映出路径的花销
*type2,经过的路径不会累加cost值
-----------------------华丽的分割线-----------------------
配置A1区域为stub区域
将R4的A1区域配置为stb后,此时邻居会中断(在hello中区域flag必须一致),将R2的A1区域也配置为stub后,此时邻居建立
[R4-ospf-1-area-0.0.0.1]stub
[R4-ospf-1-area-0.0.0.1]
Aug 28 2015 00:08:04-08:00 R4 %%01OSPF/3/NBR_CHG_DOWN(l)[0]:Neighbor event:neighbor state changed to Down. (ProcessId=1, NeighborAddress=2.2.2.2, NeighborEvent=KillNbr, NeighborPreviousState=Full, NeighborCurrentState=Down)
Aug 28 2015 00:08:04-08:00 R4 %%01OSPF/3/NBR_DOWN_REASON(l)[1]:Neighbor state leaves full or changed to Down. (ProcessId=1, NeighborRouterId=2.2.2.2, NeighborAreaId=1, NeighborInterface=Serial0/0/1,NeighborDownImmediate reason=Neighbor Down Due to Kill Neighbor, NeighborDownPrimeReason=Area reset, NeighborChangeTime=2015-08-28 00:08:04-08:00)
[R4-ospf-1-area-0.0.0.1]
Aug 28 2015 00:08:13-08:00 R4 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 19, the change loop count is 0, and the maximum number of records is 4095.
Aug 28 2015 00:08:15-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=24.1.1.2, NeighborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init)
Aug 28 2015 00:08:25-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=24.1.1.2, NeighborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=ExStart)
Aug 28 2015 00:08:25-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=24.1.1.2, NeighborEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchange)
Aug 28 2015 00:08:25-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=24.1.1.2, NeighborEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading)
Aug 28 2015 00:08:25-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes event: neighbor status changed. (ProcessId=1, NeighborAddress=24.1.1.2, NeighborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full)
[R4-ospf-1-area-0.0.0.1]
邻居建立后再次查看路由、lsa情况
[R4]dis ip routing-tabl p o
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 6 Routes : 6
OSPF routing table status : <Active>
Destinations : 6 Routes : 6
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 OSPF 10 1563 D 24.1.1.2 Serial0/0/1
11.1.1.1/32 OSPF 10 3124 D 24.1.1.2 Serial0/0/1
12.1.1.0/24 OSPF 10 3124 D 24.1.1.2 Serial0/0/1
13.1.1.0/24 OSPF 10 4686 D 24.1.1.2 Serial0/0/1
21.1.1.1/32 OSPF 10 1562 D 24.1.1.2 Serial0/0/1
31.1.1.1/32 OSPF 10 4686 D 24.1.1.2 Serial0/0/1
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
[R4]
已经不存在外部路由,同时会下发一条缺省路由
查看lsa
[R4]dis ospf lsdb
OSPF Process 1 with Router ID 4.4.4.4
Link State Database
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 4.4.4.4 4.4.4.4 231 60 80000003 1562
Router 2.2.2.2 2.2.2.2 232 48 80000003 1562
Sum-Net 0.0.0.0 2.2.2.2 242 28 80000001 1
Sum-Net 21.1.1.1 2.2.2.2 242 28 80000001 0
Sum-Net 12.1.1.0 2.2.2.2 242 28 80000001 1562
Sum-Net 11.1.1.1 2.2.2.2 242 28 80000001 1562
Sum-Net 31.1.1.1 2.2.2.2 242 28 80000001 3124
Sum-Net 13.1.1.0 2.2.2.2 242 28 80000001 3124
[R4]
此时只存在1、3类lsa
*既然已经存在了一条缺省的lsa3,那么到外部区域的其他lsa3就不需要存在了,此时可以将stub区域配置为totally stub区域
*当一个区域边界存在多个ABR时,注意修改cost值进行选路