July 8, 2023

The OSPF Virtual Link

4 min read

The golden rule in designing an OSPF network is to have all the areas physically connected to the backbone area. No matter how many areas you want to have, they should be connected to the Area 0. This is the OSPF design and as what I’ve been saying since my previous posts, we cannot argue with how it is designed. The one who designed this have worked on this and tested this a lot of times. There are many trial and errors before this was officially brought to the public. I’ve been told that this is to prevent routing loops. Routers can exchange routes to all networks and if they are divided into areas, they cannot see others routes beyond their area and this would make them vulnerable to routing loops. I haven’t tried this kind of scenario on the lab that will show that routing loops occur when you don’t connect the areas to Area 0. One thing that I’ve tried is when you don’t connect an area directly to area 0, routes will not be learned by other routers in the other areas.

So here’s the Virtual Link. Virtual link is the solution to fix this broken OSPF design. You don’t need to physically interconnect an area but a logical connection in between a router connected to Area 0 and to a router connected to an Area not connected to Area 0. Confuse? Yeah, it is really hard when you just read it. Without digging deeper, as the name implies, it’s a virtual link. So let’s try to lab it!

OSPF Virtual Link

There are 3 areas in this lab: area 0, area 20 and area 200. As per OSPF golden rule, areas should all be connected to area 0. On this diagram, area 20 comply with this rule while area 200 does not.

I have configured the basic OSPF configuration connectivity for Tianjin, Danyang, and BangNa routers. Pings are successful except for loopback200 – 203 because I haven’t added the said area.

Tianjin: ping result
Danyang: ping result
BangNa: ping result
BangNa#conf t
 Enter configuration commands, one per line. End with CNTL/Z.
 BangNa(config)#router ospf 3
 BangNa(config-router)#network 192.168.200.0 0.0.3.255 area 200
 BangNa(config-router)#exit
 BangNa(config)#int lo3
 BangNa(config-if)#ip ospf network point-to-point
 BangNa(config)#int range lo200 - 203
 BangNa(config-if-range)#ip ospf network point-to-point
BangNa: show ip route

Now that area 200 has been added to BangNa router and since it is not connected to area 0 but connected to area 20, this what happens:

Danyang to BangNa ping result
Danyang: show ip route

Danyang doesn’t know how to go to the 192.168.200.1 because it is not on its routing table. This is what I’m talking about earlier, if it is not connected to area 0 then they will not exchange routes for that area. There are no area 200 routes on the ABR so to fix this let’s use a virtual link.

Before using a virtual link, you must know the router IDs. I did not hardcoded the router ID so let’s make use of show ip ospf, show ip protocols, or show ip ospf interface to know the router IDs.

BangNa router ID: show ip ospf
Danyang router ID: show ip protocols

Looking at Danyang router, it’s router ID is 172.16.2.1 while BangNa has router ID of 192.168.203.1. When I first learned about the virtual link, I thought we could just make use of loopback IP and should be active and configured. I’m wrong. The physical IP address is also allowed and even the IP is not active nor configured on any interface as long as it is configured as router ID, it should work.

BangNa(config)#router ospf 3
BangNa(config-router)#area 20 virtual-link 172.16.2.1
BangNa(config-router)#
*Oct 19 15:50:43.235: %OSPF-5-ADJCHG: Process 3, Nbr 172.16.2.1 on OSPF_VL0 from LOADING to FULL, Loading Done
BangNa(config-router)#end
BangNa#
*Oct 19 15:50:53.675: %SYS-5-CONFIG_I: Configured from console by console
BangNa#conf t
Enter configuration commands, one per line. End with CNTL/Z.
BangNa(config)#router ospf 3
BangNa(config-router)#router-id 192.168.204.1

I changed my BangNa router ID from 192.168.203.1 to 192.168.204.1.

Danyang: show ip route and show ip ospf neighbor
BangNa: show ip ospf neighbor

There are two same router IDs on both BangNa and Danyang routers. One is for the area 20 and the other one for the virtual link as indicated with “OSPF_VL” interface. You can also check it via “show ip ospf interface.”

BangNa: show ip ospf interface

BangNa’s router ID, 192.168.204.1, is configured as point-to-point and virtual link network type.

Same goes with Danyang.

Amazing right? Now that there is virtual link configured, area 200 is somehow logically connected to area 0. Danyang and Tianjin can now ping routers from this area.

(Sigh) Virtual link is such a remedy on broken OSPF design. I was just thinking that if love has this kind of technology, there will be no broken hearts in the world.

Leave a Reply