1. 程式人生 > >華為路由器OSPF虛鏈路配置(三)

華為路由器OSPF虛鏈路配置(三)

  • 我們知道在OSPF配置當中,非骨幹區域必須和骨幹區域直接相連,若不與骨幹區域直接相連,則需要配置虛鏈路,本篇文章主要介紹OSPF虛鏈路配置命令。

    實驗配置如下圖:

    華為路由器OSPF虛鏈路配置(三)

    實驗說明如下:

1.路由器R1、R2在0區域,路由器R2、R3、R4在234區域,路由器R4、R5在45區域。
2.45區域沒有與骨幹區域直接相連,因此在不引入外部路由的情況下,需要在路由R2、R4上配置虛鏈路。

第一步,實驗基本配置如下:

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
quit

第二步,配置OSPF;

配置命令如下:
R1
ospf 1 router-id 1.1.1.1
area 0
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.12.0 0.0.0.255
area 234
network 192.168.23.0 0.0.0.255
R3
ospf 1 router-id 3.3.3.3
area 234
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 234
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
quit

檢視R1的路由表,如下:

[R1]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
Public routing table : OSPF
Destinations : 2 Routes : 2

OSPF routing table status : <Active>
Destinations : 2 Routes : 2

Destination/Mask Proto Pre Cost Flags NextHop Interface

192.168.23.0/24 OSPF 10 2 D 192.168.12.2 GigabitEthernet
0/0/0
192.168.34.0/24 OSPF 10 3 D 192.168.12.2 GigabitEthernet
0/0/0

 分析:由於45區域沒有與骨幹0區域直接相連,因此R1上面沒有45區域的路由資訊。

第三步,配置虛鏈路,即vlink-peer。

分別在R2、R4上配置vlink-peer:
R2
ospf 1
area 234
vlink-peer 4.4.4.4
R4
ospf 1
area 234
vlink-peer 2.2.2.2

驗證:
    檢視R1的路由表,如下:

[R1]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
Public routing table : OSPF
Destinations : 4 Routes : 4

OSPF routing table status : <Active>
Destinations : 4 Routes : 4

Destination/Mask Proto Pre Cost Flags NextHop Interface

192.168.5.0/24  OSPF    10   5           D   192.168.12.2    GigabitEthernet

0/0/0
192.168.23.0/24 OSPF 10 2 D 192.168.12.2 GigabitEthernet
0/0/0
192.168.34.0/24 OSPF 10 3 D 192.168.12.2 GigabitEthernet
0/0/0
192.168.45.0/24 OSPF 10 4 D 192.168.12.2 GigabitEthernet
0/0/0

OSPF routing table status : <Inactive>
Destinations : 0 Routes : 0
測試PC1、PC2的網路聯通性:
華為路由器OSPF虛鏈路配置(三)

總結
        檢視R4的路由資訊:

[R4]display ospf brief

 OSPF Process 1 with Router ID 4.4.4.4
     OSPF Protocol Information

RouterID: 4.4.4.4 Border Router: AREA
Multi-×××-Instance is not enabled
Global DS-TE Mode: Non-Standard IETF Mode
Graceful-restart capability: disabled
Helper support capability : not configured
Applications Supported: MPLS Traffic-Engineering
Spf-schedule-interval: max 10000ms, start 500ms, hold 1000ms
Default ASE parameters: Metric: 1 Tag: 1 Type: 2
Route Preference: 10
ASE Route Preference: 150
SPF Computation Count: 14
RFC 1583 Compatible
Retransmission limitation is disabled
Area Count: 3 Nssa Area Count: 0
ExChange/Loading Neighbors: 0
Process total up interface count: 3
Process valid up interface count: 2

 分析得出:
      R4路由狀態以變為區域ABR,即虛鏈路使得R4直接與骨幹區域相連。