华为路由器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直接与骨干区域相连。

转载于:https://blog.51cto.com/11806823/2327227

OSPF(Open Shortest Path First)是一种开放式最短路径优先(OSPF)协议,它是一种内部网关协议(IGP),用于在同一自治系统(AS)内选择最短路径。 以下是4台华为路由器OSPF配置的步骤及原理: 1. 配置网络拓扑 假设我们有4台华为路由器,它们的IP地址和相应的接口如下: - R1: 192.168.1.1/24(GigabitEthernet0/0/0) - R2: 192.168.1.2/24(GigabitEthernet0/0/0) - R3: 192.168.2.1/24(GigabitEthernet0/0/0) - R4: 192.168.2.2/24(GigabitEthernet0/0/0) 它们的物理连接如下图所示: ``` +---------+ +---------+ | R1 | | R2 | | | | | | | | | +---------+ +---------+ | | | | | | +---------+ +---------+ | R3 | | R4 | | | | | | | | | +---------+ +---------+ ``` 2. 配置OSPF协议 在R1上配置OSPF协议: ``` [R1] ospf [R1-ospf-1] area 0 [R1-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 ``` 在R2上配置OSPF协议: ``` [R2] ospf [R2-ospf-1] area 0 [R2-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 ``` 在R3上配置OSPF协议: ``` [R3] ospf [R3-ospf-1] area 0 [R3-ospf-1-area-0.0.0.0] network 192.168.2.0 0.0.0.255 ``` 在R4上配置OSPF协议: ``` [R4] ospf [R4-ospf-1] area 0 [R4-ospf-1-area-0.0.0.0] network 192.168.2.0 0.0.0.255 ``` 3. 验证OSPF邻居关系 在R1上查看OSPF邻居关系: ``` [R1] display ospf peer ``` 在R2上查看OSPF邻居关系: ``` [R2] display ospf peer ``` 在R3上查看OSPF邻居关系: ``` [R3] display ospf peer ``` 在R4上查看OSPF邻居关系: ``` [R4] display ospf peer ``` 4. 验证OSPF路由表 在R1上查看OSPF路由表: ``` [R1] display ospf route ``` 在R2上查看OSPF路由表: ``` [R2] display ospf route ``` 在R3上查看OSPF路由表: ``` [R3] display ospf route ``` 在R4上查看OSPF路由表: ``` [R4] display ospf route ``` OSPF协议的工作原理是,每个路由器通过将其连接到的网络发送LSA(链路状态广告)来描述其所知道的所有网络和路由器。这些LSA被所有路由器接收并用于构建一个拓扑图。然后,每个路由器使用Dijkstra算法计算到达每个网络的最短路径,并将这些路径存储在路由表中。当网络拓扑发生变化时,OSPF会重新计算最短路径,并更新路由表。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值