1. 程式人生 > >華為路由器OSPF多區域配置(一)

華為路由器OSPF多區域配置(一)

  • OSPF(Open Shortest Path First開放式最短路徑優先)是一個內部閘道器協議(Interior Gateway Protocol,簡稱IGP),在企業內網當中應用非常廣泛,本位主要介紹OSPF多區域配,以及OSPF鏈路狀態資料庫基本分析,OSPF多區域的產生可以增強網路的可擴充套件性、降低路由器的負載、快速收斂。
  • 拓撲配如下圖:
    華為路由器OSPF多區域配置(一)

    每臺路由器基本網路配置如下:

    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多區域配置(一)
    華為路由器OSPF多區域配置(一)

    接下來我們配置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多區域配置(一)

    檢視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路由分類:內部路由、外部路由。