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:

ospf discontinuous backbonearea

Imagine the router on top was in area 0. Unfortunately this router crashed and the result is that area 0 is now split in two pieces. We call this a Discontiguous area 0. We can use a virtual-link through area 1 to solve this problem. Let me show you how to fix this problem. This is the topoloy that we will use:

ospf virtual link lab

The topology above has a broken area 0. We’ll configure a virtual link between router Nancy and Susan to fix 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 1
Susan(config)#router ospf 1
Susan(config-router)#network 192.168.23.0 0.0.0.255 area 1
Susan(config-router)#network 3.3.3.0 0.0.0.255 area 0

First I’ll advertise all the networks, nothing special here.

Nancy#show ip ospf | include ID
 Routing Process "ospf 1" with ID 1.1.1.1

Susan#show ip ospf | include ID
 Routing Process "ospf 1" with ID 192.168.23.3

I need to configure a virtual link between router Nancy and Susan and I’ll need to use the router IDs for this.

Nancy(config)#router ospf 1
Nancy(config-router)#area 1 virtual-link 192.168.23.3
Susan(config)#router ospf 1
Susan(config-router)#area 1 virtual-link 1.1.1.1

This is how we do it.

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

The configuration is the same as my previous example. Just make sure to configure the area you have to get through and the OSPF router ID of the other ABR.


Nancy#show ip ospf virtual-links 
Virtual Link OSPF_VL1 to router 192.168.23.3 is up
  Run as demand circuit
  DoNotAge LSA allowed.
  Transit area 1, via interface FastEthernet0/0, Cost of using 2
  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:04
    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
Susan#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 2
  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:07
    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

This is how we can verify if the virtual link is up and running.

Nancy#show ip route  ospf | include 3.3.3.3
     3.0.0.0/32 is subnetted, 1 subnets
O       3.3.3.3 [110/3] via 192.168.12.2, 00:05:13, FastEthernet0/0
Susan#show ip route ospf | include 1.1.1.1
O       1.1.1.1 [110/3] via 192.168.23.2, 00:05:52, FastEthernet0/0

We can also verify that 1.1.1.1 and 3.3.3.3 show up as intra-area prefixes on router Nancy and Susan. This is because area 0 is extended through area 1.

Something many CCNP students forget is that you need to use the router ID for the virtual-link, not the IP address of your OSPF neighbor.

That’s all I have for you on virtual links. I hope this has been helpful to you to understand OSPF virtual links. If you have any questions feel free to ask!

Opt In Image
Studying for CCNP ROUTE?

Receive my free tips & tutorials for the exam - start learning today!

Digiprove sealCopyright protected by Digiprove © 2013 Rene Molenaar

Tags: , , ,

9 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.

Leave a Reply

Close