• OSPF(Open Shortest Path First开放式最短路径优先)是一个内部网关协议(Interior Gateway Protocol,简称IGP),在企业内网当中应用非常广泛,本位主要介绍OSPF多区域配,以及OSPF链路状态数据库基本分析,OSPF多区域的产生可以增强网络的可扩展性、降低路由器的负载、快速收敛。
  • 拓扑配如下图:
    华为路由器OSPF多区域配置(一)_第1张图片

    每台路由器基本网络配置如下:

    R1配置:
    system-view
    sysname R1
    user-interface console 0
    idle-timeout 1000
    quit
    interface GigabitEthernet0/0/2
    ip address 192.168.1.254 255.255.255.0
    interface GigabitEthernet0/0/1
    ip address 192.168.17.1 255.255.255.0
    interface GigabitEthernet0/0/0
    ip address 192.168.12.1 255.255.255.0
    quit

    R2配置:
    system-view
    sysname R2
    interface GigabitEthernet0/0/1
    ip address 192.168.12.2 255.255.255.0
    interface GigabitEthernet0/0/0
    ip address 192.168.23.2 255.255.255.0
    quit
    R3配置:
    system-view
    sysname R3
    interface GigabitEthernet0/0/1
    ip address 192.168.23.3 255.255.255.0
    interface GigabitEthernet0/0/0
    ip address 192.168.34.3 255.255.255.0
    quit

    R4配置:
    system-view
    sysname R4
    interface GigabitEthernet0/0/1
    ip address 192.168.34.4 255.255.255.0
    interface GigabitEthernet0/0/0
    ip address 192.168.45.4 255.255.255.0
    quit

    R5配置:
    system-view
    sysname R5
    interface GigabitEthernet0/0/1
    ip address 192.168.45.5 255.255.255.0
    interface GigabitEthernet0/0/2
    ip address 192.168.5.254 255.255.255.0
    interface GigabitEthernet0/0/0
    ip address 100.1.1.5 255.255.255.0

    PC1、PC2配置如下:
    华为路由器OSPF多区域配置(一)_第2张图片
    华为路由器OSPF多区域配置(一)_第3张图片

    接下来我们配置OSPF多区域,配置如下:

    R1配置
    ospf 1 router-id 1.1.1.1
    area 12
    network 192.168.12.0 0.0.0.255
    network 192.168.1.0 0.0.0.255

    R2配置
    ospf 1 router-id 2.2.2.2
    area 0
    network 192.168.23.0 0.0.0.255
    area 12
    network 192.168.12.0 0.0.0.255

    R3配置
    ospf 1 router-id 3.3.3.3
    area 0
    network 192.168.23.0 0.0.0.255
    network 192.168.34.0 0.0.0.255

    R4配置
    ospf 1 router-id 4.4.4.4
    area 0
    network 192.168.34.0 0.0.0.255
    area 45
    network 192.168.45.0 0.0.0.255

    R5配置
    ospf 1 router-id 5.5.5.5
    area 45
    network 192.168.45.0 0.0.0.255
    network 192.168.5.0 0.0.0.255

    测试让了连通性,用PC1pingPC2,网络互通,如下:
    华为路由器OSPF多区域配置(一)_第4张图片

    查看R1的链路状态数据库如下:

[R1]display ospf lsdb
OSPF Process 1 with Router ID 1.1.1.1
Link State Database

                     Area: 0.0.0.12

Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 1423 36 80000004 1
Router 1.1.1.1 1.1.1.1 1012 48 80000008 1
Network 192.168.12.2 2.2.2.2 1423 32 80000002 0
Sum-Net 192.168.5.0 2.2.2.2 1039 28 80000001 4
Sum-Net 192.168.45.0 2.2.2.2 1409 28 80000001 3
Sum-Net 192.168.23.0 2.2.2.2 1468 28 80000001 1
Sum-Net 192.168.34.0 2.2.2.2 1409 28 80000001 2
Sum-Asbr 5.5.5.5 2.2.2.2 1393 28 80000001 3

 查看R2的链路状态数据库如下:

[R1]display ospf lsdb
OSPF Process 1 with Router ID 2.2.2.2
Link State Database

             Area: 0.0.0.0

Type LinkState ID AdvRouter Age Len Sequence Metric
Router 4.4.4.4 4.4.4.4 1323 36 80000005 1
Router 2.2.2.2 2.2.2.2 1332 36 80000005 1
Router 3.3.3.3 3.3.3.3 1322 48 80000008 1
Network 192.168.23.3 3.3.3.3 1323 32 80000002 0
Network 192.168.34.4 4.4.4.4 1324 32 80000002 0
Sum-Net 192.168.5.0 4.4.4.4 954 28 80000001 2
Sum-Net 192.168.45.0 4.4.4.4 1361 28 80000001 1
Sum-Net 192.168.12.0 2.2.2.2 1381 28 80000001 1
Sum-Net 192.168.1.0 2.2.2.2 964 28 80000001 2
Sum-Asbr 5.5.5.5 4.4.4.4 1308 28 80000001 1

    Area: 0.0.0.12

Type LinkState ID AdvRouter Age Len Sequence Metric
Router 2.2.2.2 2.2.2.2 1336 36 80000004 1
Router 1.1.1.1 1.1.1.1 927 48 80000008 1
Network 192.168.12.2 2.2.2.2 1336 32 80000002 0
Sum-Net 192.168.5.0 2.2.2.2 952 28 80000001 4
Sum-Net 192.168.45.0 2.2.2.2 1322 28 80000001 3
Sum-Net 192.168.23.0 2.2.2.2 1381 28 80000001 1
Sum-Net 192.168.34.0 2.2.2.2 1322 28 80000001 2
Sum-Asbr 5.5.5.5 2.2.2.2 1306 28 80000001 3

  • OSPF路由器分类:区域内部路由器、区域间路由器(ABR如R2和R4、ASBR如R5)、区域外部路由器。
  • OSPF区域类型:骨干区域,非骨干区域,非骨干区域又分为:标准区域、特殊区域
  • OSPF路由分类:内部路由、外部路由。