Tuesday, April 7, 2009

OSPF


OSPF is an open-standard, classless routing protocol that converges quickly and uses cost as a metric (Cisco IOS automatically associates cost with bandwidth).

OSPF is a link-state routing protocol and uses Dijkstra’s Shortest Path First (SPF) algorithm to determine its best path to each network. The first responsibility of a link-state router is to create a database that reflects the structure of the network. Link state routing protocols learn more information on the structure of the network than other routing protocols, and thus are able to make more informed routing decisions.

OSPF routers exchange hellos with each neighbor, learning Router ID (RID) and cost. Neighbor information is kept in the adjacency database.

The router then constructs the appropriate Link State Advertisements (LSA), which include information such as the RIDs of, and cost to, each neighbor. Each router in the routing domain shares its LSAs with all other routers. Each router keeps the complete set of LSAs in a table—the Link State Database (LSDB).

Each router runs the SPF algorithm to compute best paths. It then submits these paths for inclusion in the routing table, or forwarding database.

OSPF Network Structure
OSPF routing domains are broken up into areas. An OSPF network must contain an area 0, and may contain other areas. The SPF algorithm runs within an area, and inter-area routes are passed between areas. A two-level hierarchy to OSPF areas exists; area 0 is designed as a transit area, and other areas should be attached directly to area 0 and only to area 0. The link-state database must be identical for each router in an area. OSPF areas typically contain a maximum of 50–100 routers, depending on network volatility. Figure 3-1 shows a network of five routers that has been divided into three areas: area 0, area 1, and area 2.

Dividing an OSPF network into areas does the following:
Minimizes the number of routing table entries.
Contains LSA flooding to a reasonable area.
Minimizes the impact of a topology change.
Enforces the concept of a hierarchical network design.

OSPF defines router roles as well. One router can have multiple roles.

An internal router has all interfaces in one area. In Figure 3-1, R1, R2, and R5 are all internal area routers.
Backbone routers have at least one interface assigned to area 0. R3, R4, and R5 are backbone routers.
An Area Border Router (ABR) has interfaces in two or more areas. In Figure 3-1, R3 and R4 are ABRs.
An Autonomous System Boundary Router (ASBR) has interfaces inside and outside the OSPF routing domain. In Figure 3-1, R3 also functions as an ASBR because it has an interface in an EIGRP routing domain.

OSPF Metric
By default, Cisco assigns a cost to each interface that is inversely proportional to 100 Mbps. The cost for each link is then accrued as the route advertisement for that link traverses the network. Figure 3-2 shows the default OSPF formula.
LSAs
Each router maintains a database of the latest received LSAs. Each LSA is numbered with a sequence number, and a timer is run to age out old LSAs.

When a LSA is received, it’s compared to the LSDB. If it is new, it is added to the database and the SPF algorithm is run. If it is from a Router ID that is already in the database, then the sequence number is compared, and older LSAs are discarded. If it is a new LSA, it is incorporated in the database, and the SPF algorithm is run. If it is an older LSA, the newer LSA in memory is sent back to whoever sent the old one.

OSPF sequence numbers are 32 bits. The first legal sequence number is 0x80000001. Larger numbers are more recent. The sequence number changes only under two conditions:

The LSA changes because a route is added or deleted.
The LSA ages out (LSAs are updated every half hour, even if nothing changes).

The command show ip ospf database shows the age (in seconds) and sequence number for each RID.

LSDB Overload Protection
Because each router sends an LSA for each link, routers in large networks may receive—and must process—numerous LSAs. This can tax the router’s CPU and memory resources, and adversely affect its other functions. You can protect your router by configuring OSPF LSDB overload protection. LDSB overload protection monitors the number of LSAs received and placed into the LSDB. If the specified threshold is exceeded for one minute, the router enters the “ignore” state by dropping all adjacencies and clearing the OSPF database. The router resumes OSPF operations after things have been normal for a specified period. Be careful when using this command, as it disrupts routing when invoked.

LSA Types
OSPF uses different types of LSAs to advertise different types of routes, such as internal area or external routing domain. Many of these are represented in the routing table with a distinctive prefix. Table 3-1 describes these LSA types.

No comments:

Post a Comment