OSPF的虚链路配置实例
虚连接:Virtual Link
- 为了避免区域间的环路,OSPF规定不允许直接在两个非骨干区域之间发布路由信息,只允许在一个区域内部或者在骨干区域和非骨干区域之间发布路由信息。因此,每个ABR都不必须连接到骨干区域。即要求所有非骨干区域必须和骨干区域相连,同时骨干区域也必须连续。
- 但由于网络设计、升级、合并、改造等因素,从而造成不规范区域架构,最终导致路由学习不完整,解决方法就是使用虚拟链路。
- 然而,虚连接的存在增加了网络的复杂程度,使故障的排出更加困难。因此,在网络规划中应该尽量避免使用虚连接。
- 虚连接仅是作为修复无法避免的网络拓扑问题的一种临时手段。
- 虚链路可以看作是一个标明网络的某个部分是否需要重新规划设计的标志。
基本配置:
sys
sys R1
int g0/0/0
ip add 12.0.0.1 24
ospf 1 router-id 1.1.1.1
a 0
net 12.0.0.1 0.0.0.0
sys
sys R2
int g0/0/0
ip add 12.0.0.2 24
int g0/0/1
ip add 23.0.0.2 24
ospf 1 router-id 2.2.2.2
a 0
net 12.0.0.2 0.0.0.0
a 1
net 23.0.0.2 0.0.0.0
sys
sys R3
int g0/0/0
ip add 23.0.0.3 24
int g0/0/1
ip add 34.0.0.3 24
ospf 1 router-id 3.3.3.3
a 1
net 23.0.0.3 0.0.0.0
a 2
net 34.0.0.3 0.0.0.0
sys
sys R4
int g0/0/0
ip add 34.0.0.4 24
ospf 1 router-id 4.4.4.4
a 2
net 34.0.0.4 0.0.0.0
使用display ospf routing可以查看到R1、R2、R4通过OSPF学习到的路由表都是不完整的。只有R3能学习到完整的路由,应为R3与area 2和area 1直连,又与area 0建立规则
[R1-ospf-1-area-0.0.0.0]display ospf rou
OSPF Process 1 with Router ID 1.1.1.1
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
12.0.0.0/24 1 Transit 12.0.0.1 1.1.1.1 0.0.0.0
23.0.0.0/24 2 Inter-area 12.0.0.2 2.2.2.2 0.0.0.0
Total Nets: 2
Intra Area: 1 Inter Area: 1 ASE: 0 NSSA: 0
[R2-ospf-1-area-0.0.0.1]dis ospf routing
OSPF Process 1 with Router ID 2.2.2.2
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
12.0.0.0/24 1 Transit 12.0.0.2 2.2.2.2 0.0.0.0
23.0.0.0/24 1 Transit 23.0.0.2 2.2.2.2 0.0.0.1
Total Nets: 2
Intra Area: 2 Inter Area: 0 ASE: 0 NSSA: 0
[R3-ospf-1-area-0.0.0.2]display ospf routing
OSPF Process 1 with Router ID 3.3.3.3
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
23.0.0.0/24 1 Transit 23.0.0.3 3.3.3.3 0.0.0.1
34.0.0.0/24 1 Transit 34.0.0.3 3.3.3.3 0.0.0.2
12.0.0.0/24 2 Inter-area 23.0.0.2 2.2.2.2 0.0.0.1
Total Nets: 3
Intra Area: 2 Inter Area: 1 ASE: 0 NSSA: 0
[R4-ospf-1-area-0.0.0.2]dis ospf routing
OSPF Process 1 with Router ID 4.4.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
34.0.0.0/24 1 Transit 34.0.0.4 4.4.4.4 0.0.0.2
Total Nets: 1
Intra Area: 1 Inter Area: 0 ASE: 0 NSSA: 0
在R2 ospf area 1里和R3 ospf area 1里 建立虚链路
[R2-ospf-1-area-0.0.0.1]vlink-peer 3.3.3.3
[R3-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2
//虚链路指定的是对端ABR的Route-id而不是接口ip地址,而且两端必须在同一个区域。
可以使用display ospf vlink命令验证
[R3-ospf-1-area-0.0.0.1]display ospf vlink
OSPF Process 1 with Router ID 3.3.3.3
Virtual Links
Virtual-link Neighbor-id -> 2.2.2.2, Neighbor-State: Full //说明虚链路已经建立起来
Interface: 23.0.0.3 (GigabitEthernet0/0/0)
Cost: 1 State: P-2-P Type: Virtual
Transit Area: 0.0.0.1
Timers: Hello 10 , Dead 40 , Retransmit 5 , Transmit Delay 1
GR State: Normal
在查看一下R4的路由表可以发现,网络中的路由都可以学到
[R4]display ospf routing
OSPF Process 1 with Router ID 4.4.4.4
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
34.0.0.0/24 1 Transit 34.0.0.4 4.4.4.4 0.0.0.2
12.0.0.0/24 3 Inter-area 34.0.0.3 3.3.3.3 0.0.0.2
23.0.0.0/24 2 Inter-area 34.0.0.3 3.3.3.3 0.0.0.2
Total Nets: 3
Intra Area: 1 Inter Area: 2 ASE: 0 NSSA: 0
命令
vlink-peer x.x.x.x //配置虚连接,使用对端Router ID
display ospf vlink //验证虚连接

浙公网安备 33010602011771号