OSPF Virtual Links

1
85

In an OSPF network, usually all areas need to be connected to the backbone area, area 0. There is a way around this though. Take a look at the topology above. Area 0 is the backbone, with area 1 connected off of that. Then, hanging off of area 1 is area 2. You may run into a situation like this when merging two networks for instance. Normally this would not work as you’ll see in the beginning of the lab, but there is a solution – OSPF virtual links.

VIRL Lab download available at the end of the post.

Configuration

This lab assumes that the topology is configured in the following manner. R1 has a loopback of 1.1.1.1, R2 has a loopback of 2.2.2.2, and so on. All routers are configured with the OSPF process of 1 and the areas set per the diagram.

If we do a “show ip route” on rotuer 1, we will see what we can currently communicate with via OSPF:

R1#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR
 
Gateway of last resort is not set
 
      1.0.0.0/32 is subnetted, 1 subnets
C        1.1.1.1 is directly connected, Loopback0
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 10.0.0.2, 00:00:02, GigabitEthernet0/1
      3.0.0.0/32 is subnetted, 1 subnets
O IA     3.3.3.3 [110/3] via 10.0.0.2, 00:00:02, GigabitEthernet0/1
      10.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C        10.0.0.0/30 is directly connected, GigabitEthernet0/1
L        10.0.0.1/32 is directly connected, GigabitEthernet0/1
O IA     10.0.0.4/30 [110/2] via 10.0.0.2, 00:00:02, GigabitEthernet0/1
R1#

What we can see there is that we can see all of area 0 and area 1, but nothing from area 2. As seen in the VIRL config, the loopback on R3 is advertised into area 1, hence why we can see it.

So why arean’t we seeing 4.4.4.4 advertised to R1? The reason is because area 2 is not connected to area 0 (backbone) in any way. It is only connected to area 1. With no connection to the backbone, OSPF routes won’t be shared to area 0. That is where OSPF virtual links come in. The OSPF virtual link is configured between R2 and R3, thus making a virtual link between area 0 and area 2.

First, I start with R2:

R2(config)#router ospf 1
R2(config-router)#area 1 virtual-link 3.3.3.3

Next is R3:

R3(config)#router ospf 1
R3(config-router)#area 1 virtual-link 2.2.2.2

You can immediately see the result via the log messages on both routers 2 and 3:

*Jul  7 00:14:00.658: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on OSPF_VL0 from LOADING to FULL, Loading Done

That is our message that the OSPF virtual link is working correctly. Now let’s go back to R1 and see what we get from that “show ip route” now:

R1#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR
 
Gateway of last resort is not set
 
      1.0.0.0/32 is subnetted, 1 subnets
C        1.1.1.1 is directly connected, Loopback0
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 10.0.0.2, 00:07:46, GigabitEthernet0/1
      3.0.0.0/32 is subnetted, 1 subnets
O IA     3.3.3.3 [110/3] via 10.0.0.2, 00:02:41, GigabitEthernet0/1
      4.0.0.0/32 is subnetted, 1 subnets
O IA     4.4.4.4 [110/4] via 10.0.0.2, 00:02:41, GigabitEthernet0/1
      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
C        10.0.0.0/30 is directly connected, GigabitEthernet0/1
L        10.0.0.1/32 is directly connected, GigabitEthernet0/1
O IA     10.0.0.4/30 [110/2] via 10.0.0.2, 00:07:46, GigabitEthernet0/1
O IA     10.0.0.8/30 [110/3] via 10.0.0.2, 00:02:41, GigabitEthernet0/1
R1#

Good to go!, by creating the OSPF virtual link between area 2 and area 0, they are able to communicate and share routes accordingly.

Go ahead and download the .virl topology and give it a try yourself. The topology is in a completed state in case you just want to see it in action.


To Download the VIRL lab used in this post, use the following link:

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.