SPF计算方式:
1.基础设置
[R1]ospf 1 r 10.1.1.1
[R1-ospf-1]a 0
[R1-ospf-1-area-0.0.0.0]int g0/0/0
[R1-GigabitEthernet0/0/0]ip ad 10.1.124.1 24
[R1-GigabitEthernet0/0/0]ospf en a 0
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip ad 10.1.13.1 24
[R1-GigabitEthernet0/0/1]ospf en a 0
[R1-GigabitEthernet0/0/1]int g0/0/2
[R1-GigabitEthernet0/0/2]ip ad 10.1.12.1 24
[R1-GigabitEthernet0/0/2]os en a 0
[R1-GigabitEthernet0/0/2]int lo 0
[R1-LoopBack0]ip ad 1.1.1.1 32
[R1-LoopBack0]os en a 0
[R2]ospf 1 r 10.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]int g0/0/0
[R2-GigabitEthernet0/0/0]ip ad 10.1.124.2 24
[R2-GigabitEthernet0/0/0]os en a 0
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip ad 10.1.23.2 24
[R2-GigabitEthernet0/0/1]os en a 0
[R2-GigabitEthernet0/0/1]int g0/0/2
[R2-GigabitEthernet0/0/2]ip ad 10.1.12.2 24
[R2-GigabitEthernet0/0/2]os en a 0
[R2-GigabitEthernet0/0/2]int s1/0/0
[R2-Serial1/0/0]ip ad 10.1.25.2 24
[R2-Serial1/0/0]os en a 0
[R2-Serial1/0/0]int lo 0
[R2-LoopBack0]ip ad 2.2.2.2 32
[R2-LoopBack0]os en a 0
[R3]ospf 1 r 10.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]int g0/0/0
[R3-GigabitEthernet0/0/0]ip ad 10.1.23.3 24
[R3-GigabitEthernet0/0/0]os en a 0
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip ad 10.1.13.3 24
[R3-GigabitEthernet0/0/1]os en a 0
[R3-GigabitEthernet0/0/1]int g0/0/2
[R3-GigabitEthernet0/0/2]ip ad 10.1.35.3 24
[R3-GigabitEthernet0/0/2]os en a 0
[R3-GigabitEthernet0/0/2]int lo 0
[R3-LoopBack0]ip ad 3.3.3.3 32
[R3-LoopBack0]os en a 0
[R4]ospf 1 r 10.4.4.4
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]int g0/0/0
[R4-GigabitEthernet0/0/0]ip ad 10.1.124.4 24
[R4-GigabitEthernet0/0/0]os en a 0
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip ad 10.1.45.4 24
[R4-GigabitEthernet0/0/1]os en a 0
[R4-GigabitEthernet0/0/1]int lo 0
[R4-LoopBack0]ip ad 4.4.4.4 32
[R4-LoopBack0]os en a 0
[R5]ospf 1 r 10.5.5.5
[R5-ospf-1]a 0
[R5-ospf-1-area-0.0.0.0]int g0/0/0
[R5-GigabitEthernet0/0/0]ip ad 10.1.35.5 24
[R5-GigabitEthernet0/0/0]os en a 0
[R5-GigabitEthernet0/0/0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip ad 10.1.45.5 24
[R5-GigabitEthernet0/0/1]os en a 0
[R5-GigabitEthernet0/0/1]int g0/0/0
[R5-GigabitEthernet0/0/1]int s1/0/0
[R5-Serial1/0/0]ip ad 10.1.25.5 24
[R5-Serial1/0/0]os en a 0
[R5-Serial1/0/0]int lo 0
[R5-LoopBack0]ip ad 5.5.5.5 32
[R5-LoopBack0]os en a 0
设备存在环回口地址,通过1类LSA的subnet链路状态来描述
2.LSA计算
1.R1连接的伪节点:10.1.124.1,10.1.13.1,10.1.12.1
[R1]dis ospf lsdb
OSPF Process 1 with Router ID 10.1.1.1
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 10.3.3.3 10.3.3.3 498 72 8000000C 1
Router 10.5.5.5 10.5.5.5 452 84 80000009 1
Router 10.2.2.2 10.2.2.2 518 96 80000013 1
Router 10.4.4.4 10.4.4.4 469 60 8000000A 1
Router 10.1.1.1 10.1.1.1 859 72 80000012 1
Network 10.1.23.2 10.2.2.2 1455 32 80000002 0
Network 10.1.124.1 10.1.1.1 1238 36 80000004 0
Network 10.1.13.1 10.1.1.1 1415 32 80000002 0
Network 10.1.35.3 10.3.3.3 1016 32 80000002 0
Network 10.1.12.1 10.1.1.1 1612 32 80000002 0
Network 10.1.45.4 10.4.4.4 1024 32 80000002 0
[R1]dis ospf lsdb router 10.1.1.1
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Router
Ls id : 10.1.1.1
Adv rtr : 10.1.1.1
Ls age : 894
Len : 72
Options : E
seq# : 80000012
chksum : 0x6818
Link count: 4
* Link ID: 10.1.124.1
Data : 10.1.124.1
Link Type: TransNet
Metric : 1
* Link ID: 10.1.13.1
Data : 10.1.13.1
Link Type: TransNet
Metric : 1
* Link ID: 10.1.12.1
Data : 10.1.12.1
Link Type: TransNet
Metric : 1
* Link ID: 1.1.1.1
Data : 255.255.255.255
Link Type: StubNet
Metric : 0
Priority : Medium
根据以上信息画图:
2.根据伪节点画出连接的路由信息
[R1]dis ospf lsdb network 10.1.13.1
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Network
Ls id : 10.1.13.1
Adv rtr : 10.1.1.1
Ls age : 1262
Len : 32
Options : E
seq# : 8000000c
chksum : 0x19ef
Net mask : 255.255.255.0
Priority : Low
Attached Router 10.1.1.1
Attached Router 10.3.3.3
[R1]dis ospf lsdb network 10.1.124.1
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Network
Ls id : 10.1.124.1
Adv rtr : 10.1.1.1
Ls age : 1109
Len : 36
Options : E
seq# : 8000000e
chksum : 0x8ff0
Net mask : 255.255.255.0
Priority : Low
Attached Router 10.1.1.1
Attached Router 10.2.2.2
Attached Router 10.4.4.4
[R1]dis ospf lsdb network 10.1.12.1
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Network
Ls id : 10.1.12.1
Adv rtr : 10.1.1.1
Ls age : 1494
Len : 32
Options : E
seq# : 8000000c
chksum : 0xfc10
Net mask : 255.255.255.0
Priority : Low
Attached Router 10.1.1.1
Attached Router 10.2.2.2
3.根据连接的路由信息继续查找
[R1]dis ospf lsdb router 10.3.3.3
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Router
Ls id : 10.3.3.3
Adv rtr : 10.3.3.3
Ls age : 650
Len : 72
Options : E
seq# : 80000016
chksum : 0xdd1e
Link count: 4
* Link ID: 10.1.23.2
Data : 10.1.23.3
Link Type: TransNet
Metric : 1
* Link ID: 10.1.13.1
Data : 10.1.13.3
Link Type: TransNet
Metric : 1
* Link ID: 10.1.35.3
Data : 10.1.35.3
Link Type: TransNet
Metric : 1
* Link ID: 3.3.3.3
Data : 255.255.255.255
Link Type: StubNet
Metric : 0
Priority : Medium
[R1]dis ospf lsdb router 10.2.2.2
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Router
Ls id : 10.2.2.2
Adv rtr : 10.2.2.2
Ls age : 923
Len : 96
Options : E
seq# : 8000001d
chksum : 0x541d
Link count: 6
* Link ID: 10.1.23.2
Data : 10.1.23.2
Link Type: TransNet
Metric : 1
* Link ID: 10.1.12.1
Data : 10.1.12.2
Link Type: TransNet
Metric : 1
* Link ID: 10.1.124.1
Data : 10.1.124.2
Link Type: TransNet
Metric : 1
* Link ID: 10.5.5.5
Data : 10.1.25.2
Link Type: P-2-P
Metric : 48
* Link ID: 10.1.25.0
Data : 255.255.255.0
Link Type: StubNet
Metric : 48
Priority : Low
* Link ID: 2.2.2.2
Data : 255.255.255.255
Link Type: StubNet
Metric : 0
Priority : Medium
[R1]dis ospf lsdb router 10.4.4.4
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Router
Ls id : 10.4.4.4
Adv rtr : 10.4.4.4
Ls age : 879
Len : 60
Options : E
seq# : 80000014
chksum : 0x70e6
Link count: 3
* Link ID: 10.1.124.1
Data : 10.1.124.4
Link Type: TransNet
Metric : 1
* Link ID: 10.1.45.4
Data : 10.1.45.4
Link Type: TransNet
Metric : 1
* Link ID: 4.4.4.4
Data : 255.255.255.255
Link Type: StubNet
Metric : 0
Priority : Medium
[R1]dis ospf lsdb network 10.1.35.3
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Network
Ls id : 10.1.35.3
Adv rtr : 10.3.3.3
Ls age : 107
Len : 32
Options : E
seq# : 8000000d
chksum : 0x6a73
Net mask : 255.255.255.0
Priority : Low
Attached Router 10.3.3.3
Attached Router 10.5.5.5
[R1]dis ospf lsdb network 10.1.23.2
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Network
Ls id : 10.1.23.2
Adv rtr : 10.2.2.2
Ls age : 1053
Len : 32
Options : E
seq# : 8000000d
chksum : 0xa452
Net mask : 255.255.255.0
Priority : Low
Attached Router 10.2.2.2
Attached Router 10.3.3.3
[R1]dis ospf lsdb network 10.1.45.4
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Network
Ls id : 10.1.45.4
Adv rtr : 10.4.4.4
Ls age : 648
Len : 32
Options : E
seq# : 8000000d
chksum : 0xf7d4
Net mask : 255.255.255.0
Priority : Low
Attached Router 10.4.4.4
Attached Router 10.5.5.5
[R1]dis ospf lsdb router 10.5.5.5
OSPF Process 1 with Router ID 10.1.1.1
Area: 0.0.0.0
Link State Database
Type : Router
Ls id : 10.5.5.5
Adv rtr : 10.5.5.5
Ls age : 135
Len : 84
Options : E
seq# : 80000014
chksum : 0xaa75
Link count: 5
* Link ID: 10.1.35.3
Data : 10.1.35.5
Link Type: TransNet
Metric : 1
* Link ID: 10.1.45.4
Data : 10.1.45.5
Link Type: TransNet
Metric : 1
* Link ID: 10.2.2.2
Data : 10.1.25.5
Link Type: P-2-P
Metric : 48
* Link ID: 10.1.25.0
Data : 255.255.255.0
Link Type: StubNet
Metric : 48
Priority : Low
* Link ID: 5.5.5.5
Data : 255.255.255.255
Link Type: StubNet
Metric : 0
Priority : Medium
最后画出完整的图
标签:10.1,GigabitEthernet0,Link,计算,Router,Type,ID,SPF From: https://blog.csdn.net/a52883258/article/details/145107207