OSPF

 OSPF (Open Shortest Path First) uses Link State Advertisements (LSAs) to share routing information within and between areas. These LSAs populate the Link State Database (LSDB), which is used to calculate the shortest path tree. Below is an explanation of the key OSPF LSA types:

Type 1: Router LSA Generated by every router within an area, this LSA contains information about the router's directly connected links, including their types and states. It does not leave the originating area.

Type 2: Network LSA Generated by the Designated Router (DR) on multi-access networks, this LSA lists all routers connected to the network, including the DR and Backup DR. It also includes the network's prefix and subnet mask. Like Type 1, it remains within the area.

Type 3: Summary LSA Created by Area Border Routers (ABRs), this LSA advertises inter-area routes to other areas. It allows routers in one area to learn about networks in other areas. Despite its name, it does not summarize routes by default unless explicitly configured.

Type 4: Summary ASBR LSA Generated by ABRs to inform other areas about the location of an Autonomous System Boundary Router (ASBR). This LSA is essential for routing to external networks redistributed into OSPF.

Type 5: External LSA Created by ASBRs, this LSA advertises routes to external networks (e.g., those learned via redistribution from other protocols like RIP). These routes are marked as E1 or E2 in the routing table, depending on how the cost is calculated.

Type 6: Multicast OSPF LSA This LSA type is reserved for multicast OSPF but is not widely used or supported (e.g., not supported by Cisco).

Type 7: NSSA External LSA Used in Not-So-Stubby Areas (NSSAs), this LSA allows external routes to be advertised within the NSSA. It is converted to a Type 5 LSA by the ABR when leaving the NSSA.

Key Notes

  • LSAs are identified by their Link ID, Advertising Router, and other attributes like sequence number and checksum.

  • LSAs have a maximum age of 3600 seconds (1 hour) before being removed from the LSDB.

  • The show ip ospf database command on Cisco routers can be used to view LSAs in the LSDB.

Understanding these LSA types is crucial for configuring and troubleshooting OSPF networks, especially in multi-area or redistributed environments.


OSPF uses a metric called OSPF Cost based on each hop's outgoing interface bandwidth.


Every router then advertises the Cost of each link as part of the LSA Type 1 advertisement to neighbors. Since all routers within an area have all LSAs - in the end, all routers know the cost of all links in the area



In OSPF, External Type 1 (E1) and External Type 2 (E2) routes are used to represent networks redistributed from outside the OSPF domain. While both are advertised using Type-5 LSAs (or Type-7 in NSSA areas), the way their costs are calculated and compared is different.

E1 Routes

  • The total cost is the sum of the external cost (from the ASBR to the destination) plus the internal OSPF cost (from the local router to the ASBR).

  • This means E1 reflects the true end-to-end cost through the OSPF domain.

  • Preferred when internal path cost matters, especially in multi-entry point designs where internal distances vary.

E2 Routes

  • The cost is only the external cost assigned at redistribution, regardless of internal OSPF path cost.

  • By default, E2 routes have a metric of 20 unless manually changed.

  • Internal OSPF costs are ignored, so all routers see the same metric to the destination, even if internal paths differ.



Comments