OSPF (Open Shortest Path First) is a link-state Interior Gateway Protocol that uses the SPF algorithm for best-path selection, where each router maintains its own Link-State Database (LSDB) and calculates routes based on cost (calculated as reference bandwidth divided by link bandwidth, with default reference bandwidth of 100 Mbps). OSPF is an open standard classless routing protocol that supports unlimited hops and can perform load balancing across multiple paths (default maximum of 4 paths). The protocol uses multicast addresses 224.0.0.5 and 224.0.0.6 for neighbor discovery and uses five message types (Hello, DBD, LSR, LSU, LSAck) to form adjacencies. OSPF divides networks into areas to prevent database flooding, with Area 0 as the backbone area. Router ID election follows the priority: manual configuration, highest loopback IP, then highest physical interface IP.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
What is OSPF, and Does it Work? Watch and Learn!
Added:Hello Guys, Today we will discuss OSPF.
OSPF stand for Open Shortest Path First. OSPF support unlimited hobs.
Hop means router. OSPF supports unlimited routers. Then OSPF is a link state routing protocol. This means each router will have its own separate database.
That's why it's called link state routing protocol. Then OSPF is open standard. It means any vendor can use it.
It is not that only Cisco devices will use it or some other vendor will use it. Any vendor can use it. By default the maximum path is four. OSPF by default can perform this load balancing.
It can perform load balancing for four paths.
This means that by default the maximum path is four. But we can configure it from zero to 32. But this support is only available on OS 15.0 and above.
And in case our operating system is 12.0 or legacy then here your maximum sin will be 16.
Done. Then OSPF is a classless routing protocol. So what is the difference between classful routing protocol and classful routing protocol. If I talk about classful routing protocol here, then these classful routing protocols are those which are sharing the prefix information without subnet mask, like that we have a router, whenever this router will share any prefix information with its neighbor, then in the case of OSPF, it will be sharing 10.10 24, whatever will be its prefix length, so with subnet mask or with prefix length, the prefix which will be shared will be our classless routing protocol. And any [nasal sound] routing protocol that shares prefixes without any prefix value or without any prefix length or without any subnet mask will be [nasal sound] our classful routing protocol.
Like that, Rip version one shares the prefix information without any subnet mask with its neighbor devices. Then so I hope classless and classful are clear prefixes which will share prefix information with the subnet mask.
That is classless and without subnet mask will share the information that is classless. By default, the automatic summarization feature is disabled here. Then what is the automatic summary? Automatic summary stands for Let's suppose we have these two routers Router One and Router Two. Router One has multiple prefixes 10.1.1.1 10.1.2.1 10.1.3.1 Here let's suppose if automatic summary feature was enabled then Router One would be sharing 10.0.0.08 it means that is the classful summary. Ok? Because it has many advantages. There are a lot of disadvantages. We will discuss these in the coming time.
We will not discuss much on auto summary right now.
OSPF is a Layer 3 routing protocol. It means OSPF is a routing protocol encapsulated with IP headers. It uses the SPF algorithm for its best path selection criteria.
SPF stands for Shortest Path First. Protocol Number 89 OSPF, when encapsulated with an IP header, will use protocol number 89 within the IP header. Then OSPF will use AD value to share its path prefix information.
Whenever OSPF discovers its neighbor, it will forward a multicast message. Then this multicast address is 224.0.0.5 and 224.0.0.6.
In the coming time we will discuss when will five be used? And when will six be used?
Then OSPF uses its metric here as a cost. Then the formula for cost calculation in OSPF is reference bandwidth over link bandwidth. The default reference bandwidth in OSPF is 100 Mbps.
Let's suppose we have these routers, Router One and Router Two. There is no prefix here. Let's suppose loop back one has IPP address 10.1.1.1 then this interface is F0. This interface is also F 0. Then this interface is F10. We have enabled OSPF on router one and OSPF on router two. An OSPF neighborhood is maintained between Router One and Router Two.
When Router One is sharing this prefix further, it is sharing the prefix information plus the prefix length and whatever the cost is.
Then this interface is fast ether one slash zero. Then formula we have reference bandwidth upon link bandwidth. The reference bandwidth is 100 by default and the link bandwidth is Vast Ether.
So also 100 Mbps then we will divide one. This comes out to be its cost. So he must be sending it after adding the cost. But when Router Two receives this prefix, it will also add the cost of the receiving interface. The receiving interface is also fast, ether. That's why the speed is 100 Mbps and reference benefits is also 100 Mbps. So divided by one. So the total cost will come here.
When Router One is sharing this prefix with Router Two, the prefix of 10 will be the cost here. Then Next Here are some timers in OSPF. Let us discuss these timers.
Hello time here is 10 seconds. Dead time is 40 seconds and wait time is 40 seconds. Here is a use case for Hello Time.
Maintaining that neighborhood with your neighbor. Then in OSPF we have total three types of tables. Neighbor Table, Database Table and Routing Table. The neighbor table contains information about neighbor routers.
Inside the database table, which is your database which we call in OSPF the LSA and routing table, there is information about the best path. There are three types of tables. In the coming time, we will see the details of these three tables. Right now we are just talking about an introduction to OSPF. Whenever you enable OSPF, you will use a command router ospf. Then after this I will take a process ID in between 12 65535 and this process ID, this process ID is your identity of OSPF, like this is a router, you have OSPF running on this router, you have enabled OSPF, to identify that OSPF we use process ID, this is a 16 bit decimal identity, it means to the power 16 0265536, this will be its total range 12655 35 multiple OSPF processes can be run on a single router, let's suppose we have this router. On this router we can use Router OSPF 100, on this router we can use Router OSPF 200, on this router we can use Router OSPF 300, it means we can enable multiple processes on a single router.
But if we have two processes running on a single router. Let's suppose here we have used router OSPF 100 and there is an IP address on this interface 12.1.1.1.
We have enabled the IP of this interface on OSPF 100. There is an IPP running on 23.1.1.2 and on this router we used Router OSPF 200. So let's suppose we added 12 in 100 and 23 in 200. So we have two different processes running on the same router.
So if we have two different processes on a single router, we can't communicate with each other.
That's why we will pay here mutual redistribution. Or whenever we run OSPF, we will make sure that we never enable two processes on a single router.
But in case at some place or in some condition you need to enable two processes on the same router, then there we will have to do mutual redistribution. Otherwise process 100 will not be able to communicate with this process 200.
So by default two or more processes on a router will not communicate with each other. The range of the transfer process is 1 65 35. If we talk about messages in OSPF, then we have five types of messages in OSPF. Hello DBD stands for Database Description. LSR stands for Link State Request, Link State Update and Link State Acknowledgement.
These are some messages that we have in OSPF using which OSPF forms its neighborhood and adjacency. Now how to configure OSPF and we will talk here what content goes inside the Hello message? End Hello message of the OSPF header inside the Hello message. So we have a little topology. In this topology we are going to discuss how to enable OSPF. So first of all I get access to both these routers.
Then I will access the CLI and go to Router One. Then first of all we will verify the IP. show show ip interface brief exclude and assign exclude unassign. There is no IP address configured here. So first of all we will configure the IP address.
IP address 12.1.1.1 than 255.255.0 than no shut. Then let's go on router one then to global config mode interface f0 IPP address 12.12 then 255.255.255.0 then use no shut then after configure IPP address let's go on router one then to global config mode then use we will enable OSPF by going to router one.
So let's go on global config mode then use router OSPF then process ID. So let's see the process ID range is 12 65 35 100 then use network. So first of all what we will do is assign the directly connected prefixes with the help of network commands. So look, there are many rules for injecting network commands. I have to go from here and say network then 12.1.1.0 then 0.0.25 and area zero. This is the first method we have. Then look at this, the use case of the wild card mask is that it will match your off bit. Look, we have assigned 12.1.1.0 and 0.0.0.255 here.
So in this, our off bits will match those bits with the IP. So in IP it will pick 12.1.1.1 12.1.1 such interface on which the first three digits will be visible. will make that interface a member of a multicast group. Then this multicast group is 224.0.5 then from there it will send a hello packet.
I'll get it checked for you right now. Router One will not be forwarding any hello packets.
I capture this link. Then after this we will verify whether any hello packet is being forwarded or not.
So start capture then let's check.
Look, no hello packet is being forwarded here.
I have to install OSPF filtering. Then after again go to in router OSPF 100. After this command the router selects the router ID. So first of all this will enable a process.
And let's check show IP protocols.
Here it enabled OSP of 100 and it selected a router ID.
Router ID election criteria is first manual and then highest loop back IP address and then highest physical interface IP address. Then after assign to this network into OSP then network network is 12.1.1.0 then d.255 and area zero. Let's check. Like you will inject the network with this ip this network command.
This interface will join a multicast group. So show ip interface F0 this F0 has joined a multicast group on 24.0.5 and it has started sending a hello message from here. Inside this hello message, let's say this is the OSPF packet. Then this is our OSPF header. If we talk about this OSPF header, the version is written in the first position. If we talk about the then message type then this is hello packet. The length of the packet is 44 bytes. Source OSP of router is sending this with router ID 1211.
Talking about area ID, we used zero. In the coming time we will discuss how many types of areas there are. This is a check sum to check for errors. AuthenticationType by default is using null. Then authentication data is none. This was about OSPF header. If I talk about OSPF Hello packet. So here we are going to put the subnet mask that we had configured with that IP. One thing we are going to have is hello time which by default is 10 which we discussed earlier. Hello time is 10 seconds Dead is 40 End wait is 40 Then router priority is one By default all routers have priority one in case of OSPF.
And the use case of priority is what we will see in the election of DR and BDR.
So right now we are not discussing such keywords. The date time of the then router is using 40 and the designated router i.e. DR router which is zero zero is currently anon and the backup designated router is also anon. So in the coming time we will discuss what is DR router? What is a backup zeignited router? Now just look at this, Router One has just sent the Hello packet.
No hello packets came from Router Two. So now we're going to go to router to pay as well and enable OSPF.
Then use exit then from router OSPF 100 then network network is 1210 then 00.02.255 end area zero. Now Hello packets will start coming from Router 2 as well and this Router 2 will start sending its Hello packets and both have to match their respective Hello packets. The hello parameters have to be matched and the neighborhood has to be homed.
As I discussed with you, there are three types of tables in OSPF.
First is the neighbor table. The command to check the neighbor table would be show ipospf neighbors.
If we discuss this neighbor table, then the neighbor ID is at the first place in this neighbor table.
In Neighbor ID, you will see the neighbor's router ID.
Neighbor ID tells you the router ID of your neighbor router.
Giving comes after this, we have priority. So what is the priority of the neighbor router, it will show us here.
If we talk about the state, the state is full and we will not discuss this DRBDR right now.
If we talk about date time, then date time tells how long this established neighbourhood will remain established. Then next is the address that what is the IP address configured on the interface of my neighbor router and what will be the exit interface to reach that router, so this is the location of our exit interface, this is the location of our desktop, this is the date time, this is our priority and this is the router ID of the neighbor, these are some of the contents in our neighbor table, next we discussed another table, here the database table, so show IP OSPF database, this is the database table of our router in which the information of LSA will be there.
One more table we discussed was the routing table. So show ip route this is our routing table. So these are the three types of tables we use in OSPF, the tables we have discussed. In the coming time, we are going to discuss these contents with more detailed information.
As we just discussed, Area ID. So in OSPF, whenever you configure OSPF, it is a must to provide the area ID. But let's talk about why we should configure Area ID? So the use case of area is basically to stop the database flooding that happens in your OSPF domain.
Let's suppose I have some routers here. Router One, Router Two, Router Three and Router Four. Now Router One has its own database.
Router Two has its own database. Router Three has its own database. End router four has its own database. Router One will then share its database with Router Two, Router Three, and Router Four. In these cases, if only one area is running here.
We want their database to be separated. So here we will use area zero. And here we will use area 10. So now the database of Area Zero will not travel to Area 10 by default in the form of LSA One. So to stop the flapping of LSA one, we create multiple areas here. And the database of Area 10 will not come in our Area Zero in the form of LSA One. So, to stop the flapping of LSA One that was happening here, we create multiple areas.
Done? So let's discuss area ID.
What is Area ID? How many types are there? Let's go.
So if we talk about area, it is a logical grouping and it divides our device logically. Area ID is an OSP identity. OSPF domains have 32 bits. Then can be represented as decimal and dotted decimal. Now look at the Area ID we configured last time in decimal format. But whenever they were exchanging prefixes in their packets, they were always exchanging the area ID in dotted decimal. Ok.
Now as soon as you go to the router and run the command router ospf, after this command the router selects the router ID. Which we have already seen before. The Router ID is 32 bits long and provides your router with a unique identity within the OSPF domain.
And you can represent the router ID in dotted decimal format. Just like we configure IPV4.
By that type you can define a router ID here.
And in case of OSPF you can configure the router ID which can be an existing and a non existing IP.
So what is the existing IP and non-existing IP. If I talk about existing IP, then it is an IP which we can use anywhere. That is the existing IP, non-existing IP means it does not exist on any device.
Like that, this type of thing. But OSPF accepts both your types.
So I can take you through how you would configure the router ID. Now I have to say from here that whatever OSPF I have configured, I will remove it.
No router OSPF 100 then router to pay also we have to go and say no router OSPF 100. I'll come back to Router One and start the configuration.
Router OSPF 100 and here you can manually define whatever router ID you want to configure.
With the help of this command and router to pay also, I will show you how to select a non-existing IP as a router ID. Router ID 0.10.1 This is an IP which we cannot configure on any device. But you can define an edge router ID in OSPF. So Router Two has the router ID 0.1.0.1. If you want to change it again, you can change it again. Let's go on router OSPF 100 then router ID and router ID is 2.2 and to check it the command will be show ip protocols so you can see here that it has router ID 2, by this type you will be able to configure router ID manually. If we talk about the election criteria of router ID, then here is the election criteria of router ID.
That remains with us, the First Thing Manual. Then after that we will have the highest look back.
After that we will have the IP of the highest physical interface. These are some criteria for selecting router ID in OSPF domain.
That's all for this video, see you in the next video.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

we're almost finished the house (ep.125)
JennaPhipps
347K views•2026-07-22

We Finally Know Where Saturn’s Rings Came From
astrumspace
79K views•2026-07-22

BIG BET: Cathie Wood goes ALL IN on Elon Musk
FoxBusiness
89K views•2026-07-22

MIC DROP: Smithsonian Director Called Out For Woke Propaganda
TheAmalaEkpunobi
37K views•2026-07-23