Sunday, April 27, 2014

OSPF Transit Capability

OK, a new feature introduced in OSPFv2 and back to RFC 2328 section 16.3 is the following:

16.3.  Examining transit areas' summary-LSAs

This step is only performed by area border routers attached to one or more non-backbone areas that are capable of carrying
transit traffic (i.e., "transit areas", or those areas whose
TransitCapability parameter has been set to TRUE in Step 2 of
the Dijkstra algorithm (see Section 16.1).

The purpose of the calculation below is to examine the transit
areas to see whether they provide any better (shorter) paths
than the paths previously calculated in Sections 16.1 and 16.2.
Any paths found that are better than or equal to previously
discovered paths are installed in the routing table.

The calculation also determines the actual next hop(s) for those
destinations whose next hop was calculated as a virtual link in
Sections 16.1 and 16.2.  After completion of the calculation
below, any paths calculated in Sections 16.1 and 16.2 that still
have unresolved virtual next hops should be discarded.

so what does it mean in Plain English?!!



OSPF prefers path according to the following rules:

1-Intra Area Routes (O)
2-Inter Area Routes (O IA)
3-External type 1 (E1)
4-External type 2 (E2)
5-NSSA type 1 (N1)
6-NSSA type 2 (N2)

This Behaviour Cannot be modified with metric or distance.

The traffic between the areas should take a path through the backbone area (area 0). However, OSPFv2 allows to use non-backbone area as a transit area in case the cost is better since the flag called the 'transit capability' is set to TRUE now.

I will demonstrate this feature using 4 routers this time, R1 in Area 0, R2 and R3 are ABRs between Area 0 and Area 1, R4 is in Area1 and it has loopback0 interface in area 2 , also this virtual-link between R4 and R2 to connect Area2 to Area0 as the following:





R1:

R1#sh ip int br | ex una
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.0.0.1        YES manual up                    up
FastEthernet0/1            13.0.0.1        YES manual up                    up
Loopback0                  1.1.1.1         YES manual up                    up

R1#sh run | se router os
router ospf 1
 router-id 1.1.1.1
 network 0.0.0.0 255.255.255.255 area 0


R2:

R2#sh ip int br | ex una
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            12.0.0.2        YES manual up                    up
FastEthernet0/1            24.0.0.2        YES manual up                    up

R2#sh run | se router os
router ospf 1
 router-id 2.2.2.2
 area 1 virtual-link 4.4.4.4
 network 12.0.0.2 0.0.0.0 area 0
 network 24.0.0.2 0.0.0.0 area 1


R3:

R3#sh ip int br | ex una
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            34.0.0.3        YES manual up                    up
FastEthernet0/1            13.0.0.3        YES manual up                    up


R3#sh run | se router os
router ospf 1
 router-id 3.3.3.3
 network 13.0.0.3 0.0.0.0 area 0
 network 34.0.0.3 0.0.0.0 area 1


R4:

R4#sh ip int br | ex una
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            34.0.0.4        YES manual up                    up
FastEthernet0/1            24.0.0.4        YES manual up                    up
Loopback0                  44.44.44.44     YES manual up                    up


R4#sh run | se router os
router ospf 1
 router-id 4.4.4.4
 area 1 virtual-link 2.2.2.2
 network 24.0.0.4 0.0.0.0 area 1
 network 34.0.0.4 0.0.0.0 area 1
 network 44.44.44.44 0.0.0.0 area 2



Now if we go for R4 which is an ABR between Area1 and Area2 and search for R1's loopback in OSPF Database to see its path:


R4#sh ip os database

            OSPF Router with ID (4.4.4.4) (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         17    (DNA) 0x80000005 0x008942 3
2.2.2.2         2.2.2.2         1     (DNA) 0x80000006 0x0035A6 2
3.3.3.3         3.3.3.3         3     (DNA) 0x80000004 0x0023D5 1
4.4.4.4         4.4.4.4         1912        0x80000006 0x00578F 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
12.0.0.1        1.1.1.1         17    (DNA) 0x80000001 0x0061BB
13.0.0.1        1.1.1.1         2     (DNA) 0x80000001 0x008691

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
24.0.0.0        2.2.2.2         6     (DNA) 0x80000001 0x001EFD
24.0.0.0        3.3.3.3         3     (DNA) 0x80000001 0x000A0D
24.0.0.0        4.4.4.4         1922        0x80000002 0x00DF33
34.0.0.0        2.2.2.2         6     (DNA) 0x80000001 0x00A56B
34.0.0.0        3.3.3.3         3     (DNA) 0x80000001 0x007D90
34.0.0.0        4.4.4.4         1922        0x80000002 0x005DAB
44.44.44.44     4.4.4.4         918         0x80000001 0x002B50

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         2.2.2.2         1913        0x80000005 0x005093 1
3.3.3.3         3.3.3.3         134         0x80000004 0x00BC0F 1
4.4.4.4         4.4.4.4         1461        0x8000000B 0x00A3CB 2

                Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
24.0.0.4        4.4.4.4         1927        0x80000001 0x00B243
34.0.0.4        4.4.4.4         145         0x80000002 0x006086

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
1.1.1.1         3.3.3.3         134         0x80000002 0x001317
12.0.0.0        3.3.3.3         134         0x80000002 0x00A47D
13.0.0.0        3.3.3.3         134         0x80000002 0x008D94
44.44.44.44     4.4.4.4         918         0x80000001 0x002B50

                Router Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum Link count
4.4.4.4         4.4.4.4         923         0x80000002 0x00A8B6 1

                Summary Net Link States (Area 2)

Link ID         ADV Router      Age         Seq#       Checksum
1.1.1.1         4.4.4.4         935         0x80000002 0x00FE26
12.0.0.0        4.4.4.4         940         0x80000001 0x00928B
13.0.0.0        4.4.4.4         940         0x80000001 0x007BA2
24.0.0.0        4.4.4.4         940         0x80000001 0x00E132
34.0.0.0        4.4.4.4         940         0x80000001 0x005FAA

Now Because I'm connected to Area0 (Thanks to OSPF Virtual-link) I'm learning both prefix (1.1.1.1/32) from R1 as (Intra-Area Route) via Virtual-link through R2 and from R3 as (Inter-Area Routes), so according to our Rules i should prefer Intra-Area Route (O) over Inter-Area Routes (O IA) so this means i should go from 
R4->R2->R1, let's test :

R4#traceroute 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 34.0.0.3 56 msec 68 msec 60 msec
  2 13.0.0.1 100 msec *  84 msec

Oops, it goes for the other direction to R3!!, so let's see the interfaces cost:

R1#sh ip os int lo0 | in Cost
  Process ID 1, Router ID 1.1.1.1, Network Type LOOPBACK, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name


R2#sh ip os int fa0/0 | in Cost
  Process ID 1, Router ID 2.2.2.2, Network Type BROADCAST, Cost: 999
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name

R3#sh ip os int fa0/1 | in Cost
  Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name

R4#sh ip os int fa0/1 | in Cost
  Process ID 1, Router ID 4.4.4.4, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name

R4#sh ip os int fa0/0 | in Cost
  Process ID 1, Router ID 4.4.4.4, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name

So if i go R4->R2->R1 = (1+999+1) = 1001
and for  R4->R3->R1 = (1+1+1) = 3

and here come the benefit for OSPF Transit Capability which is ON  by-default which says allows to use non-backbone area (Area1 in this Case) as a transit area in case the cost is better,so if we want to revert back to the original behavior which says The traffic between the areas should take a path through the backbone area (area 0) I simply turn this feature off.

R2(config)#router os 1
R2(config-router)#no capability transit

R4(config)#router os 1
R4(config-router)#no capability transit
R4(config-router)#do trace 1.1.1.1
Type escape sequence to abort.
Tracing the route to 1.1.1.1
VRF info: (vrf in name/id, vrf out name/id)
  1 24.0.0.2 132 msec 44 msec 52 msec
  2 12.0.0.1 92 msec *  68 msec


The Path goes towards R2 although it has a higher metric to the destination.

R4(config-router)#do sh ip route 1.1.1.1
Routing entry for 1.1.1.1/32
  Known via "ospf 1", distance 110, metric 1001, type intra area
  Last update from 24.0.0.2 on FastEthernet0/1, 00:03:18 ago
  Routing Descriptor Blocks:
  * 24.0.0.2, from 1.1.1.1, 00:03:18 ago, via FastEthernet0/1
      Route metric is 1001, traffic share count is 1


No comments:

Post a Comment