OSPF 基础案例
配置 S1 交换机
[S1]int LoopBack 0
[S1-LoopBack0]ip addr 1.1.1.1 32
[S1]vlan batch 20 30
Info: This operation may take a few seconds. Please wait for a moment...done.
[S1]int vlanif 20
[S1-Vlanif20]ip addr 192.168.20.1 24
[S1-Vlanif20]int vlanif 30
[S1-Vlanif30]ip addr 192.168.30.1 24
[S1]int g0/0/2
[S1-GigabitEthernet0/0/2]port link-type trunk
[S1-GigabitEthernet0/0/2]port trunk allow-pass vlan 20
[S1]int g0/0/3
[S1-GigabitEthernet0/0/3]port link-type trunk
[S1-GigabitEthernet0/0/3]port trunk allow-pass vlan 30
S1 abr(area board router)OSPF 配置
# 骨干 area 0, ospf process 1,设备 id 1.1.1.1
# 宣告 network 192.168.30.0 通配 0.0.0.255
[S1]ospf 1 router-id 1.1.1.1
[S1-ospf-1]area 0
[S1-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
# area 1, ospf process 1,设备 id 1.1.1.1
# 宣告 network 192.168.20.0 通配 0.0.0.255
[S1-ospf-1-area-0.0.0.0]area 1
[S1-ospf-1-area-0.0.0.1]network 192.168.20.0 0.0.0.255
配置 S2 交换机
[S2]int LoopBack 0
[S2-LoopBack0]ip addr 2.2.2.2 32
[S2]vlan 20
[S2]int vlanif 20
[S2-Vlanif20]ip address 192.168.20.254 255.255.255.0
[S2-vlan20]int g0/0/1
[S2-GigabitEthernet0/0/1]port link-type trunk
[S2-GigabitEthernet0/0/1]port trunk allow-pass vlan 20
# area 1
[S2]ospf 1 router-id 2.2.2.2
[S2-ospf-1]area 1
[S2-ospf-1-area-0.0.0.1]network 192.168.20.0 0.0.0.255
配置 S3 交换机
[S3]int LoopBack 0
[S3-LoopBack0]ip addr 3.3.3.3 32
[S3]vlan 30
[S3]int vlanif 30
[S3-Vlanif30]ip address 192.168.30.254 255.255.255.0
[S3-vlan30]int g0/0/1
[S3-GigabitEthernet0/0/1]port link-type trunk
[S3-GigabitEthernet0/0/1]port trunk allow-pass vlan 30
# 骨干 area 0
[S3]ospf 1 router-id 2.2.2.2
[S3-ospf-1]area 0
[S3-ospf-1-area-0.0.0.0]network 192.168.30.0 0.0.0.255
ABR 中的一些表
ospf neighbor 表
ABR peer
<S1>display ospf peer
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 192.168.30.1(Vlanif30)'s neighbors
Router ID: 3.3.3.3 Address: 192.168.30.254
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.30.1 BDR: 192.168.30.254 MTU: 0
Dead timer due in 36 sec
Retrans timer interval: 5
Neighbor is up for 00:33:19
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 192.168.20.1(Vlanif20)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.20.254
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.20.1 BDR: 192.168.20.254 MTU: 0
Dead timer due in 30 sec
Retrans timer interval: 5
Neighbor is up for 00:34:33
Authentication Sequence: [ 0 ]
ospf topology 表(lsdb 表)
ABR topology 表
<S1>display ospf lsdb
OSPF Process 1 with Router ID 1.1.1.1
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 1.1.1.1 1.1.1.1 250 36 80000007 1
Router 3.3.3.3 3.3.3.3 255 36 80000004 1
Network 192.168.30.1 1.1.1.1 250 32 80000003 0
Sum-Net 192.168.20.0 1.1.1.1 138 28 80000003 1
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 329 36 80000004 1
Router 1.1.1.1 1.1.1.1 325 36 80000006 1
Network 192.168.20.1 1.1.1.1 325 32 80000003 0
Sum-Net 192.168.30.0 1.1.1.1 138 28 80000003 1
ospf routing 表
ABR routing 表
<S1>display ospf routing
OSPF Process 1 with Router ID 1.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
192.168.20.0/24 1 Transit 192.168.20.1 1.1.1.1 0.0.0.1
192.168.30.0/24 1 Transit 192.168.30.1 1.1.1.1 0.0.0.0
Total Nets: 2
Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0
internal router 的一些表
ospf neighbor 表
<S3>display ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 192.168.30.254(Vlanif30)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.30.1
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.30.1 BDR: 192.168.30.254 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:38:22
Authentication Sequence: [ 0 ]
ospf topology 表(lsdb 表)
<S3>display ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 192.168.30.254(Vlanif30)'s neighbors
Router ID: 1.1.1.1 Address: 192.168.30.1
State: Full Mode:Nbr is Slave Priority: 1
DR: 192.168.30.1 BDR: 192.168.30.254 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:38:22
Authentication Sequence: [ 0 ]
<S3>display ospf lsdb
OSPF Process 1 with Router ID 3.3.3.3
Link State Database
Area: 0.0.0.0
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 1.1.1.1 1.1.1.1 529 36 80000007 1
Router 3.3.3.3 3.3.3.3 532 36 80000004 1
Network 192.168.30.1 1.1.1.1 529 32 80000003 0
Sum-Net 192.168.20.0 1.1.1.1 417 28 80000003 1
ospf routing 表
<S3>display ospf routing
OSPF Process 1 with Router ID 3.3.3.3
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
192.168.30.0/24 1 Transit 192.168.30.254 3.3.3.3 0.0.0.0
192.168.20.0/24 2 Inter-area 192.168.30.1 1.1.1.1 0.0.0.0
Total Nets: 2
Intra Area: 1 Inter Area: 1 ASE: 0 NSSA: 0
参考:
重启 ospf :reset ospf process
<S3>reset ospf process
保存 ospf
<S3>save pzhang.zip
<S3>startup saved-configuration pzhang.zip
Info: Succeeded in setting the configuration for booting system.
<S3>display startup
MainBoard:
Configured startup system software: NULL
Startup system software: NULL
Next startup system software: NULL
Startup saved-configuration file: NULL
Next startup saved-configuration file: flash:/pzhang.zip
Startup paf file: NULL
Next startup paf file: NULL
Startup license file: NULL
Next startup license file: NULL
Startup patch package: NULL
Next startup patch package: NULL
https://support.huawei.com/enterprise/zh/doc/EDOC1000141427/d55d1d8c