OSPF (Open Shortest Path First) is a link-state routing protocol used to efficiently route IP packets within large and complex networks. It’s widely used in enterprise environments due to its scalability, fast convergence, and flexibility.
Key Features of OSPF
✅ Link-State Protocol → Builds a complete map (topology) of the network.
✅ Fast Convergence → Detects network changes quickly and recalculates optimal routes.
✅ Scalable → Uses areas to segment large networks for better efficiency.
✅ Cost-Based Metric → Uses cost (based on bandwidth) as the path selection metric.
✅ Classless → Supports VLSM (Variable Length Subnet Mask) and CIDR (Classless Inter-Domain Routing).
✅ Multicast Updates → Uses 224.0.0.5 (All OSPF routers) and 224.0.0.6 (Designated Routers).
OSPF Terminology
- Router ID (RID): A unique 32-bit identifier for each OSPF router. Chosen based on the highest IP on a loopback interface or highest active IP address.
- Area: Logical grouping of routers to control the size of the link-state database (LSDB).
- Area 0 (Backbone Area) is mandatory for OSPF to function.
- Designated Router (DR): Handles updates in multi-access networks (e.g., Ethernet).
- Backup Designated Router (BDR): Assumes DR’s role if it fails.
- Cost (Metric): Determined by 100 ÷ Bandwidth (e.g., Fast Ethernet = 1, Gigabit Ethernet = 1).
OSPF Router Types
- Internal Router (IR): All interfaces in the same area.
- Backbone Router: Located in Area 0.
- Area Border Router (ABR): Connects one or more OSPF areas to Area 0.
- Autonomous System Boundary Router (ASBR): Connects OSPF to external networks.
OSPF Configuration (Cisco Router)
Step 1: Enable OSPF Process
Syntax:
Router(config)# router ospf <process_id>
- The process ID is locally significant (doesn’t need to match on other routers).
Example:
Router(config)# router ospf 1
Step 2: Configure Network Statements
Syntax:
Router(config-router)# network <network_address> <wildcard_mask> area <area_id>
- Network Address: The network to advertise.
- Wildcard Mask: Inverse of the subnet mask.
- Area ID: Area number (Area 0 for backbone).
Example:
Router(config-router)# network 192.168.1.0 0.0.0.255 area 0
Router(config-router)# network 10.0.0.0 0.0.0.3 area 1
Step 3: Set Router ID (Optional but Recommended)
If not set manually, the router chooses the highest active IP address or loopback IP.
Syntax:
Router(config-router)# router-id <router_id>
Example:
Router(config-router)# router-id 1.1.1.1
Step 4: Configure Passive Interfaces (Optional for Security)
Prevents sending OSPF updates on unused interfaces.
Syntax:
Router(config-router)# passive-interface <interface>
Example:
Router(config-router)# passive-interface GigabitEthernet0/1
Step 5: Verify OSPF Configuration
✅ show ip ospf neighbor → Displays OSPF neighbor relationships.
✅ show ip route ospf → Lists OSPF-learned routes.
✅ show ip ospf interface → Shows OSPF details for interfaces.
Step 6: Testing Connectivity
To ensure routes are propagating correctly:
Router# ping <destination_ip>
Router# traceroute <destination_ip>
Example Topology
[R1]-----[R2]-----[R3]
| | |
192.168.1.0 10.0.0.0 172.16.0.0
R1 Configuration:
Router(config)# router ospf 1
Router(config-router)# network 192.168.1.0 0.0.0.255 area 0
Router(config-router)# network 10.0.0.0 0.0.0.3 area 0
R2 Configuration:
Router(config)# router ospf 1
Router(config-router)# network 10.0.0.0 0.0.0.3 area 0
Router(config-router)# network 172.16.0.0 0.0.0.255 area 1
Best Practices for OSPF
✅ Always configure Area 0 as the backbone.
✅ Use loopback interfaces for stable Router IDs.
✅ Minimize OSPF overhead by configuring passive interfaces.
✅ For large networks, segment areas to improve performance.
Leave a comment