驗證理論:
1.剖析OSPF的三張表:鄰居表,拓撲表,路由表
dis ospf peer brief
dis ospf lsdb
dis ip routing-table protocol ospf
2.查看OSPF路由器的角色
dis ospf abr-asbr
3.OSPFrouter id選舉機制
1.手動指定
2.選擇loopback接口(選擇較大IP,是否在OSPF進程中並不重要)
3.選擇物理接口(選擇較大IP,是否在OSPF進程中並不重要)
*123規則,先配置會優先生效
*router-id選舉機制不具有搶占性。修改router-id如果要生效的話需要重啟進程生效reset ospf process
*查看router-id命令:dis ospf peer brief
實驗拓撲:

初始配置:
*說明,為方便后面驗證router-id,AR123都是先在互聯接口上使能OSPF
[AR3]ip route-static 150.1.4.4 32 155.1.34.4
[AR3-ospf-1]import-route static
[AR4]ip route-static 0.0.0.0 0.0.0.0 155.1.34.3
初始結果:
[AR1]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 4 Routes : 4
OSPF routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
150.1.2.2/32 OSPF 10 1 D 155.1.12.2 GigabitEthernet0/0/0
150.1.3.3/32 OSPF 10 2 D 155.1.12.2 GigabitEthernet0/0/0
150.1.4.4/32 O_ASE 150 1 D 155.1.12.2 GigabitEthernet0/0/0
155.1.23.0/24 OSPF 10 2 D 155.1.12.2 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
一.
實驗目的:
剖析OSPF三張表項
1.鄰居表-dis ospf peer
[AR3]dis ospf peer brief
OSPF Process 1 with Router ID 155.1.23.3
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/1 155.1.12.2 Full
----------------------------------------------------------------------------
可查看信息:
1.該鄰居是在本地的哪個OSPF進程內:OSPF Process 1
2.本路由器的router-id:Router ID 155.1.23.3
3.接口及鄰居互聯接口所屬區域:Area Id
4.本路由器用來和鄰居建立關系的接口:Interface
5.鄰居的router-id: Neighbor id
6.本路由器與鄰居建立的關系當前的狀態:State
擴展:dis ospf peer
[AR3]dis ospf peer
OSPF Process 1 with Router ID 155.1.23.3
Neighbors
Area 0.0.0.0 interface 155.1.23.3(GigabitEthernet0/0/1)'s neighbors
Router ID: 155.1.12.2 Address: 155.1.23.2
State: Full Mode:Nbr is Slave Priority: 1
DR: 155.1.23.3 BDR: 155.1.23.2 MTU: 0
Dead timer due in 31 sec
Retrans timer interval: 5
Neighbor is up for 00:05:00
Authentication Sequence: [ 0 ]
可查看信息:
1.該鄰居是在本地的哪個OSPF進程內+本路由器的router-id:OSPF Process 1 with Router ID 155.1.23.3
2.接口及鄰居互聯接口所屬區域+本路由器用來和鄰居建立關系的接口地址和接口號:Area 0.0.0.0 interface 155.1.23.3(GigabitEthernet0/0/1)'s neighbors
3.鄰居router id+鄰居與本路由器互聯接口的IP地址:Router ID: 155.1.12.2 Address: 155.1.23.2
4.本路由器與鄰居建立的關系當前的狀態+主從選舉結果
5.鄰居狀態(可能為down,attempt,init,two-way,exstart,exchange,loading,full)+鄰居在進行DD報文選舉過程中的主從狀態,鄰居的優先級:State: Full Mode:Nbr is Slave Priority: 1
6.指定路由器地址,備份路由器地址,鄰居接口MTU的值:DR: 155.1.23.3 BDR: 155.1.23.2 MTU: 0
7.dead計時器在31s后到時:Dead timer due in 31 sec
8.重傳LSA的時間間隔,單位為秒:Retrans timer interval: 5
9.距離鄰居建立的時間:Neighbor is up for 00:05:00
10.認證序列號:Authentication Sequence: [ 0 ]
2.拓撲表
dis ospf lsdb
[AR1]dis ospf lsdb
OSPF Process 1 with Router ID 155.1.12.1
Link State Database
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 155.1.12.2 155.1.12.2 982 48 80000005 1
Router 155.1.12.1 155.1.12.1 981 48 80000004 1
Network 155.1.12.2 155.1.12.2 982 32 80000001 0
Sum-Net 150.1.3.3 155.1.12.2 968 28 80000001 1
Sum-Net 155.1.23.0 155.1.12.2 1006 28 80000001 1
Sum-Asbr 155.1.34.3 155.1.12.2 68 28 80000001 1
AS External Database
Type LinkState ID AdvRouter Age Len Sequence Metric
External 150.1.4.4 155.1.34.3 1004 36 80000001 1
可查看信息:
1.該鄰居是在本地的哪個OSPF進程內+本路由器的router-id:OSPF Process 1 with Router ID 155.1.12.1
2.顯示LSDB信息的區域:Area: 0.0.0.1
3.LSA類型(Router/Network/Sum-Net/Sum-Asbr/NSSA/External/Opq-Link/Opq-Area/Opq-As):type
4.LSA報頭中的鏈路狀態ID:LinkState ID
5.發布或產生LSA的設備:AdvRouter
6.Lsa老化時間,Lsa大小,Lsa序列號:age ,length,sequence
7.度量值:Metric
3.路由表
dis ip routing-table protocol ospf
[AR1]dis ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : OSPF
Destinations : 4 Routes : 4
OSPF routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
150.1.2.2/32 OSPF 10 1 D 155.1.12.2 GigabitEthernet0/0/0
150.1.3.3/32 OSPF 10 2 D 155.1.12.2 GigabitEthernet0/0/0
150.1.4.4/32 O_ASE 150 1 D 155.1.12.2 GigabitEthernet0/0/0
155.1.23.0/24 OSPF 10 2 D 155.1.12.2 GigabitEthernet0/0/0
OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
可查看信息:
proto為協議,ospf代表OSPF自己學到的,O-ASE代表外部引入的
二.
實驗目的:
查看路由器角色
實驗步驟:
dis ospf abr-asbr
[AR1]dis ospf abr-asbr
OSPF Process 1 with Router ID 155.1.12.1
Routing Table to ABR and ASBR
RtType Destination Area Cost Nexthop Type
Intra-area 155.1.12.2 0.0.0.1 1 155.1.12.2 ABR
Inter-area 155.1.34.3 0.0.0.1 2 155.1.12.2 ASBR
可查看信息:
1.表示區域內路由器或者是區域間路由器:RtType
2.顯示ABR或者ASBR的router-id: Destination
3.本地區域號: Area
4.從設備到達ABR或ASBR的開銷: Cost
5.發送報文到ABR或ASBR的下一跳IP地址:Nexthop
6.區域邊界路由器(ABR)或自治系統邊界路由器(ASBR):Type
三.
實驗目的:
驗證OSPF router-id選舉機制
1.手動指定
2.選擇loopback接口(選擇較大IP,是否在OSPF進程中並不重要)
3.選擇物理接口(選擇較大IP,是否在OSPF進程中並不重要)
*123規則,先配置會優先生效
*router-id選舉機制不具有搶占性。修改router-id如果要生效的話需要重啟進程生效reset ospf process
*查看router-id命令:dis ospf peer brief
實驗步驟:
第一步:因為是先在互聯口上enable的ospf,所以現在OSPF的router id 都是互聯口了
所以,先配先成為router-id
第二步:AR1重啟OSPF進程
<AR1>reset ospf process
[AR1]dis ospf peer brief
OSPF Process 1 with Router ID 155.1.12.1
Peer Statistic Information
----------------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.1 GigabitEthernet0/0/0 155.1.12.2 Full
----------------------------------------------------------------------------
仍然是互聯口router-id。保存配置后重啟路由器,仍然是互聯口router-id,動態選舉未驗證成功
此時手動指定router-id並重置路由進程
[AR3]ospf router-id 150.1.3.3
[AR3]dis ospf peer brief
OSPF Process 1 with Router ID 150.1.3.3
所以,手動指定優於動態選舉
將lo 0口移出OSPF,查看OSPF的router id是否發生變化
[AR3-LoopBack0]undo ospf en a 0
[AR3]dis ospf peer brief
OSPF Process 1 with Router ID 150.1.3.3
所以,ospf的router id與接口是否在進程中並沒有關系
將Lo 0 口地址刪除並重啟OSPF進程,查看OSPF的router id是否發生變化
[AR3-LoopBack0]undo ip add
[AR3]dis ospf peer brief
OSPF Process 1 with Router ID 150.1.3.3
所以,OSPF手動指定rouer id ,這個只是作為路由器標識,只要不重復,即使不存在於這個路由器上都沒關系
