CCNA Class 15: OSPF Concept and Configuration with Details
What is the OSPF Routing Protocol and Brief in details
OSPF stands for Open Shortest Path First, is a Link State Routing Protocol which is used to find the best path between source to destination router using the Shortest Path First Algorithm. OSPF maintain three main categories -
Neighbors
Database Exchange
Route Calculation
How OSPF Works -
Link-State Advertisements (LSAs):
OSPF routers exchange LSAs to share information about their links, states, and costs.
Topology Database:
Each router builds a link-state database (LSDB) based on received LSAs.
SPF Calculation:
OSPF uses the Dijkstra algorithm to compute the shortest path to all destinations in the network.
Routing Table Update:
The results of the SPF calculation populate the routing table with the best routes.
Convergence:
OSPF quickly converges after a topology change by recalculating paths.
OSPF Metrics Calculation -
Cost = Reference Bandwidth (Mbps) / Interface Bandwidth (Mbps)
'OR'
Cost = 10^8/Bandwidth
Here, Default Reference Bandwidth is 100Mbps. If the ethernet is 10Mbps, the Cost will be 10 and If the ethernet is 1000Mbps, the cost will be 1 (rounding).
There are some roles of router in OSPF
Backbone router – The area 0 is known as backbone area and the routers in area 0 are known as backbone routers. Any router can be a Backbone router and Area Boundary Router.
Internal router – An internal router is a router which has all of its interfaces in a single area.
Area Boundary Router (ABR) – The router which connects the backbone area with another area is called Area Boundary Router. It belongs to more than one area.
Area Summary Border Router (ASBR) – When an OSPF router is connected to a different protocol like EIGRP or Border Gateway Protocol, or any other routing protocol then it is known as AS. The router which connects two different AS (in which one of the interfaces is operating OSPF) is known as Area Summary Border Route.
OSPF Network Types
Broadcast (e.g., Ethernet):
Requires election of a Designated Router (DR) and Backup DR (BDR).
Non-Broadcast (e.g., Frame Relay):
Requires manual neighbor configuration.
Point-to-Point:
Simplified as it doesn’t require DR/BDR.
Point-to-Multipoint:
Treats multiple connections as separate point-to-point links
OSPF Packet Types
Hello: Establishes and maintains neighbor relationships.
Database Description (DBD): Summarizes the LSDB to neighbors.
Link-State Request (LSR): Requests specific LSAs.
Link-State Update (LSU): Sends LSAs to neighbors.
Link-State Acknowledgement (LSAck): Acknowledges received LSAs.
OSPF Configuration for Single Area Network
Step 01: General Configuration of the Routers
Core-R1(config)#interface gigabitEthernet 0/0
Core-R1(config-if)#ip address 10.1.1.1 255.255.255.0
Core-R1(config-if)#no shutdown
Core-R1(config-if)#int se0/0/0
Core-R1(config-if)#ip address 1.2.3.1 255.255.255.252
Core-R1(config-if)#bandwidth 64
Core-R1(config-if)#clock rate 64000
Core-R1(config-if)#no shutdown
Core-R1(config-if)#int se0/0/1
Core-R1(config-if)#ip address 1.2.3.5 255.255.255.252
Core-R1(config-if)#bandwidth 512
Core-R1(config-if)#clock rate 50000
Core-R1(config-if)#no shutdown
Core-R1#copy running-config startup-config
—----------------------------------------------------------------
Core-R2(config)#interface serial 0/0/0
Core-R2(config-if)#ip address 1.2.3.6 255.255.255.252
Core-R2(config-if)#bandwidth 512
Core-R2(config-if)#no shutdown
Core-R2(config-if)#int se0/0/1
Core-R2(config-if)#ip address 1.2.3.9 255.255.255.252
Core-R2(config-if)#bandwidth 128
Core-R2(config-if)#no shutdown
Core-R2(config-if)#int gi0/0
Core-R2(config-if)#ip address 10.1.2.1 255.255.255.0
Core-R2(config-if)#no shutdown
Core-R2#show running-config
—-----------------------------------------------------------
Core-R3(config)#interface se0/0/0
Core-R3(config-if)#ip address 1.2.3.2 255.255.255.252
Core-R3(config-if)#bandwidth 64
Core-R3(config-if)#no shutdown
Core-R3(config-if)#int se0/0/1
Core-R3(config-if)#ip address 1.2.3.10 255.255.255.252
Core-R3(config-if)#clock rate 128000
Core-R3(config-if)#bandwidth 128
Core-R3(config-if)#no shutdown
Core-R3(config-if)#int gi0/0
Core-R3(config-if)#ip address 10.1.3.1 255.255.255.0
Core-R3(config-if)#no shutdown
Core-R3(config-if)#end
Core-R3#write memory
Step 02: OSPF routing using network commands and wildcard masks.
Core-R1(config)#router ospf 1
Core-R1(config-router)#network 10.1.1.0 0.0.0.255 area 0
Core-R1(config-router)#network 1.2.3.0 0.0.0.3 area 0
Core-R1(config-router)#network 1.2.3.4 0.0.0.3 area 0
—----------------------------------------------------------
Core-R2(config)#router ospf 1
Core-R2(config-router)#network 1.2.3.4 0.0.0.3 area 0
Core-R2(config-router)#network 10.1.2.0 0.0.0.255 area 0
Core-R2(config-router)#network 1.2.3.8 0.0.0.3 area 0
—----------------------------------------------------------
Core-R3(config)#router ospf 1
Core-R3(config-router)#network 1.2.3.0 0.0.0.3 area 0
Core-R3(config-router)#network 1.2.3.8 0.0.0.3 area 0
Core-R3(config-router)#network 10.1.3.0 0.0.0.255 area 0
Step 03: Justify the Implementation of Routing Protocol each Routers
Core-R1#show ip route
Core-R1#show ip route ospf
Core-R1#show ip ospf database
Core-R1#show ip ospf neighbor
—----------------------------------
Core-R2#show ip route
Core-R2#show ip route ospf
Core-R2#show ip ospf database
Core-R2#show ip ospf neighbor
—-----------------------------------
Core-R3#show ip route
Core-R3#show ip route ospf
Core-R3#show ip ospf database
Core-R3#show ip ospf neighbor
Step 04: Testing The Data Packet traverse Source to Destination
Referral Link: https://drive.google.com/drive/folders/1c3zuzFVTv2FRhjniPag4dV22PXfEKJMb
OSPF Configuration for Multi-Area Network
Area 0 Setup:
Router(config)#router ospf 1
Router(config-router)#network a.b.c.d wildcard_mask area 0
Multiple Area Setup (ABR):
Router(config)#router ospf 1
Router(config-router)#network a.b.c.d wildcard_mask area 0
Router(config-router)#network a.b.c.d wildcard_mask area 1
Testing OSPF Configuration:
Router#show ip ospf database
Referral Link:
https://drive.google.com/drive/folders/1c3zuzFVTv2FRhjniPag4dV22PXfEKJMb
Concept of DR and BDR in OSPF
In OSPF (Open Shortest Path First), DR (Designated Router) and BDR (Backup Designated Router) are key roles used in multi-access network environments, such as Ethernet, to optimize the exchange of OSPF routing information. Their purpose is to reduce the number of OSPF adjacency relationships and minimize the overhead caused by flooding Link-State Advertisements (LSAs).
Roles and Functions
Designated Router (DR):
Acts as the central point for exchanging routing information on a multi-access network.
Other routers (called DROthers) form adjacencies only with the DR (and BDR).
It ensures that LSAs are efficiently flooded within the network segment.
Backup Designated Router (BDR):
Stands by to take over the DR role if the DR fails.
Establishes adjacencies with all routers, just like the DR, but remains passive unless needed.
DROther:
Refers to routers on the same multi-access segment that are neither DR nor BDR.
Forms adjacencies only with the DR and BDR, not with other DROthers.
Explain why we need the concept of a Designated Router and a Backup Designated Router.
Fig-A: LSA Flooding on Shared LAN
As you can see, every router becomes fully adjacent (neighbor in the state: Full) to every other device in the topology. This means there are n(n-1)/2 adjacencies on the segment, as shown in the above diagram on Fig-A. As a result, every pair of routers exchanges LSA information, resulting in a massive flood of unnecessary identical LSA updates.
To resolve above of this scenario in Figure A, Implement a Designated Router: With the introduction of a designated router (DR), every router performs a full database exchange ONLY with the DR.
How does OSPF DR and BDR work?
Election Process
The DR and BDR election process is automatic and uses the following criteria:
Priority:
Each OSPF router has a priority value (0–255) configured on the interface.
Higher priority values are preferred. A priority of 0 makes a router ineligible to become DR or BDR.
Router ID (RID):
In case of a tie in priority, the router with the highest Router ID is elected. The Router ID is usually determined as:
Manually configured value (preferred).
Highest IP address of an active interface.
Highest loopback IP address, if configured.
Election Order:
First, the BDR is elected.
Then, the DR is elected, considering the remaining eligible routers.
Advantages
Reduces OSPF traffic on multi-access networks by limiting the number of adjacencies.
Ensures efficient LSA flooding through a centralized approach.
Key Points to Remember
The DR and BDR election process is non-preemptive. Once a DR or BDR is elected, it retains its role unless it goes offline.
The roles are specific to each multi-access network. Different networks can have different DRs and BDRs.
The election does not occur on point-to-point or point-to-multipoint networks
Step-by-Step Configuration Process of DR & BDR
Fig: DR & BDR Configuration
Router(config)#hostname R.10
R.10(config)#interface gigabitEthernet 0/0
R.10(config-if)#ip address 192.168.100.10 255.255.255.0
R.10(config-if)#no shutdown
Router(config)#hostname R.30
R.30(config)#interface gigabitEthernet 0/0
R.30(config-if)#ip address 192.168.100.30 255.255.255.0
R.30(config-if)#no shutdown
Router(config)#hostname R.20
R.20(config)#interface gigabitEthernet 0/0
R.20(config-if)#ip address 192.168.100.20 255.255.255.0
R.20(config-if)#no shutdown
Router(config)#hostname R.40
R.40(config)#interface gigabitEthernet 0/0
R.40(config-if)#ip address 192.168.100.40 255.255.255.0
R.40(config-if)#no shutdown
Configuring OSPF with Wildcard Mask
R.40(config)#router ospf 1
R.40(config-router)#network 192.168.100.40 0.0.0.0 area 0
R.10(config)#router ospf 1
R.10(config-router)#network 192.168.100.10 0.0.0.0 area 0
R.30(config)#router ospf 1
R.30(config-router)#network 192.168.100.30 0.0.0.0 area 0
R.20(config)#router ospf 1
R.20(config-router)#network 192.168.100.20 0.0.0.0 area
Manually Configuring DR and BDR
Router(config-if)#ip ospf priority <0-255> [DR==High Value, Not Participate==0]
OR,
Router(config)#router ospf 1
Router(config-router)#router-id a.b.c.d
Router#clear ip ospf process
Router#show ip ospf interface
Route#show ip ospf neighbor
referral link: https://drive.google.com/drive/folders/1c3zuzFVTv2FRhjniPag4dV22PXfEKJMb