咱們知道在OSPF配置當中,非骨幹區域必須和骨幹區域直接相連,若不與骨幹區域直接相連,則須要配置虛鏈路,本篇文章主要介紹OSPF虛鏈路配置命令。markdown
實驗配置以下圖:
實驗說明以下:網絡
1.路由器R一、R2在0區域,路由器R二、R三、R4在234區域,路由器R四、R5在45區域。
2.45區域沒有與骨幹區域直接相連,所以在不引入外部路由的狀況下,須要在路由R二、R4上配置虛鏈路。ide
第一步,實驗基本配置以下:
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
quitui
查看R1的路由表,以下:
[R1]display ip routing-table protocol ospf
Route Flags: R - relay, D - download to fib
Public routing table : OSPF
Destinations : 2 Routes : 2 rest
OSPF routing table status : <Active>
Destinations : 2 Routes : 2code
Destination/Mask Proto Pre Cost Flags NextHop Interfaceorm
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/0router
分析:因爲45區域沒有與骨幹0區域直接相連,所以R1上面沒有45區域的路由信息。 第三步,配置虛鏈路,即vlink-peer。
分別在R二、R4上配置vlink-peer:
R2
ospf 1
area 234
vlink-peer 4.4.4.4
R4
ospf 1
area 234
vlink-peer 2.2.2.2blog
驗證: 查看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
測試PC一、PC2的網絡聯通性:
總結 查看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直接與骨幹區域相連。