Saturday, August 31, 2013

Understanding the OSPF protocol

Small introduction to OSPF protocol

OSPF, or Open Shortest Path First, is a link-state, open-standard, dynamic routing protocol.  OSPF uses an algorithm known as SPF, or Dijkstra’s Shortest Path First, to compute internally the best path to any given route.OSPF is classless and converges fairly quickly, using cost as it’s metric.  A router running OSPF creates its own database which contains information on the entire OSPF network, not simply neighbor’s routes like EIGRP.  This allows the router to make intelligent choices about path selection on its own instead of relying exclusively on neighbor information.

OSPF routers do form neighbor relationships though.  They exchange hellos with neighboring routers and in the process learn their neighbor’s Router ID (RID) and cost.  Those values are then sent to the adjacency table. Every router is responsible for computing its own best paths to all destinations within an OSPF domain.  Once the SPF algorithm selects the best paths, they are then eligible to be added to the routing table. 
This protocol is considered as a Interior Gateway Protocol (simple IGP), which is widely used in ISP scenarios as an infrastructure protocol for BGP routing. 

Once a router has exchanged hellos with its neighbors and captured Router IDs and cost information, it begins sending LSAs, or Link State Advertisements.  LSAs contain the RID and costs to the router’s neighbors.  LSAs are shared with every other router in the OSPF domain.  A router stores all of its LSA information (including info it receives from incoming LSAs) in the Link State Database (LSDB).

OSPF is different from EIGRP in that it uses areas to segment routing domains.  This helps partition routers into manageable groups if the layer 3 network begins to get large. It all starts with area 0.  Every OSPF network must contain an area 0, sometimes referred to as the backbone area and every additional area must be physically connected to area 0.  From there, other areas are optional. Note that the SPF algorithm only runs within a single area, so routers only compute paths within their own area.  Inter-area routes are passed using border routers.

OSPF Area types:

Backbone area - Another name for area 0
Regular area - Non-backbone area, with both internal and external routes
Stub area - Contains only internal routes and a default route
Totally Stubby Area - Cisco proprietary option for a stub area
Not-So-Stubby area (NSSA) - Contains internal routes, redistributed routes, and optionally a default route
Totally Stubby NSSA - Cisco proprietary option for NSSA

OSPF us using several types of Link State Advertisements (LSAs) to communicate link state information between neighbors. A brief review of the most applicable LSA types:

Type 1 - Represents a router
Type 2 - Represents the pseudonode (designated router) for a multiaccess link
Type 3 - A network link summary (internal route)
Type 4 - Represents an ASBR
Type 5 - A route external to the OSPF domain
Type 7 - Used in stub areas in place of a type 5 LSA

OSPF is also using in SPF calculations different types of routers depending on their position in the network. The routers have different roles in the network.

Internal: All interfaces in a single area.
Backbone: At least one interface assigned to area 0.
Area Border Router (ABR): Have interfaces in two or more areas (routers 2 and 3 in diagram above) ABRs contain a separate Link State Database, separating LSA flooding between areas, optionally summarizing routes, and optionally sourcing default routes.
Autonomous System Boundary Router (ASBR): Has at least one interface in an OSPF area and at least one interface outside of an OSPF area.

OSPF has so many features that the most efficient way to appreciate them is to enable OSPF on routers and observe how the routers dynamically discover IP networks.

No comments:

Post a Comment