OSPF (Open Shortest Path First) is a link-state interior gateway protocol that calculates the shortest path to each destination using Dijkstra's SPF algorithm. It's widely used in enterprise networks for its fast convergence and scalability.
Link-State Concept
Each OSPF router maintains a local database of the entire network topology, known as the link-state database (LSDB). Routers exchange link-state advertisements (LSAs) to build a consistent view of the network.
OSPF Areas
OSPF uses a hierarchical design with areas to limit the scope of route calculations and LSDB updates. The backbone area (Area 0) connects all other areas, and each area maintains its own LSDB.
OSPF Packets
OSPF uses five packet types: Hello packets for neighbor discovery and maintenance, DBD (Database Descriptor) packets for LSDB synchronization, LSR (Link-State Request) packets to request specific LSAs, LSU (Link-State Update) packets to send LSAs, and LSAck packets for acknowledgment.
OSPF Metrics
OSPF cost is based on interface bandwidth. The total cost of a route is the sum of all interface costs along the path. Higher bandwidth interfaces have lower costs.
DR and BDR Election
On multi-access networks like Ethernet, OSPF elects a Designated Router (DR) and Backup DR (BDR) to reduce OSPF traffic. The election is based on priority and router ID.