2023年12月8日发(作者:爱良畴)
配置OSPF基本功能
组网需求
如图1所示,所有的S9300都运行OSPF,并将整个自治系统划分为3个区域,其中S9300-A和S9300-B作为ABR来转发区域之间的路由。
配置完成后,每台S9300都应学到自治系统内的到所有网段的路由。
图1 OSPF基本配置组网图
S9300
S9300-A
S9300-A
S9300-B
S9300-B
S9300-C
S9300-C
S9300-D
S9300-D
接口
GigabitEthernet1/0/1
GigabitEthernet1/0/2
GigabitEthernet1/0/1
GigabitEthernet1/0/2
GigabitEthernet1/0/1
GigabitEthernet1/0/2
GigabitEthernet1/0/1
GigabitEthernet1/0/2
对应的VLANIF
VLANIF 10
VLANIF 20
VLANIF 10
VLANIF 30
VLANIF 20
VLANIF 40
VLANIF 30
VLANIF 50
IP地址
192.168.0.1/24
192.168.1.1/24
192.168.0.2/24
192.168.2.1/24
192.168.1.2/24
172.16.1.1/24
192.168.2.2/24
172.17.1.1/24 S9300-E
S9300-F
GigabitEthernet1/0/1
GigabitEthernet1/0/1
VLANIF 40
VLANIF 50
172.16.1.2/24
172.17.1.2/24
配置思路
采用如下的思路配置OSPF基本功能:
1.
2.
3.
4.
配置各接口所属VLAN ID。
配置各VLANIF接口的IP地址。
在各S9300设备上使能OSPF,指定不同区域内的网段。
查看路由表及数据库信息。
数据准备
•
•
•
各接口所属的VLAN ID,具体数据如图1所示。
各VLANIF接口的IP地址,具体数据如图1所示。
各S9300设备的Router ID,OSPF进程号以及各接口所属的区域。
▪ S9300-A的Router ID 1.1.1.1,运行的OSPF进程号1,在区域0的网段192.168.0.0/24,在区域1的网段192.168.1.0/24。
▪ S9300-B的Router ID 2.2.2.2,运行的OSPF进程号1,在区域0的网段192.168.0.0/24,在区域2的网段192.168.2.0/24。
▪ S9300-C的Router ID 3.3.3.3,运行的OSPF进程号1,在区域1的网段192.168.1.0/24,172.16.1.0/24。
▪ S9300-D的Router ID 4.4.4.4,运行的OSPF进程号1,在区域2的网段192.168.2.0/24,172.17.1.0/24。
▪ S9300-E的Router ID 5.5.5.5,运行的OSPF进程号1,在区域1的网段172.16.1.0/24。
▪ S9300-F的Router ID 6.6.6.6,运行的OSPF进程号1,在区域2的网段172.17.1.0/24。 操作步骤
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
配置各接口所属VLAN
[Quidway] sysname S9300-A
[S9300-A] vlan batch 10 20
[S9300-A] interface gigabitEthernet 1/0/1
[S9300-A-GigabitEthernet1/0/1] port hybrid pvid vlan 10
[S9300-A-GigabitEthernet1/0/1] port hybrid untagged vlan 10
[S9300-A-GigabitEthernet1/0/1] quit
[S9300-A] interface gigabitEthernet 1/0/2
[S9300-A-GigabitEthernet1/0/2] port hybrid pvid vlan 20
[S9300-A-GigabitEthernet1/0/2] port hybrid untagged vlan 20
[S9300-A-GigabitEthernet1/0/2] quit
S9300-B、S9300-C、S9300-D、S9300-E、S9300-F上的配置同S9300-A(略)
13. 配置各VLANIF接口的IP地址
14.
15.
16.
17.
18.
[S9300-A] interface vlanif 10
[S9300-A-Vlanif10] ip address 192.168.0.1 24
[S9300-A-Vlanif10] quit
[S9300-A] interface vlanif 20
[S9300-A-Vlanif20] ip address 192.168.1.1 24
[S9300-A-Vlanif20] quit
S9300-B、S9300-C、S9300-D、S9300-E、S9300-F上的配置同S9300-A(略)
19. 配置OSPF基本功能
# 配置S9300-A。
[S9300-A] router id 1.1.1.1
[S9300-A] ospf
[S9300-A-ospf-1] area 0
[S9300-A-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255 [S9300-A-ospf-1-area-0.0.0.0] quit
[S9300-A-ospf-1] area 1
[S9300-A-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[S9300-A-ospf-1-area-0.0.0.1] quit
[S9300-A-ospf-1] quit
# 配置S9300-B。
[S9300-B] router id 2.2.2.2
[S9300-B] ospf
[S9300-B-ospf-1] area 0
[S9300-B-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[S9300-B-ospf-1-area-0.0.0.0] quit
[S9300-B-ospf-1] area 2
[S9300-B-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[S9300-B-ospf-1-area-0.0.0.2] quit
[S9300-B-ospf-1] quit
# 配置S9300-C。
[S9300-C] router id 3.3.3.3
[S9300-C] ospf
[S9300-C-ospf-1] area 1
[S9300-C-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[S9300-C-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[S9300-C-ospf-1-area-0.0.0.1] quit
[S9300-C-ospf-1] quit
# 配置S9300-D。
[S9300-D] router id 4.4.4.4
[S9300-D] ospf
[S9300-D-ospf-1] area 2
[S9300-D-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[S9300-D-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255 [S9300-D-ospf-1-area-0.0.0.2] quit
[S9300-D-ospf-1] quit
# 配置S9300-E。
[S9300-E] router id 5.5.5.5
[S9300-E] ospf
[S9300-E-ospf-1] area 1
[S9300-E-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[S9300-E-ospf-1-area-0.0.0.1] quit
[S9300-E-ospf-1] quit
# 配置S9300-F。
[S9300-F] router id 6.6.6.6
[S9300-F] ospf
[S9300-F-ospf-1] area 2
[S9300-F-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[S9300-F-ospf-1-area-0.0.0.2] quit
[S9300-F-ospf-1] quit
20. 验证配置结果。
# 查看S9300-A的OSPF邻居。
[S9300-A] display ospf peer
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 192.168.0.1(Vlanif10)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.0.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.0.1 BDR: 192.168.0.2 MTU: 0
Dead timer due in 36 sec
Neighbor is up for 00:15:04 Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 192.168.1.1(Vlanif20)'s neighbors
Router ID: 3.3.3.3 Address: 192.168.1.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 39 sec
Neighbor is up for 00:07:32
Authentication Sequence: [ 0 ]
# 显示S9300-A的OSPF路由信息。
[S9300-A] display ospf routing
OSPF Process 1 with Router ID 1.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 2 Transit 192.168.1.2 3.3.3.3 0.0.0.1
172.17.1.0/24 3 Inter-area 192.168.0.2 2.2.2.2 0.0.0.0
192.168.0.0/24 1 Transit 192.168.0.1 1.1.1.1 0.0.0.0
192.168.1.0/24 1 Transit 192.168.1.1 1.1.1.1 0.0.0.1
192.168.2.0/24 2 Inter-area 192.168.0.2 2.2.2.2 0.0.0.0
Total Nets: 5
Intra Area: 3 Inter Area: 2 ASE: 0 NSSA: 0
# 查看S9300-A的LSDB。
[S9300-A] 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 2.2.2.2 2.2.2.2 317 48 80000003 1
Router 1.1.1.1 1.1.1.1 316 48 80000002 1
Network 192.168.0.1 1.1.1.1 316 32 80000001 0
Sum-Net 172.16.1.0 1.1.1.1 250 28 80000001 2
Sum-Net 172.17.1.0 2.2.2.2 203 28 80000001 2
Sum-Net 192.168.2.0 2.2.2.2 237 28 80000002 1
Sum-Net 192.168.1.0 1.1.1.1 295 28 80000002 1
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 192.168.1.2 192.168.1.2 188 48 80000002 1
Router 5.5.5.5 5.5.5.5 214 36 80000004 1
Router 3.3.3.3 3.3.3.3 217 60 80000008 1
Router 1.1.1.1 1.1.1.1 289 48 80000002 1
Network 172.16.1.1 3.3.3.3 670 32 80000001 0
Sum-Net 172.17.1.0 1.1.1.1 202 28 80000001 3
Sum-Net 192.168.2.0 1.1.1.1 242 28 80000001 2
Sum-Net 192.168.0.0 1.1.1.1 300 28 80000001 1
# 查看S9300-D的路由表,并使用Ping进行测试连通性。
[S9300-D] display ospf routing
OSPF Process 1 with Router ID 4.4.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 4 Inter-area 192.168.2.1 2.2.2.2
0.0.0.2
172.17.1.0/24 1 Transit 172.17.1.1 4.4.4.4
0.0.0.2
192.168.0.0/24 2 Inter-area 192.168.2.1 2.2.2.2
0.0.0.2
192.168.1.0/24 3 Inter-area 192.168.2.1 2.2.2.2
0.0.0.2
192.168.2.0/24 1 Transit 192.168.2.2 4.4.4.4
0.0.0.2
Total Nets: 5
Intra Area: 2 Inter Area: 3 ASE: 0 NSSA: 0
[S9300-D] ping 172.16.1.1
PING 172.16.1.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.1.1: bytes=56 Sequence=1 ttl=253 time=62 ms
Reply from 172.16.1.1: bytes=56 Sequence=2 ttl=253 time=16 ms
Reply from 172.16.1.1: bytes=56 Sequence=3 ttl=253 time=62 ms
Reply from 172.16.1.1: bytes=56 Sequence=4 ttl=253 time=94 ms
Reply from 172.16.1.1: bytes=56 Sequence=5 ttl=253 time=63 ms
--- 172.16.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 16/59/94 ms
配置文件 •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
S9300-A的配置文件
#
sysname S9300-A
#
router id 1.1.1.1
#
vlan batch 10 20
#
interface Vlanif10
ip address 192.168.0.1 255.255.255.0
#
interface Vlanif20
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 10
port hybrid untagged vlan 10
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
#
return
• S9300-B的配置文件 •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#
sysname S9300-B
#
router id 2.2.2.2
#
vlan batch 10 30
#
interface Vlanif10
ip address 192.168.0.2 255.255.255.0
#
interface Vlanif30
ip address 192.168.2.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 10
port hybrid untagged vlan 10
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 30
port hybrid untagged vlan 30
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.2
network 192.168.2.0 0.0.0.255
#
return
•
•
S9300-C的配置文件
# •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
sysname S9300-C
#
router id 3.3.3.3
#
vlan batch 20 40
#
interface Vlanif20
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif40
ip address 172.16.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 40
port hybrid untagged vlan 40
#
ospf 1
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
#
return
•
•
•
•
S9300-D的配置文件
#
sysname S9300-D
# •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
router id 4.4.4.4
#
vlan batch 30 50
#
interface Vlanif30
ip address 192.168.2.2 255.255.255.0
#
interface Vlanif50
ip address 172.17.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 30
port hybrid untagged vlan 30
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 50
port hybrid untagged vlan 50
#
ospf 1
area 0.0.0.2
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
#
return
•
•
•
•
•
•
S9300-E的配置文件
#
sysname S9300-E
#
router id 5.5.5.5
# •
•
•
•
•
•
•
•
•
•
•
•
•
vlan batch 40
#
interface Vlanif40
ip address 172.16.1.2 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 40
port hybrid untagged vlan 40
#
ospf 1
area 0.0.0.1
network 172.16.1.0 0.0.0.255
#
return
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
S9300-F的配置文件
#
sysname S9300-F
#
router id 6.6.6.6
#
vlan batch 50
#
interface Vlanif50
ip address 172.17.1.2 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 50
port hybrid untagged vlan 50
#
ospf 1 •
•
•
area 0.0.0.2
network 172.17.1.0 0.0.0.255
#
return
父主题: 配置OSPF举例
相关任务
配置OSPF的基本功能
华为所有和机密
版权所有 © 华为技术有限公司
2023年12月8日发(作者:爱良畴)
配置OSPF基本功能
组网需求
如图1所示,所有的S9300都运行OSPF,并将整个自治系统划分为3个区域,其中S9300-A和S9300-B作为ABR来转发区域之间的路由。
配置完成后,每台S9300都应学到自治系统内的到所有网段的路由。
图1 OSPF基本配置组网图
S9300
S9300-A
S9300-A
S9300-B
S9300-B
S9300-C
S9300-C
S9300-D
S9300-D
接口
GigabitEthernet1/0/1
GigabitEthernet1/0/2
GigabitEthernet1/0/1
GigabitEthernet1/0/2
GigabitEthernet1/0/1
GigabitEthernet1/0/2
GigabitEthernet1/0/1
GigabitEthernet1/0/2
对应的VLANIF
VLANIF 10
VLANIF 20
VLANIF 10
VLANIF 30
VLANIF 20
VLANIF 40
VLANIF 30
VLANIF 50
IP地址
192.168.0.1/24
192.168.1.1/24
192.168.0.2/24
192.168.2.1/24
192.168.1.2/24
172.16.1.1/24
192.168.2.2/24
172.17.1.1/24 S9300-E
S9300-F
GigabitEthernet1/0/1
GigabitEthernet1/0/1
VLANIF 40
VLANIF 50
172.16.1.2/24
172.17.1.2/24
配置思路
采用如下的思路配置OSPF基本功能:
1.
2.
3.
4.
配置各接口所属VLAN ID。
配置各VLANIF接口的IP地址。
在各S9300设备上使能OSPF,指定不同区域内的网段。
查看路由表及数据库信息。
数据准备
•
•
•
各接口所属的VLAN ID,具体数据如图1所示。
各VLANIF接口的IP地址,具体数据如图1所示。
各S9300设备的Router ID,OSPF进程号以及各接口所属的区域。
▪ S9300-A的Router ID 1.1.1.1,运行的OSPF进程号1,在区域0的网段192.168.0.0/24,在区域1的网段192.168.1.0/24。
▪ S9300-B的Router ID 2.2.2.2,运行的OSPF进程号1,在区域0的网段192.168.0.0/24,在区域2的网段192.168.2.0/24。
▪ S9300-C的Router ID 3.3.3.3,运行的OSPF进程号1,在区域1的网段192.168.1.0/24,172.16.1.0/24。
▪ S9300-D的Router ID 4.4.4.4,运行的OSPF进程号1,在区域2的网段192.168.2.0/24,172.17.1.0/24。
▪ S9300-E的Router ID 5.5.5.5,运行的OSPF进程号1,在区域1的网段172.16.1.0/24。
▪ S9300-F的Router ID 6.6.6.6,运行的OSPF进程号1,在区域2的网段172.17.1.0/24。 操作步骤
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
配置各接口所属VLAN
[Quidway] sysname S9300-A
[S9300-A] vlan batch 10 20
[S9300-A] interface gigabitEthernet 1/0/1
[S9300-A-GigabitEthernet1/0/1] port hybrid pvid vlan 10
[S9300-A-GigabitEthernet1/0/1] port hybrid untagged vlan 10
[S9300-A-GigabitEthernet1/0/1] quit
[S9300-A] interface gigabitEthernet 1/0/2
[S9300-A-GigabitEthernet1/0/2] port hybrid pvid vlan 20
[S9300-A-GigabitEthernet1/0/2] port hybrid untagged vlan 20
[S9300-A-GigabitEthernet1/0/2] quit
S9300-B、S9300-C、S9300-D、S9300-E、S9300-F上的配置同S9300-A(略)
13. 配置各VLANIF接口的IP地址
14.
15.
16.
17.
18.
[S9300-A] interface vlanif 10
[S9300-A-Vlanif10] ip address 192.168.0.1 24
[S9300-A-Vlanif10] quit
[S9300-A] interface vlanif 20
[S9300-A-Vlanif20] ip address 192.168.1.1 24
[S9300-A-Vlanif20] quit
S9300-B、S9300-C、S9300-D、S9300-E、S9300-F上的配置同S9300-A(略)
19. 配置OSPF基本功能
# 配置S9300-A。
[S9300-A] router id 1.1.1.1
[S9300-A] ospf
[S9300-A-ospf-1] area 0
[S9300-A-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255 [S9300-A-ospf-1-area-0.0.0.0] quit
[S9300-A-ospf-1] area 1
[S9300-A-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[S9300-A-ospf-1-area-0.0.0.1] quit
[S9300-A-ospf-1] quit
# 配置S9300-B。
[S9300-B] router id 2.2.2.2
[S9300-B] ospf
[S9300-B-ospf-1] area 0
[S9300-B-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255
[S9300-B-ospf-1-area-0.0.0.0] quit
[S9300-B-ospf-1] area 2
[S9300-B-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[S9300-B-ospf-1-area-0.0.0.2] quit
[S9300-B-ospf-1] quit
# 配置S9300-C。
[S9300-C] router id 3.3.3.3
[S9300-C] ospf
[S9300-C-ospf-1] area 1
[S9300-C-ospf-1-area-0.0.0.1] network 192.168.1.0 0.0.0.255
[S9300-C-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[S9300-C-ospf-1-area-0.0.0.1] quit
[S9300-C-ospf-1] quit
# 配置S9300-D。
[S9300-D] router id 4.4.4.4
[S9300-D] ospf
[S9300-D-ospf-1] area 2
[S9300-D-ospf-1-area-0.0.0.2] network 192.168.2.0 0.0.0.255
[S9300-D-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255 [S9300-D-ospf-1-area-0.0.0.2] quit
[S9300-D-ospf-1] quit
# 配置S9300-E。
[S9300-E] router id 5.5.5.5
[S9300-E] ospf
[S9300-E-ospf-1] area 1
[S9300-E-ospf-1-area-0.0.0.1] network 172.16.1.0 0.0.0.255
[S9300-E-ospf-1-area-0.0.0.1] quit
[S9300-E-ospf-1] quit
# 配置S9300-F。
[S9300-F] router id 6.6.6.6
[S9300-F] ospf
[S9300-F-ospf-1] area 2
[S9300-F-ospf-1-area-0.0.0.2] network 172.17.1.0 0.0.0.255
[S9300-F-ospf-1-area-0.0.0.2] quit
[S9300-F-ospf-1] quit
20. 验证配置结果。
# 查看S9300-A的OSPF邻居。
[S9300-A] display ospf peer
OSPF Process 1 with Router ID 1.1.1.1
Neighbors
Area 0.0.0.0 interface 192.168.0.1(Vlanif10)'s neighbors
Router ID: 2.2.2.2 Address: 192.168.0.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.0.1 BDR: 192.168.0.2 MTU: 0
Dead timer due in 36 sec
Neighbor is up for 00:15:04 Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.1 interface 192.168.1.1(Vlanif20)'s neighbors
Router ID: 3.3.3.3 Address: 192.168.1.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: 192.168.1.1 BDR: 192.168.1.2 MTU: 0
Dead timer due in 39 sec
Neighbor is up for 00:07:32
Authentication Sequence: [ 0 ]
# 显示S9300-A的OSPF路由信息。
[S9300-A] display ospf routing
OSPF Process 1 with Router ID 1.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 2 Transit 192.168.1.2 3.3.3.3 0.0.0.1
172.17.1.0/24 3 Inter-area 192.168.0.2 2.2.2.2 0.0.0.0
192.168.0.0/24 1 Transit 192.168.0.1 1.1.1.1 0.0.0.0
192.168.1.0/24 1 Transit 192.168.1.1 1.1.1.1 0.0.0.1
192.168.2.0/24 2 Inter-area 192.168.0.2 2.2.2.2 0.0.0.0
Total Nets: 5
Intra Area: 3 Inter Area: 2 ASE: 0 NSSA: 0
# 查看S9300-A的LSDB。
[S9300-A] 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 2.2.2.2 2.2.2.2 317 48 80000003 1
Router 1.1.1.1 1.1.1.1 316 48 80000002 1
Network 192.168.0.1 1.1.1.1 316 32 80000001 0
Sum-Net 172.16.1.0 1.1.1.1 250 28 80000001 2
Sum-Net 172.17.1.0 2.2.2.2 203 28 80000001 2
Sum-Net 192.168.2.0 2.2.2.2 237 28 80000002 1
Sum-Net 192.168.1.0 1.1.1.1 295 28 80000002 1
Area: 0.0.0.1
Type LinkState ID AdvRouter Age Len Sequence Metric
Router 192.168.1.2 192.168.1.2 188 48 80000002 1
Router 5.5.5.5 5.5.5.5 214 36 80000004 1
Router 3.3.3.3 3.3.3.3 217 60 80000008 1
Router 1.1.1.1 1.1.1.1 289 48 80000002 1
Network 172.16.1.1 3.3.3.3 670 32 80000001 0
Sum-Net 172.17.1.0 1.1.1.1 202 28 80000001 3
Sum-Net 192.168.2.0 1.1.1.1 242 28 80000001 2
Sum-Net 192.168.0.0 1.1.1.1 300 28 80000001 1
# 查看S9300-D的路由表,并使用Ping进行测试连通性。
[S9300-D] display ospf routing
OSPF Process 1 with Router ID 4.4.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
172.16.1.0/24 4 Inter-area 192.168.2.1 2.2.2.2
0.0.0.2
172.17.1.0/24 1 Transit 172.17.1.1 4.4.4.4
0.0.0.2
192.168.0.0/24 2 Inter-area 192.168.2.1 2.2.2.2
0.0.0.2
192.168.1.0/24 3 Inter-area 192.168.2.1 2.2.2.2
0.0.0.2
192.168.2.0/24 1 Transit 192.168.2.2 4.4.4.4
0.0.0.2
Total Nets: 5
Intra Area: 2 Inter Area: 3 ASE: 0 NSSA: 0
[S9300-D] ping 172.16.1.1
PING 172.16.1.1: 56 data bytes, press CTRL_C to break
Reply from 172.16.1.1: bytes=56 Sequence=1 ttl=253 time=62 ms
Reply from 172.16.1.1: bytes=56 Sequence=2 ttl=253 time=16 ms
Reply from 172.16.1.1: bytes=56 Sequence=3 ttl=253 time=62 ms
Reply from 172.16.1.1: bytes=56 Sequence=4 ttl=253 time=94 ms
Reply from 172.16.1.1: bytes=56 Sequence=5 ttl=253 time=63 ms
--- 172.16.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 16/59/94 ms
配置文件 •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
S9300-A的配置文件
#
sysname S9300-A
#
router id 1.1.1.1
#
vlan batch 10 20
#
interface Vlanif10
ip address 192.168.0.1 255.255.255.0
#
interface Vlanif20
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 10
port hybrid untagged vlan 10
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
#
return
• S9300-B的配置文件 •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
#
sysname S9300-B
#
router id 2.2.2.2
#
vlan batch 10 30
#
interface Vlanif10
ip address 192.168.0.2 255.255.255.0
#
interface Vlanif30
ip address 192.168.2.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 10
port hybrid untagged vlan 10
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 30
port hybrid untagged vlan 30
#
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
area 0.0.0.2
network 192.168.2.0 0.0.0.255
#
return
•
•
S9300-C的配置文件
# •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
sysname S9300-C
#
router id 3.3.3.3
#
vlan batch 20 40
#
interface Vlanif20
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif40
ip address 172.16.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 40
port hybrid untagged vlan 40
#
ospf 1
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
#
return
•
•
•
•
S9300-D的配置文件
#
sysname S9300-D
# •
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
router id 4.4.4.4
#
vlan batch 30 50
#
interface Vlanif30
ip address 192.168.2.2 255.255.255.0
#
interface Vlanif50
ip address 172.17.1.1 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 30
port hybrid untagged vlan 30
#
interface GigabitEthernet1/0/2
port hybrid pvid vlan 50
port hybrid untagged vlan 50
#
ospf 1
area 0.0.0.2
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
#
return
•
•
•
•
•
•
S9300-E的配置文件
#
sysname S9300-E
#
router id 5.5.5.5
# •
•
•
•
•
•
•
•
•
•
•
•
•
vlan batch 40
#
interface Vlanif40
ip address 172.16.1.2 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 40
port hybrid untagged vlan 40
#
ospf 1
area 0.0.0.1
network 172.16.1.0 0.0.0.255
#
return
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
S9300-F的配置文件
#
sysname S9300-F
#
router id 6.6.6.6
#
vlan batch 50
#
interface Vlanif50
ip address 172.17.1.2 255.255.255.0
#
interface GigabitEthernet1/0/1
port hybrid pvid vlan 50
port hybrid untagged vlan 50
#
ospf 1 •
•
•
area 0.0.0.2
network 172.17.1.0 0.0.0.255
#
return
父主题: 配置OSPF举例
相关任务
配置OSPF的基本功能
华为所有和机密
版权所有 © 华为技术有限公司