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). Unlike EIGRP, OSPF is an open standard protocol, meaning it is supported by almost all network vendors.
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 (LSDB) | Contains the map of the network topology. | show ip ospf database |
| Routing Table | Contains the best paths calculated by SPF. | show ip route ospf |
OSPF Packet Types
- Hello: Establishes and maintains neighbor relationships.
- DBD (Database Description): Summary of the LSDB.
- LSR (Link State Request): Request for specific link-state records.
- 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): A router that connects one or more areas to the backbone (Area 0). It maintains a separate LSDB for each area it connects to.
- ASBR (Autonomous System Boundary Router): A router that 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. Instead of every router exchanging updates with every other router, they only send updates to the DR/BDR.
- Multicast Addresses:
224.0.0.5: All OSPF Routers listen to this.224.0.0.6: Only DR and BDR listen to this.
- Election Criteria:
- Highest Interface Priority (Default is 1).
- Highest Router ID (if priorities are tied).
Basic Configuration (Single Area)
Router(config)# router ospf 1 ! 1 is the Process ID (locally significant) Router(config-router)# network 192.168.10.0 0.0.0.255 area 0 ! Uses Wildcard Mask Router(config-router)# router-id 1.1.1.1 ! Manually set Router ID Router(config-router)# passive-interface gigabitEthernet0/1 ! Stop Hello packets on LAN