OSPF Virtual-Links are used to extend Area 0 to routers without direct connection to OSPF Area 0.
A diagram will help us to understand this requirement a bit better:
The link between R1 F0/0 and R2 F0/0 belongs to the Backbone Area, or Area 0. The Frame-Relay connection between R2 S0/0 and R3 S0/0 belongs to the OSPF Area 1. As far as R2 has a direct connection to Area 0 (through it´s F0/0 interface) no Virtual-Links are needed.
BUT, for example, if we create a Loopback Interface in R3, and place this Loopback Interface in OSPF Area 2, what will happen?!
R3 doesn´t have any connections to Area 0, it has connections to OSPF Areas 1 and 2, but not Area 0. Check this new diagram including the newly created Loopback Interface in R3:
Hmmm... This situation will require the use of Virtual-Links between R3 and R2 using Area 1 as a "connection" to Area 0. In situations like this, where the router (in our case R3) has two or more interfaces in different areas, and none of those interfaces belongs to Area 0, we´ll need to use an OSPF Virtual-Link.
You may ask yourself: why R3 S0/0 in Area 1 doesn´t need a Virtual-Link connection also?! It´s on the same router as the Area 2 Loopback Interface, so why R3´s Loopback in Area 2 need a Virtual-Link connection, but R3´s S0/0 interface in Area 1 doesn´t?!
The answer is simple, R3 is direct connected to R2 using Area 1, and R2 is connected to Area 0, so it´ll get advertised due to R2 connections! ;)
Without Virtual-Links Area 2 (in this situation) would never get advertised to either R2 and R1!
First, let´s go ahead and configure all routers according to our diagram (except by the Virtual-Links):
R1: int f0/0 R2: int f0/0 R3: interface loopback 2 |
Ok! The above configuration is done, let´s check the OSPF Neighbor Relationship and the IP Routing Tables of our routers:
R1: R1(config)#do sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP Gateway of last resort is not set C 192.168.10.0/24 is directly connected, Ethernet0/0 R1(config)#do sh ip ospf neig Neighbor ID Pri State Dead Time Address Interface ================================================================= R2: R2(config)#do sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP Gateway of last resort is not set C 192.168.10.0/24 is directly connected, Ethernet0/0 R2(config)#do sh ip ospf neig Neighbor ID Pri State Dead Time Address Interface ================================================================= R3:R3#sh ip route Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Loopback2 R3#sh ip ospf neig Neighbor ID Pri State Dead Time Address Interface |
See?! Neither R1 and R2 have the 192.168.12.0/24 Network from Area 2! That´s because R3 is not directly connected to Area 0! To solve that, we´ll need to configure a Virtual-Link between R2 and R3 using Area 1 as a "connection" to Area 0.
The command to do that is: area <area-id> virtual-link <rid of the router in the other end>, for example: R3 will have the following command added to it´s configuration: area 1 virtual-link 2.2.2.2 . The same command (just changing R2´s rid by R3´s rid) needs to be configured in R2. To make things a little bit easier, here follows the configuration:
R2: router ospf 1 area 1 virtual-link 3.3.3.3 R3: router ospf 1 area 1 virtual-link 2.2.2.2 |
Oh yeah! If you´re unsure about the Router ID (rid) of the router, just issue a show ip ospf command and it´ll show you the Router ID, see below:
R3(config)#do sh ip ospf <output omitted> |
Now, with the virtual-link configured between R2 and R3, let´s check again the OSPF Neighbor Relationship and the IP Routing Table of all our three routers:
R1: R1(config)#do sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP Gateway of last resort is not set 192.168.12.0/32 is subnetted, 1 subnets R1(config)#do sh ip ospf neig Neighbor ID Pri State Dead Time Address Interface ================================================================= R2:R2(config-router)#do sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP Gateway of last resort is not set 192.168.12.0/32 is subnetted, 1 subnets R2(config-router)#do sh ip ospf neig Neighbor ID Pri State Dead Time Address Interface ================================================================= R3:R3(config-router)#do sh ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP Gateway of last resort is not set C 192.168.12.0/24 is directly connected, Loopback2 R3(config-router)#do sh ip ospf nei Neighbor ID Pri State Dead Time Address Interface |
AH! Much better! Now ALL routers have ALL OSPF Routes in their IP Routing Tables! Our "hero" Virtual-Link solved our problem!
Another really usefull tip is... sometimes when you issue a show ip ospf virtual-link the output shows that the Virtual-Link is UP, but you see no communication going on, neither a OSPF Relationship established... well... sometimes that happens, to make sure that the Virtual-Link is "really" working, issue a show ip ospf virtual-link command and see if the output is just a portion of what it´s supposed to be (that will indicate a not working virtual-link) or if you have the full output. That can also be a temporary situation (while the link gets up). See the example of a BAD and a GOOD Virtual-Link output:
Virtual-Link with Problems (BAD): R2(config-router)#do sh ip ospf virtual-link ================================================================= Working Virtual-Link (Good):R2(config-router)#do sh ip ospf virtual-link |
To finish, another useful command (not only to Virtual-Links, but to OSPF), is the show ip ospf interface brief. This command will show you a brief of all OSPF configured interfaces, with some other nice things to know!
R2#sh ip ospf interface brief |
Seens a bit easier now, don´t you think?! :) I do!
No comments:
Post a Comment