Lecture #11 - OSPF: Part 2

More on OSPF Operation

In the previous lecture we introduced OSPF and examined its design and basic operation/configuration. However, we intentionally avoided some of the more complex aspects of OSPF's operation...

Distributing the Topology Database

As previously mentioned, OSPF distributes topology information via Link State Advertisements (LSAs). A number of different LSA types are required due to the fact that OSPF has multiple router types:

Type 1 - Router LSA
A Router LSA describes a router's interfaces, along with their state and associated cost. These are generated by all OSPF capable routers and are only flooded within the originating area. The show ip ospf database router command can be used to show all Router LSAs within the topology database.
Type 2 - Network LSA
Network LSAs are generated by Designated Routers (DRs). They describe the routers attached to the network and are only flooded within the originating area. Network LSAs can be viewed using the show ip ospf database network command.
Type 3 - Network Summary LSA
An Area Border Router (ABR) will generated Network Summary LSAs in order to advertise networks that are reachable within an attached area. This eliminates the need to propagate Type 1 and Type 2 LSAs across areas, thus reducing traffic and the size of the topology databases. A default route outside the current area, but within the OSPF AS, can also be advertised using this LSA type. The show ip ospf database summary command will list all Network Summary LSAs that exist within the topology database.
Type 4 - ASBR Summary LSA
These are identical to Network Summary LSA messages, except that they advertise the unicast address of an AS Boundary Router (ASBR), rather than a network. The show ip ospf database asbr-summary will list all ASBR Summary LSAs within the topology database.
Type 5 - AS External LSA
AS External LSAs are generated by ASBRs in order to describe routes that exist outside of the OSPF Autonomous System. They can also be used to advertise a default route that is external to the OSPF AS. Sent by an ASBR to describe routes outside the OSPF Autonomous System. Usually flooded throughout the AS. All AS External LSAs within the topology database can be viewed using the show ip ospf database external command.
Type 6 - Group Membership LSA
Used to implement Multicast OSPF (MOSPF) - not supported by IOS.
Type 7 - NSSA External LSA
Generated by ASBRs that are attached to a Not-So-Stubby-Area (NSSA). More on this shortly.

There are four additional LSA types (Type 8 through Type 11) that outside of our interest.

OSPF Area Types

OSPF is allows networks to be partitioned into multiple areas, in order to reduce traffic and increase performance by reducing the topology database size on reach router. This no only creates the need for multiple router types, but also for multiple area types.

It is also worth noting that the use of summary LSAs leads to routers that are again believing what another router tells it. This leads to distance vector like behaviour, specifically between ABRs. It is for this reason that all areas are required to connect directly to area 0. This enforces a hub-and-spoke or tree like topology that is guaranteed to be loop free.

Standard
A standard area is connected to the backbone (area 0) via an ABR. The ABR may be directly connected to the backbone or it may make use of a virtual link. Router LSAs are propagated between all routers within the area, as are Network Summary LSAs that originate from the ABRs. Additionally, external routes generated from a ASBR will be propagated into a standard area.
Backbone
The backbone area behaves as for a standard area, however carries all inter-area traffic. All standard areas should be directly connected to the backbone. For small OSPF networks it is common to use a single area which provides both the backbone and standard area for all routers.
Stub
Often an area will only have one path out to external networks. As a result it does not make sense to propagate external routes from an ASBR into the area. In this case the area is consider a Stub and AS External LSAs (Type 5) are not flooded into this area. Instead the ABR will advertise a default route into the area using a Type 3 LSA. Since AS external routes are not advertised, AS Boundary Router LSAs (Type 4) are also no longer required.
Totally Stubby Area
In the case where an area only has a single ABR, there is obviously only one path out of the area. As a result we avoid flooding Type 3 LSAs in addition to Type 4 and Type 5. Such an area is known as a Totally Stubby Area (TSA). One Type 3 LSA will be flooded into the area to advertise the default route.
Not So Stubby Area
Whilst it may make sense to make an area a Stub, there are certain configurations whereby an ASBR is needed to connect a non-OSPF based network to our area. Obviously this would require Type 5 LSAs since we need to redistribute routes from the non-OSPF network into the OSPF area. A Not-So-Stubby-Area (NSSA) makes use of Type 7 LSAs to advertise external routes into the OSPF area, whilst retaining the properties of a stub area (ie. we don't receive Type 4/Type 5 LSAs from ABRs connected to the backbone).

OSPF on the Wire

OSPF packets are encapsulated directly within IP datagrams using a protocol type of 89 (0x59). Each OSPF packet starts with an OSPF header, which is followed by the OSPF packet data - the exact data depends on the OSPF message type, however it may, for example, contain multiple LSAs (each of which would consist of an LSA header and LSA data).

There are five OSPF packet types:

All OSPF message types share a common 24-byte OSPF header which contains the OSPF version number, message type, router ID, area ID and authentication data.

A Small OSPF Case Study

A small business wants to implement a small network consisting of:

The company has been allocated a block of 512 IP addresses in the 187.188.202.0/23 range (ie. extending from from 187.188.202.0 through to 187.188.203.255).

The proposed design will make use OSPF. Area 0 will not contain any computers - it will just connect the routers together. The other areas will contain head office and the various branches.

Address Allocation

Proposed Allocation: #1

64 for each branch office: 187.188.202.0    to  187.188.202.63
                           187.188.202.64   to  187.188.202.127
                           187.188.202.128  to  187.188.202.191
128 for head office        187.188.202.192  to  187.188.203.63

Small Problem! The "head office" network can't be summarised too well.

10111011.10111100.11001010.11000000
10111011.10111100.11001011.00111111

Has to be handled as two ranges:

10111011.10111100.11001010.11000000
10111011.10111100.11001010.11111111

10111011.10111100.11001011.00000000
10111011.10111100.11001011.00111111

Or in other words:

187.188.202.192/26
187.188.203.0/26

Proposed Allocation: #2

128 for head office        187.188.202.0    to  187.188.202.127
64 for each branch office: 187.188.202.128  to  187.188.202.191
                           187.188.202.192  to  187.188.202.255
                           187.188.203.0    to  187.188.203.63
spare                      187.188.203.64   to  187.188.203.127
spare                      187.188.203.128  to  187.188.203.191
Possible backbone routers  187.188.203.192  to  187.188.203.255

Head office now occupies the address range:

10111011.10111100.11001010.00000000
10111011.10111100.11001010.01111111

Which can be summarised as:

187.188.202.0/25

And the others as:

187.188.202.128/26
187.188.202.192/26
187.188.203.0/26
187.188.203.64/26
187.188.203.128/26
187.188.203.192/26

Some simple rules to get this right:

Network Layout

Head Office Router Configuration

R1(config)#
R1(config)#interface Ethernet0/0           Connects to area 0
R1(config-if)#ip address 187.188.203.254 255.255.255.192
R1(config-if)#no shutdown
R1(config-if)#bandwidth 10000              Bandwidth in kilobits
R1(config-if)#!

R1(config)#interface Ethernet1/0           Connects to area 1
R1(config-if)#ip address 187.188.202.126 255.255.255.128
R1(config-if)#no shutdown
R1(config-if)#bandwidth 10000              Bandwidth in kilobits
R1(config-if)#!
R1(config)#

R1(config)#ip routing

R1(config)#
R1(config)#router ospf 100     OSPF process ID (Random choice)
R1(config-router)#network 187.188.203.192 0.0.0.63 area 0
R1(config-router)#network 187.188.202.0 0.0.0.127 area 1
R1(config-router)#exit
R1(config)#

References

Cisco IOS: Configuring OSPF