Tuesday, April 3, 2012

The OSPF Stub Area

The Open Shortest Path First routing protocol is a critical piece of knowledge for any networking professional working in an enterprise environment. Most major networking certifications covering routing and switching including the Cisco Certified Network Associate (CCNA), Cisco Certified Network Professional (CCNP), and Cisco Certified Internetwork Expert (CCIE) extensively test OSPF knowledge and skills. OSPF is the most popular dynamic routing protocol used in complex enterprise networks. This post will describe some of the important aspects of the OSPF Stub Area as it exists in the Cisco IOS implementation of the OSPF routing protocol. This OSPF lab is built in Dynamips/GNS3 utilizing Cisco c3725 routers.

The OSPF implementation in Cisco IOS recognizes 5 main classifications of areas:
The descriptions of networks in the RFCs for OSPF are classified between what are called "transit" and "stub" networks. Transit networks differ from stub networks in that they can carry traffic which is neither locally originated nor locally destined. Areas follow the same idea, but more on a scale of breaking a network into smaller pieces containing multiple networks (defined from a layer 3 perspective).

From an OSPF design perspective, areas represent sections of the enterprise network where it is advantageous for all of the routers in an area to have detailed topology information and have the ability to make detailed routing decisions involving the shortest path to a destination (as calculated by Djikstra's algorithm). For stub areas, this isn't typically necessary because the networks outside of the stub area are reachable by 1-2 equal cost paths and are easily represented by a default route within the stub area. Stub areas automatically filter type 5 (external) LSAs and optionally filter type 3 (summary) LSAs depending on whether the totally stubby option is chosen. The only traffic flowing into a stub area is the traffic that is either locally originated or destined for that particular area.

The following topology creates a backbone area and a stub area for further consideration:



The autonomous system border router (ASBR) in the topology redistributes connected subnets (to get E2 routes and 5 LSAs into the OSPF database) for area 0. The internal routers and interfaces ( ASBR s0/0, Area0, and Area1) are configured in a similar way to the single area OSPF example. To avoid being repetitive, I will start the configuration discussion with the area border router (ABR) router. First, assign IP addresses to the interfaces,


interface Serial0/0
 ip address 10.0.1.2 255.255.255.0
!
interface Serial0/1
 ip address 192.168.0.1 255.255.255.0
!



Then configure OSPF as you normally would. In this case, the area stub command is necessary to have routers in area 1 agree that the area is a stub area.


router ospf 1
 log-adjacency-changes
 area 1 stub
 network 10.0.1.0 0.0.0.255 area 0
 network 192.168.0.0 0.0.0.255 area 1
!



Now, there are 3 points of interest int he network. Looking at the internal router for area 0, Area0, We see both routing table entries and database entries for all networks in the diagrams.


Area0#show ip route
Codes: 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

Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O E2    1.1.1.0 [110/100] via 10.0.0.1, 01:22:24, Serial0/0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.0.0.0 is directly connected, Serial0/0
C       10.0.1.0 is directly connected, Serial0/1
O IA 192.168.0.0/24 [110/128] via 10.0.1.2, 01:19:22, Serial0/1
O IA 192.168.1.0/24 [110/129] via 10.0.1.2, 01:19:13, Serial0/1



We see that the OSPF database for area 0 has type 1 and type 2 LSAs that provide routers in area 0 with a full topology in area 0. There are type 3 (summary) LSAs  originating from the ABR for area 1 that contain the 192.168.x.x networks. We also see a type 5 LSA for the E2 route advertised by the ASBR. We do not see any type 4 (ASBR Summary) LSAs because we have no ASBRs in other areas.


Area0#show ip ospf database

            OSPF Router with ID (10.0.1.1) (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         1393        0x80000006 0x008AE9 2
10.0.1.1        10.0.1.1        1264        0x80000006 0x00222B 4
192.168.0.1     192.168.0.1     1122        0x80000004 0x003A6D 2

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.0.0     192.168.0.1     1122        0x80000003 0x0044E2
192.168.1.0     192.168.0.1     1122        0x80000003 0x0043E1

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
1.1.1.0         1.1.1.1         1393        0x80000003 0x00C482 0



One potential point of confusion is that there are Type 1 LSAs that are being advertised by the router ID 192.168.0.1. This is only the router ID that was chosen, all of the 192.168.x.x interfaces exist in Area 1. This is evident from examining the LSA on the router that is internal to area 0:


Area0#show ip ospf database router 192.168.0.1

            OSPF Router with ID (10.0.1.1) (Process ID 1)

                Router Link States (Area 0)

  Routing Bit Set on this LSA
  LS age: 1325
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 192.168.0.1
  Advertising Router: 192.168.0.1
  LS Seq Number: 80000004
  Checksum: 0x3A6D
  Length: 48
  Area Border Router
  Number of Links: 2

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 10.0.1.1
     (Link Data) Router Interface address: 10.0.1.2
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.0.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64


Now we look at the ABR. Databases and routing tables tend to be more interesting on area border routers because they have complete topology databases for more than one area. Additionally, ABRs create and advertise default routes for other routers that are internal to stub areas, but they do not install the default route themselves. When we examine the OSPF database for the ABR, it is apparent that there are 2 complete databases (one for area 0, and one for area 1).

ABR#show ip ospf database

            OSPF Router with ID (192.168.0.1) (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         2008        0x80000006 0x008AE9 2
10.0.1.1        10.0.1.1        1880        0x80000006 0x00222B 4
192.168.0.1     192.168.0.1     1736        0x80000004 0x003A6D 2

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.0.0     192.168.0.1     1736        0x80000003 0x0044E2
192.168.1.0     192.168.0.1     1736        0x80000003 0x0043E1

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
192.168.0.1     192.168.0.1     1736        0x80000005 0x00E8A4 2
192.168.1.1     192.168.1.1     1887        0x80000004 0x00F819 3

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         192.168.0.1     1736        0x80000003 0x009B36
10.0.0.0        192.168.0.1     1748        0x80000003 0x001434
10.0.1.0        192.168.0.1     1748        0x80000003 0x008601

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
1.1.1.0         1.1.1.1         3           0x80000004 0x00C283 0



The routing table also reflects all of the routes installed from both areas (but not the default route created by the ABR and flooded to the Area1 router).


ABR#show ip route
Codes: 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


Gateway of last resort is not set

     1.0.0.0/24 is subnetted, 1 subnets
O E2    1.1.1.0 [110/100] via 10.0.1.1, 01:37:34, Serial0/0
     10.0.0.0/24 is subnetted, 2 subnets
O       10.0.0.0 [110/128] via 10.0.1.1, 01:37:34, Serial0/0
C       10.0.1.0 is directly connected, Serial0/0
C    192.168.0.0/24 is directly connected, Serial0/1
O    192.168.1.0/24 [110/65] via 192.168.0.2, 01:37:19, Serial0/1



Now, we look at the router that is internal to area 1, the stub area. We can see from the routing table that the default route is installed, but the E2 route advertised by ASBR has disappeared. This is because stub areas do not propagate type 5 (external) LSAs. In this configuration, type 3 LSAs are still propagated, but this can be modified using a totally stubby area.


Area1#show ip route
Gateway of last resort is 192.168.0.1 to network 0.0.0.0

     10.0.0.0/24 is subnetted, 2 subnets
O IA    10.0.0.0 [110/192] via 192.168.0.1, 01:42:47, Serial0/0
O IA    10.0.1.0 [110/128] via 192.168.0.1, 01:42:47, Serial0/0
C    192.168.0.0/24 is directly connected, Serial0/0
C    192.168.1.0/24 is directly connected, Loopback0
O*IA 0.0.0.0/0 [110/65] via 192.168.0.1, 01:42:47, Serial0/0


The database also shows no type 5 (external) LSAs, but we see that the default route is propagated as a type 3 (network summary) LSA:

Area1#show ip ospf database

            OSPF Router with ID (192.168.1.1) (Process ID 1)

                Router Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum Link count
192.168.0.1     192.168.0.1     279         0x80000006 0x00E6A5 2
192.168.1.1     192.168.1.1     418         0x80000005 0x00F61A 3

                Summary Net Link States (Area 1)

Link ID         ADV Router      Age         Seq#       Checksum
0.0.0.0         192.168.0.1     279         0x80000004 0x009937
10.0.0.0        192.168.0.1     279         0x80000004 0x001235
10.0.1.0        192.168.0.1     279         0x80000004 0x008402



In later posts, we will go into the details of totally stubby areas and the effects of the NSSA option.

See Also:
The Road to the CCIE

1 comment:

  1. Hi, This is a good post, indeed a great job. You must have done good research for the work, i appreciate your efforts. Looking for more updates from your side. Thanks
    Stock Tips

    ReplyDelete