top of page

What is OSPF Protocol?



The OSPF (Open Shortest Path First) protocol is one of a family of IP Routing protocols, and is an Interior Gateway Protocol (IGP) for the Internet, used to distribute IP routing information throughout a single Autonomous System (AS) in an IP network.

The OSPF protocol is a link-state routing protocol, which means that the routers exchange topology information with their nearest neighbors. The topology information is flooded throughout the AS, so that every router within the AS has a complete picture of the topology of the AS. This picture is then used to calculate end-to-end paths through the AS, normally using a variant of the Dijkstra algorithm. Therefore, in a link-state routing protocol, the next hop address to which data is forwarded is determined by choosing the best end-to-end path to the eventual destination.

The main advantage of a link state routing protocol like OSPF is that the complete knowledge of topology allows routers to calculate routes that satisfy particular criteria. This can be useful for traffic engineering purposes, where routes can be constrained to meet particular quality of service requirements. The main disadvantage of a link state routing protocol is that it does not scale well as more routers are added to the routing domain. Increasing the number of routers increases the size and frequency of the topology updates, and also the length of time it takes to calculate end-to-end routes. This lack of scalability means that a link state routing protocol is unsuitable for routing across the Internet at large, which is the reason why IGPs only route traffic within a single AS.

Each OSPF router distributes information about its local state (usable interfaces and reachable neighbors, and the cost of using each interface) to other routers using a Link State Advertisement (LSA) message. Each router uses the received messages to build up an identical database that describes the topology of the AS.

From this database, each router calculates its own routing table using a Shortest Path First (SPF) or Dijkstra algorithm. This routing table contains all the destinations the routing protocol knows about, associated with a next hop IP address and outgoing interface.

  • The protocol recalculates routes when network topology changes, using the Dijkstra algorithm, and minimizes the routing protocol traffic that it generates.

  • It provides support for multiple paths of equal cost.

  • It provides a multi-level hierarchy (two-level for OSPF) called "area routing," so that information about the topology within a defined area of the AS is hidden from routers outside this area. This enables an additional level of routing protection and a reduction in routing protocol traffic.

  • All protocol exchanges can be authenticated so that only trusted routers can join in the routing exchanges for the AS.

OSPF Version 3 (OSPFv3)


OSPF version 2 (OSPFv2) is used with IPv4. OSPFv3 has been updated for compatibility with IPv6's 128-bit address space. However, this is not the only difference between OSPFv2 and OSPFv3. Other changes in OSPFv3, as defined in RFC 2740, include

  • protocol processing per-link not per-subnet

  • addition of flooding scope, which may be link-local, area or AS-wide

  • removal of opaque LSAs

  • support for multiple instances of OSPF per link

  • various packet and LSA format changes (including removal of addressing semantics).

Both OSPFv2 and OSPFv3 are fully supported by DC-OSPF.


OSPF Routing Hierarchy


The OSPF routing hierarchy includes the following functions:

• Autonomous systems

• Areas, including the backbone and stub areas

• Area Border Routers (ABRs)

• Autonomous System Boundary Routers (ASBRs)


Fig 1

Autonomous System


The autonomous system (AS) is a collection of networks, under the same administrative control, that share the same routing information with each other. An AS is also referred to as a routing domain. Figure-1 shows two ASs: AS A and AS B. An AS can consist of one or more OSPF areas.


Areas


Areas allow the subdivision of an AS into smaller, more manageable networks or sets of adjacent networks. As shown in Figure 1, AS A consists of three areas: area 0.0.0.0, area 1.1.1.1, and area 1.1.1.2. OSPF hides the topology of an area from the rest of the AS. An area’s network topology is visible only to routers inside that area; the network topology is not visible to routers outside the area. When OSPF routing is within an area, this is called intra-area routing. This routing limits the amount of link-state information flooding onto the network, thereby reducing routing traffic. OSPF routing also reduces the size of the topology information in each router, which conserves processing and memory requirements in each router. Conversely, the routers within an area cannot see detailed network structures outside the area. Because of this restriction of topological information, you can control traffic flow between areas and reduce routing traffic when the entire autonomous system is a single routing domain.


Backbone Area


A backbone area is responsible for distributing routing information between the areas of an autonomous system. When OSPF routing occurs outside of an area, this is called inter-area routing. The backbone itself has all the properties of an area. It consists of ABRs, and routers and networks only on the backbone. As shown in Figure 3-1, area 0.0.0.0 is an OSPF backbone area. Note that a designated OSPF backbone area has a reserved ID of 0.0.0.0.

Area Border Routers


ABRs have multiple interfaces that connect directly to networks in two or more areas. An ABR runs a separate copy of the OSPF algorithm and maintains separate routing data for each area that is connected to it, including the backbone area. ABRs also send configuration summaries for their attached areas to the backbone area, which distributes this information to other OSPF areas in the autonomous system. In Figure 1, there are two ABRs. ABR 1 interfaces area 1.1.1.1 to the backbone area. ABR 2 interfaces the backbone area to area 1.1.1.2, a stub area.


Note : ABRs are always backbone routers. You must configure ABRs to the backbone area.


Stub Area


A stub area is an area that does not accept or distribute detailed network information external to the area. A stub area has only one router that interfaces the area to the rest of the AS. The ABR attached to the stub area advertises a single default external route into the area. Routers within a stub area use this route for destinations outside the autonomous system, as well as for inter-area routes. This relationship conserves LSA database space that would otherwise be used to store external LSAs flooded into the area. As shown in Figure 1, area 1.1.1.2 is a stub area that is reached only through ABR 2.


Autonomous System Boundary Routers


ASBRs provide connectivity from one autonomous system to another system. ASBRs exchange their autonomous system routing information with boundary routers in other autonomous systems. Every router inside an autonomous system knows how to reach the boundary routers for its autonomous system. ASBRs can import external routing information from other protocols like RIP and redistribute them as AS-external LSAs to the OSPF network. If the CSS is an ASBR, you can configure it to advertise VIP addresses for content as AS external routes. In this way, ASBRs flood information about external networks to routers within the OSPF network.


ASBR routes can be advertised as type1 or type2 ASE. The difference between type1 and type2 is how the cost is calculated. For a type2 ASE, only the external cost (metric) is used when comparing multiple paths to the same destination. For type1 ASE, the combination of the external cost and the cost to reach the ASBR is used.


Configuring OSPF in a Single Area


When configuring any OSPF router, you must establish which area assignment to enable the interface for. OSPF has some basic rules when it comes to area assignment. OSPF must be configured with areas. The backbone area 0, or 0.0.0.0, must be configured if you use more than one area assignment. You can configure OSPF in one area; you can choose any area, although good OSPF design dictates that you configure area 0.

To enable OSPF on a Cisco router and advertise interfaces, the following tasks are required:


Step 1


Use the command router ospf process ID to start OSPF.


Step 2


Use the network command to enable the interfaces.


Step 3


Identify area assignments.


Step 4


(Optional) Assign the router ID.



Configuring OSPF in a Single Area


router ospf 1

network 0.0.0.0 255.255.255.255 area 0


The above example displays OSPF with a process ID of 1 and places all interfaces configured with an IP address in area 0. The network command network 0.0.0.0 255.255.255.255 area 0 dictates that you do not care (255.255.255.255) what the IP address is, but if an IP address is enabled on any interface, place it in area 0.


The following is a list of reasons OSPF is considered a better routing protocol than RIP:

  • OSPF has no hop count limitations. (RIP has 15 hops only.)

  • OSPF understands variable-length subnet masks (VLSMs) and allows for summarization.

  • OSPF uses multicasts (not broadcasts) to send updates.

  • OSPF converges much faster than RIP, because OSPF propagates changes immediately.

  • OSPF allows for load balancing with up to six equal-cost paths.

  • OSPF has authentication available. (RIPv2 does also, but RIPv1 does not.)

  • OSPF allows for tagging of external routes injected by other autonomous systems.

  • OSPF configuration, monitoring, and troubleshooting have a far greater IOS tool base than RIP.

108 views

Recent Posts

See All
bottom of page