How to configure OSPF Virtual Links

Created by Yuriy Andamasov, Modified on Thu, 11 Jan at 4:31 PM by Srividya Anantapatnaikuni

Article review date
2024-01-05
Validated for VyOS versions
1.3.5

Introduction:

OSPF protocol requires all areas to be directly connected to the backbone area (area 0). However, it is not always possible to have a physical link to a backbone area. In this case, you can use a virtual link to connect to the backbone through a non-backbone area.  The area through which you configure the virtual link, is called a transit area, which must have all the routing information.  

Keep in mind that this is typically a far more complex design consideration when applied to a real-world network. At least one end of a virtual link must be terminated on a backbone (area 0) router.

The below topology has three areas (area 0, 1, 2) and area 0 and 2 are not directly connected to each other. In order to reach each other, virtual link is configured for area 1


We configure the virtual-link between ABRs by referencing the peer router's RID(Router ID), not an IP address. Here, we need to configure the virtual links on R1 and R2 for Area 1 which will help the Area 2 to be directly connected to Area 0.

Configuration:

R1:

set protocols ospf area 0 network '10.118.1.0/24'
set protocols ospf area 1 network '192.168.0.0/30'
set protocols ospf area 1 virtual-link 2.2.2.2
set protocols ospf log-adjacency-changes
set protocols ospf parameters router-id '1.1.1.1'

R2:

set protocols ospf area 1 network '192.168.0.0/30'
set protocols ospf area 1 virtual-link 1.1.1.1
set protocols ospf area 2 network '10.1.3.0/24'
set protocols ospf log-adjacency-changes
set protocols ospf parameters router-id '2.2.2.2'

R3:

set protocols ospf area 2 network '10.1.3.0/24'
set protocols ospf parameters router-id '3.3.3.3'
set protocols ospf log-adjacency-changes

Verification:

R1:

Log: vyos ospfd[777]: AdjChg: Nbr 2.2.2.2(default) on VLINK0: Loading -> Full (LoadingDone)

vyos@R1:~$ show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface L
2.2.2.2 1 Full/DR 30.303s 192.168.0.2 eth0:192.168.0.1 0
2.2.2.2 1 Full/DROther 30.508s 192.168.0.2 VLINK0 0
4.4.4.4 1 Full/DR 30.557s 10.118.1.2 eth1:10.118.1.1 0

vyos@R1:~$ show ip ospf interface
VLINK0 is up
ifindex 0, MTU 1500 bytes, BW 0 Mbit
Internet Address 192.168.0.1/30, Peer 192.168.0.2, Area 0.0.0.0
MTU mismatch detection: enabled
Router ID 1.1.1.1, Network Type VIRTUALLINK, Cost: 1
Transmit Delay is 1 sec, State Point-To-Point, Priority 1
No backup designated router on this network
Multicast group memberships:
Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
Hello due in 3.994s
Neighbor Count is 1, Adjacent neighbor count is 1

vyos@R1:~$ show ip route
C>* 1.1.1.1/32 is directly connected, lo, 09:29:23
O>* 10.1.3.0/24 [110/2] via 192.168.0.2, eth0, weight 1, 09:28:42
* via 192.168.0.2, eth1 inactive, weight 1, 09:28:42
O 10.118.1.0/24 [110/1] is directly connected, eth1, weight 1, 09:29:19
C>* 10.118.1.0/24 is directly connected, eth1, 09:29:23
O 192.168.0.0/30 [110/1] is directly connected, eth0, weight 1, 09:29:19
C>* 192.168.0.0/30 is directly connected, eth0, 09:29:22

 R2:

Log: ospfd[775]: AdjChg: Nbr 1.1.1.1(default) on VLINK0: Loading -> Full (LoadingDone)

vyos@R2:~$ show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface L
3.3.3.3 1 Full/DR 39.287s 10.1.3.2 eth1:10.1.3.1 0
1.1.1.1 1 Full/Backup 33.257s 192.168.0.1 eth0:192.168.0.2 0
1.1.1.1 1 Full/DROther 36.944s 192.168.0.1 VLINK0 0

vyos@R2:~$ show ip ospf interface
VLINK0 is up
ifindex 0, MTU 1500 bytes, BW 0 Mbit
Internet Address 192.168.0.2/30, Peer 192.168.0.1, Area 0.0.0.0
MTU mismatch detection: enabled
Router ID 2.2.2.2, Network Type VIRTUALLINK, Cost: 1
Transmit Delay is 1 sec, State Point-To-Point, Priority 1
No backup designated router on this network
Multicast group memberships:
Timer intervals configured, Hello 10s, Dead 40s, Wait 40s, Retransmit 5
Hello due in 6.847s
Neighbor Count is 1, Adjacent neighbor count is 1

vyos@R2:~$ show ip route
C>* 2.2.2.2/32 is directly connected, lo, 09:32:26
O 10.1.3.0/24 [110/1] is directly connected, eth1, weight 1, 09:32:22
C>* 10.1.3.0/24 is directly connected, eth1, 09:32:26
O>* 10.118.1.0/24 [110/2] via 192.168.0.1, eth0, weight 1, 09:30:12
via 192.168.0.1, eth0, weight 1, 09:30:12
O 192.168.0.0/30 [110/1] is directly connected, eth0, weight 1, 09:31:05
C>* 192.168.0.0/30 is directly connected, eth0, 09:32:25

R3:

vyos@R3:~$ show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface RXmtL RqstL DBsmL
2.2.2.2 1 Full/Backup 34.684s 10.1.3.1 eth1:10.1.3.2 0 0 0

vyos@R3:~$ show ip route

C>* 3.3.3.3/32 is directly connected, lo, 10:09:44
O 10.1.3.0/24 [110/1] is directly connected, eth1, 10:09:43
C>* 10.1.3.0/24 is directly connected, eth1, 10:09:43
O>* 10.118.1.0/24 [110/3] via 10.1.3.1, eth1, 09:26:47
O>* 192.168.0.0/30 [110/2] via 10.1.3.1, eth1, 09:27:07


Attachments (1)

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article