OSPF (Open Shortest Path First) is a link-state routing protocol used to find the best path between the source and the destination router using its own Shortest Path First (SPF) algorithm (Dijkstra's algorithm).
Open Standard
Unlike EIGRP, OSPF is an open standard protocol, meaning it is supported by almost all network vendors, including Cisco, Juniper, and HP.
Key Features
- Link-State Protocol: Routers exchange topology information to build a complete map of the network (LSDB).
- Hierarchical Design: Uses "Areas" to segment the network. Area 0 is the backbone area to which all other areas must connect.
- Metric: Uses "Cost" based on bandwidth (Cost = 10^8 / Bandwidth).
- Fast Convergence: Quickly adapts to network changes.
OSPF Tables
| Table Name | Description | Command |
|---|---|---|
| Neighbor Table | Lists directly connected OSPF neighbors (Adjacencies). | show ip ospf neighbor |
| Database Table | Contains the map of the network topology (LSDB). | show ip ospf database |
| Routing Table | Contains the best paths calculated by SPF. | show ip route ospf |
OSPF Packet Types
OSPF uses five distinct packet types to establish neighbors and exchange routing information:
- Hello: Establishes and maintains neighbor relationships.
- DBD (Database Description): Summary of the LSDB to ensure databases are synchronized.
- LSR (Link State Request): Request for specific link-state records from a neighbor.
- LSU (Link State Update): Sends the requested link-state records.
- LSAck: Acknowledges the receipt of LSUs.
OSPF Router Roles
- Internal Router: A router with all interfaces in the same area.
- Backbone Router: A router with at least one interface in Area 0.
- ABR (Area Border Router): Connects one or more areas to the backbone (Area 0).
- ASBR: Connects the OSPF domain to another routing domain (like EIGRP or the Internet).
DR & BDR Election
On multi-access networks (like Ethernet), OSPF elects a Designated Router (DR) and a Backup Designated Router (BDR) to minimize traffic. Routers only exchange updates with the DR/BDR.
Basic Configuration
Router(config)# router ospf 1 Router(config-router)# network 192.168.10.0 0.0.0.255 area 0 Router(config-router)# router-id 1.1.1.1 Router(config-router)# passive-interface gigabitEthernet0/1