Monday, 3 October 2016

Setting up OSPF Virtual Links

When setting up OSPF it is required that all areas (i.e. ABRs) are connected to the backbone area (0) - in some more complex topologies there might be (planned) areas that do not have a direct link to the backbone area - this is where virtual links come into play - they provide a way for these areas to tunnel through an adjacent area to the backbone area.



In the (simplified) diagram above we can clearly see that although Area 1 has a direct connection to Area 0, Area 2 does not and due to this we will need to create a virtual link.

We should firstly setup OSPF on all three routers:-

Router1>
enable
conf t
hostname Router1

int g0/0
ip address 10.0.0.1 255.255.255.252
no shutdown
ip ospf 1 area 0

int g0/1
ip address 192.168.2.1 255.255.255.0
no shutdown
ip ospf 1 area 0


router ospf 1
router-id 1.1.1.1
network 10.0.0.0 0.0.0.3 area 0
network 192.168.2.0 0.0.0.255 area 0

do wri mem

Router2>
enable
conf t
hostname Router2

int g0/0
ip address 10.0.0.2 255.255.255.252
no shutdown
ip ospf 1 area 0

int g0/1
ip address 10.1.0.1 255.255.255.252
no shutdown
ip ospf 1 area 1

router ospf 1
router-id 2.2.2.2
network 10.1.0.0 0.0.0.3 area 1
network 10.0.0.0 0.0.0.3 area 0

do wri mem

Router3>
enable
conf t
hostname Router3

int g0/0
ip address 10.1.0.2 255.255.255.252
no shutdown
ip ospf 1 area 1

int gi0/1
ip address 192.168.1.1 255.255.255.0
no shutdown
ip ospf 1 area 2

router ospf 1
router-id 3.3.3.3
network 10.1.0.0 0.0.0.3 area 1
network 192.168.1.0 0.0.0.255 area 2

do clear ip ospf pro
do wri mem

At this point you will notice that all routers will be able to see networks within Area 1 and 0 - although as Area 2 has no direct link to Area 0 the networks within this area will not be visible within Router 2 and Router 1's routing table (i.e. the 192.168.1.0/24 network in this case.)

This is where virual links come into play - so for this example we would create the virtual link in Area 1 since this is the intermidatry area between Area 0 and Area 2. Router2 points to Router3 (note we use the router-id and not the router IP address) and visa versa:

Router2>
conf t
router ospf 1
area 1 virtual-link 3.3.3.3

Router3>
conf t
router ospf 1
area 1 virtual-link 2.2.2.2

We should then see something like:

%OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on OSPF_VL0 from LOADING to FULL, Loading Done

Which simply indicates that a new adjacancy has been formed with Area 0 over our virtual link: OSPF_VL0.

We can also confirm the status of the virtual like with:

do show ip ospf virt

Now the new adjacancy has been formed we should now be able to see the 192.168.1.0/24 route in our routers OSPF database / routing table:

do show ip route

0 comments:

Post a Comment