How to configure OSPF Virtual Link

If you studied Cisco’s CCNA you have learned that when you use OSPF all the areas have to be directly connected to the backbone area. Is this really true? Areas have to be connected to the backbone area but if they aren’t we can fix it with a virtual link.



Let me show you an example:

ospf discontinuous area

Look at my picture above. We have three areas and on the left side is area 0. Area 2 is behind area 1. Normally this is not going to work since area 2 has to be directly connected to area 0. We can make this work by using a virtual link. By using a virtual link we can extend area 0 through area 1 so area 2 will be “directly connected” to area 0. Let’s take a look at how a virtual link can solve this problem:

ospf virtual link

This is basically how a virtual link works. It’s like a tunnel through area 1 to reach area 2. This way area 2 will be directly connected. Now let me show you how to configure a virtual link:

OSPF virtual link topology

In the example above area 2 is not directly connected to area 0 so we’ll have to use a virtual link between router Nancy and Donna, here’s how we do it:

Nancy(config)#router ospf 1
Nancy(config-router)#network 1.1.1.0 0.0.0.255 area 0
Nancy(config-router)#network 192.168.12.0 0.0.0.255 area 1 
Donna(config)#router ospf 1
Donna(config-router)#network 192.168.12.0 0.0.0.255 area 1
Donna(config-router)#network 192.168.23.0 0.0.0.255 area 2
Susan(config)#router ospf 1
Susan(config-router)#network 192.168.23.0 0.0.0.255 area 2

I’ll start with a default OSPF configuration.

Nancy(config)#router ospf 1
Nancy(config-router)#area 1 virtual-link 192.168.23.2
Donna(config)#router ospf 1
Donna(config-router)#area 1 virtual-link 1.1.1.1

We configure the virtual-link between ABRs and we use the area virtual-link command. First you need to specify the area 1 where we need the virtual-link which is area 1 in my example. Second step is to configure the OSPF router ID of the other ABR. Keep this in mind…you need to configure the OSPF router ID and NOT the IP address of the ABR. If everything is OK area 2 will have be directly connected to area 0 through our virtual-link.

Nancy# %OSPF-5-ADJCHG  Process 1, Nbr 192.168.23.2 on OSPF_VL0 from LOADING to FULL, Loading Done
Donna# %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on OSPF_VL0 from LOADING to FULL, Loading Done

You will see the message above that tells us the virtual link is established.

Nancy#show ip ospf virtual-links 
Virtual Link OSPF_VL0 to router 192.168.23.2 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface FastEthernet0/0, Cost of using 1
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:06
    Adjacency State FULL (Hello suppressed)
    Index 1/2, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec
Donna#show ip ospf virtual-links 
Virtual Link OSPF_VL0 to router 1.1.1.1 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface FastEthernet0/0, Cost of using 1
  Transmit Delay is 1 sec, State POINT_TO_POINT,
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    Hello due in 00:00:05
    Adjacency State FULL (Hello suppressed)
    Index 1/3, retransmission queue length 0, number of retransmission 0
    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)
    Last retransmission scan length is 0, maximum is 0
    Last retransmission scan time is 0 msec, maximum is 0 msec

You can use the show ip ospf virtual-links command to check if your virtual-link is working.

Nancy#show ip ospf database 

            OSPF Router with ID (1.1.1.1) (Process ID 1)

		Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         189         0x80000004 0x00E333 2
192.168.23.2    192.168.23.2    1     (DNA) 0x80000002 0x009816 1
Donna#show ip ospf database 

            OSPF Router with ID (192.168.23.2) (Process ID 1)

		Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         1     (DNA) 0x80000004 0x00E333 2
192.168.23.2    192.168.23.2    159         0x80000002 0x009816 1

If you look at the LSDB you will see that the virtual-link shows up as a type 1 router LSA. You can also see DNA which means do not age.

Any other situation where we need a virtual-link? What about a discontinuous backbone area? Let me show you an example:

Full content of this lesson is only available to NetworkLessons.com members.

Click the button below to join today and learn any networking topic you like!

Join NetworkLessons today


Digiprove sealCopyright protected by Digiprove © 2013 Rene Molenaar

Tags: , , ,

16 Responses to “How to configure OSPF Virtual Link”

  1. Vinod Agrahari August 14, 2013 at 7:17 pm #

    Rene ! this is really grt !

  2. Celso November 3, 2013 at 10:42 am #

    Hi, thank you very much for this very easy to understand explanation. Great job rene.

  3. Jurati Fundikira December 21, 2013 at 10:08 pm #

    Is it possible to build a virtual link over frame-relay link ? for example in the diagram above if the router in between was a frame-relay switch

    • Rene Molenaar January 14, 2014 at 7:01 pm #

      Hi Jurati,

      Yes this is possible, when your OSPF neighbor adjacency is working over the frame relay link you should be able to configure a virtual link.

      Rene

  4. Nitin January 21, 2014 at 7:57 pm #

    Hi Rene , according to OSPF ” RID is highest IP of loopback interface or software interfaces which are active when OSPF routers start up ,in absence of software/loopback interfaces RID is the highest IP of the active interfaces when OSPF starts ”

    in this example RID for router Nancy is 1.1.1.1 since it’s the loopback interface for that area

    How come RID for router Susan is 192.168.23.3 , for router Susan It’s RID should be of it’s loopback interface 3.3.3.1

    here why does router selects RID as 192168.23.3 since loopback interface is also present in that area .

    • Rene Molenaar January 23, 2014 at 9:15 pm #

      Hi Nitin,

      What you say is correct. The thing with the OSPF router ID however is that it’s non preemptive which means that once it has selected an ID, it will not change it unless you reboot the router or reset the OSPF process. In this example, I probably configure OSPF before adding some of the loopback interfaces. Hope that helps.

      Rene

  5. Nick February 14, 2014 at 2:22 pm #

    Another bit of information: OSPF VLs cannot be constructed if the interface from which the VL would recurse, on either end, is unnumbered. In the first example the Nancy Fa0/0 and Donna Fa0/0 would have to have real IP addresses on them. However, OSPF VLs can transit unnumbered interfaces if those links are in the middle of the area. If area 1 were much larger, and some of the intermediary links were unnumbered, that would work fine. Reason is because although OSPF VLs behave like demand circuits, initially they send unicast hellos between exit interfaces and this must have a real IP address.

  6. chandan February 28, 2014 at 10:22 am #

    Hi Rene,

    I configured Discontiguous area 0 for virtual links,by default if we enable loopback interface on the router,it takes loop back interface., i.e 3.3.3.1 as the router ID and one more thing with lab,i get error message like mismatch in the area ID,before I configure a virtual link between router Nancy and Susan.

    This lab dint work the way its show in the figure.Need your help in this rene.

  7. Apostolis September 5, 2014 at 5:15 pm #

    Hi Rene
    Is it possible for VL’s to be used over different AS? In your example, instead of OSPF area 1, could there be a network running i.e. EIGRP (Nancy and Donna would be ASBR’s), so OSPF area 2 would be directly connected to OSPF area 0 passing through a different AS? If for any reason areas 0 and 2 should belong to the same AS (let’s say after consolidation of two companies, one running only OSPF and the other running both EIGRP and OSPF), could we use VL’s instead of redistribution?

    • Rene Molenaar September 9, 2014 at 7:47 pm #

      Hi Apostolis,

      The virtual link is a OSPF-only feature. Also keep in mind that it doesn’t work with AS numbers, only EIGRP (and BGP) work with AS numbers.

      You could make it work with a GRE tunnel though. If you run EIGRP on the 192.168.12.0 /24 instead of OSPF then you can create a GRE tunnel between Nancy / Donna and connect the two distance OSPF areas with that.

      Rene

  8. J.A.III September 11, 2014 at 12:39 pm #

    Is possible to use virtual links within the same area?

    • Rene Molenaar September 11, 2014 at 1:01 pm #

      You probably could configure a virtual link between two routers in the same area but there’s no point in doing so :)

  9. Lee September 19, 2014 at 4:49 am #

    Rene

    Is it possible for a virtual link to transit two areas?

    For instance, there are areas 0, 1, 2, and 3.

    How to create a virtual link that connects area 1 and area 3 together?

    Thank you for your detailed explanation!

    Lee

    • Rene Molenaar September 19, 2014 at 5:45 pm #

      Hi Lee,

      It’s possible but you have to do it in steps.

      First create a virtual link between Area 0 and Area 1 so you can reach Area 2. Then you can configure another one from Area 2 to Area 3.

      Rene

  10. Masoud October 18, 2014 at 10:00 am #

    Hi Rene
    Thank You Very Much…

Leave a Reply