OSPF Virtual Link

By | April 26, 2012

In OSPF everything has to connect to the backbone area with is area 0. So if we had a situation where we had 3 areas, area 0, area 1 and area 2 and area 2 was connected to area 1 and not directly connected to area 0 then we would have a problem. This is where Virtual links come in. Virtual links create a link to area 0 so that the area not connected to area 0 now has a link there.

If there was an event where you could not you use virtual link how can we do the same thing without using a virtual link. This is where we can implement a GRE tunnel as a virtual link.

This is our network diagram.

We need to create a GRE tunnel form R1 to R2. We will know if we have been successful if  we have OSFP routes in R3’s routing table.

Now we need to configure OSPF on all the routers. In this example I will focus on R2 and R1’s configuration

R1

!
interface Serial0/0
 ip address 172.16.10.1 255.255.255.252
!
!
router ospf 1
 router-id 1.1.1.1
 network 86.188.188.0 0.0.0.255 area 0 (connection to R4)
 network 172.16.10.0 0.0.0.3 area 1   (connection to R2)
!

R2

!
interface Serial0/0
 ip address 172.16.10.2 255.255.255.252
!
!
router ospf 1
 router-id 2.2.2.2
 network 10.10.10.0 0.0.0.3 area 2  (connection to R3)
 network 172.16.10.0 0.0.0.3 area 1 (connection to R1)
!

Now we have configured OSPF on all our routers lets have a look at the routing table on R3

We can see that we have no OSPF routes in our routing table. Lets now make sure we are running OSPF on R3.

We can see we are runing OSPF process 1 on our router. Our ID is 3.3.3.3. Lets check our neighbor.

we can see we have one neighbor. now lets check if we can ping that neighbor

We can see we can ping our neighbor. now lets configure the GRE tunnel on R2 and R1.

R1

!
interface Tunnel2
 ip address 192.168.2.2 255.255.255.252
 ip ospf 1 area 0 (Defining this tunnel as area 0)
 tunnel source Serial0/0  (The interface that connects to R2)
 tunnel destination 172.16.10.2 (The source IP address of R2)
!

R2

!
interface Tunnel2
 ip address 192.168.2.1 255.255.255.252
 ip ospf 1 area 0 (Defining this tunnel as area 0)
 tunnel source Serial0/0    (The interface that connects to R1)
 tunnel destination 172.16.10.1(The source IP address of R1)
!

Now lets take a look at R2 “show ip interface brief”

We can see interface Tunnel2 is up and we have an ip address for it. Let have a look at R2 neighbor’s

We can see we have 2 neighbor relationship with router 1.1.1.1 on serial 0/0 and on our tunnel interface. So lets have a look at R3’s routing table and see if we now have OSFP routes

Ahh we now have OSPF inter area routes. Just to make sure everything is working lets try a ping to R4.

We have now successfully used a GRE tunnel as a virtual link.