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 - 

  1. Neighbors

  2. Database Exchange

  3. Route Calculation


How OSPF Works -

  1. Link-State Advertisements (LSAs):

    1. OSPF routers exchange LSAs to share information about their links, states, and costs.

  2. Topology Database:

    1. Each router builds a link-state database (LSDB) based on received LSAs.

  3. SPF Calculation:

    1. OSPF uses the Dijkstra algorithm to compute the shortest path to all destinations in the network.

  4. Routing Table Update:

    1. The results of the SPF calculation populate the routing table with the best routes.

  5. Convergence:

    1. 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

  1. 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. 

  2. Internal router – An internal router is a router which has all of its interfaces in a single area.

  3. 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.

  4. 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

  1. Broadcast (e.g., Ethernet):

    1. Requires election of a Designated Router (DR) and Backup DR (BDR).

  2. Non-Broadcast (e.g., Frame Relay):

    1. Requires manual neighbor configuration.

  3. Point-to-Point:

    1. Simplified as it doesn’t require DR/BDR.

  4. Point-to-Multipoint:

    1. Treats multiple connections as separate point-to-point links


OSPF Packet Types

  1. Hello: Establishes and maintains neighbor relationships.

  2. Database Description (DBD): Summarizes the LSDB to neighbors.

  3. Link-State Request (LSR): Requests specific LSAs.

  4. Link-State Update (LSU): Sends LSAs to neighbors.

  5. 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

  1. Designated Router (DR):

    1. Acts as the central point for exchanging routing information on a multi-access network.

    2. Other routers (called DROthers) form adjacencies only with the DR (and BDR).

    3. It ensures that LSAs are efficiently flooded within the network segment.

  2. Backup Designated Router (BDR):

    1. Stands by to take over the DR role if the DR fails.

    2. Establishes adjacencies with all routers, just like the DR, but remains passive unless needed.

  3. DROther:

    1. Refers to routers on the same multi-access segment that are neither DR nor BDR.

    2. 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:

  1. Priority:

    1. Each OSPF router has a priority value (0–255) configured on the interface.

    2. Higher priority values are preferred. A priority of 0 makes a router ineligible to become DR or BDR.

  2. Router ID (RID):

    1. In case of a tie in priority, the router with the highest Router ID is elected. The Router ID is usually determined as:

      1. Manually configured value (preferred).

      2. Highest IP address of an active interface.

      3. Highest loopback IP address, if configured.

  3. Election Order:

    1. First, the BDR is elected.

    2. Then, the DR is elected, considering the remaining eligible routers.



Advantages

  1. Reduces OSPF traffic on multi-access networks by limiting the number of adjacencies.

  2. Ensures efficient LSA flooding through a centralized approach.


Key Points to Remember

  1. The DR and BDR election process is non-preemptive. Once a DR or BDR is elected, it retains its role unless it goes offline.

  2. The roles are specific to each multi-access network. Different networks can have different DRs and BDRs.

  3. 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 


Popular posts from this blog

CCNA Class 01: Basic Networking & Network Architecture

Summary Of The RHELv9 Book Ref:124 (Theoritical Based)

CCNA Class 04: Work Functionality of the required Network Components & Number System