05-10-2011 12:51 PM - edited 03-04-2019 12:20 PM
Hi to Everybody,
Just would like to understand what is involved behind a SPF re-calculation. Does SPF calculation involves the establishment of a new adjacencies with it`s neighbor and a generation of a new ip ospf database. I really never could understand the link between the ip ospf database and SPF, is the ip ospf database is the results of the SPF calculaton
Also would like to know if the loss of a neighbor will automatically correspond to the removal of the LSA that belongs to the missing neighbor in the OSPF database or does it corresponds to a new SPF calculation. In other words, can we have some LSA in the OPSF database that belongs to a OSPF neighbor that is no longer active.
Last question, does a clear ip ospf process also trigger SPF calculation.
Thanks for your help
Stéphane
05-10-2011 01:11 PM
Routers first exchange hellos and become neighbors. Then they decide to form adjacencies. An adjacency is a state where two routers agree to exchange LSAs (link state advertisments).
The LSA exchange between any two routers will poplulate their link state databases. At this point both routers will have the same copy of the link state database for the particular area.
Then the routers will individually run SPF (Dijkstra Shortest Path First algorithm) against the recently populated link state database to determine the shortest path between the calculating router and all other routers in the network. You can think of the link state database as your input to the Dijkstra SPF algorithm (program).
Because all routers run the same calculation on the same data (same link state database), every router has the same picture of the network, and packets are routed consistently at every hop. In summary, database is you input to SFP. LSAs for to a missing neighbor will be removed and SFP will run again against your new database without the old LSAs (possibly with some new replacement LSAs)
Yes ip ospf process will trigger a new calculation.
Cheers,
Eehab
04-11-2014 04:53 AM
Hi
I just checked my email. Well i got an email from netpro!!! Just want to be here to rate you guys. I have no idea how OSPF works right now.XD
Toshi
04-11-2014 05:01 AM
Thanks for the rating dear, by the way I feel OSPF is awesome and tricky. The more we dig the more we find.
05-10-2011 01:29 PM
Hi,
In OSPF , running after all OSPF states and after reaching the FULL neigbor state which indicate that routers are fully adjacent and they recieved Link state Databases from each neihbor. Then , each particular ospf router runs the SPF algorithm to determine the best path to the destination. each router in OSPF would have full topology overview.
So, the SPF calculation are triggered by the Link state Database , routers wont run the SPF if they dont have or recieved Link state advertisemnet.
The command (CLear IP ospf process) will trigger new SPF calculation.
Regards,
Mohamed
05-10-2011 02:08 PM
Hi,
Eehab and Mohamed gave you good explainations. 5-point for you guys.
After understanding the theory it's time to lab it up to let the router tell you what's going on.
Assuming that we have 3 routers as follows:
Lo0-1.1.1.1(R1)======(R2)=======(R3)Lo0-3.3.3.3
1. We're going to focus on R2. They are all in ospf area 0 and already adjacency. On R2 we do "show ip ospf | include SPF algorithm executed". The output is as follows:
#######################
R2#sh ip ospf | include SPF algorithm executed
SPF algorithm executed 4 times
#######################
2. We try to shut down the loopback0 on R1. R1 exchanges the new LSA to R2. On R2 we do "show ip ospf | include SPF algorithm executed". The output is as follows:
#######################
R2#sh ip ospf | include SPF algorithm executed
SPF algorithm executed 5 times
#######################
3. We try to remove R1 by shutting down the link connected to R1. R1's routes are removed from RIB. We will still see the LSAs from R1 in LSDB on R2 .Just use a "show ip ospf database" command. On R2 we do "show ip ospf | include SPF algorithm executed". The output is as follows:
#######################
R2#sh ip ospf | include SPF algorithm executed
SPF algorithm executed 6 times
#######################
4. We try to clear the routing table by using a "clear ip route *" . This won't re-estrablish a new adjacency between R2 and R3. On R2 we do "show ip ospf | include SPF algorithm executed". The output is as follows:
#######################
R2#sh ip ospf | include SPF algorithm executed
SPF algorithm executed 7 times
#######################
5. If we clear ospf process by using "clear ip ospf process" ,the router will reset the counter and yes it runs SPF again.
#######################
R2#sh ip ospf | include SPF algorithm executed
SPF algorithm executed 1 times
#######################
HTH,
Toshi
04-11-2014 01:55 AM
Hi All,
In my N/W i see the below output in one of my device.
Area 0: SPF algorithm executed 35 times
Summary OSPF SPF statistic
SPF calculation time
Delta T Intra D-Intra Summ D-Summ Ext D-Ext Total Reason
7w0d 0 0 0 0 0 0 0 0x0
7w0d 0 0 0 0 0 0 0 R, X
7w0d 0 0 0 0 8 0 8 R, X
As per my understanding , this above means the SPF algorithm executed last 7week before which means last 7 weeks our N/W is stable . am i right?
I thought , every 30 minutes as OSPF sends the LSA DB , so all the OSPF routers will execute SPF for every 30 minutes , but here as per the output it is not doing like so.
Kindly clarify on this please.
Thanks
04-11-2014 02:20 AM
Hello Steph,
Let me explain you with a simple example
R1--->R2--->R3
R4
R5------------->R6
R1, R2 and R2, R3 are in Area0,
R1--->R4----->R5 area in area 1,
R3----->R4----->R6 are in area 2
now is R4 is an ABR or not? no since R4 is not in area 0 it cannot be an ABR. but if I put the router 4's loopback in area 0 then R4 sets a B bit and the it will give the summary LSA to R5 and R6, but cannot reject the summary LSA recieved over non backbone area from R1 and R3 since it has no interface will neghbor relation ship established in area 0.
but since R1 and R3 both have FULL adjacencies with R2 router in Area0.
They will receive the summary LSAs from R4 but not use them, preferring the same summaries learned via Area 0.
ABR expects summary LSAs from Area 0 only. This means there should
be at least one adjacency in FULL state built over Area 0 interface. In
case if ABR has such adjacency, it will ignore summary-LSAs received
over non-backbone areas. These LSAs will be installed in the database,
but not used for SPF calculations.
04-11-2014 02:39 AM
Hi Thanveer,
Apologies if this is not makes sense . I am now having more queries on this subject .
1) OSPF router will run the SPF algorithm for LSA 1 & 2 types only in the particular area . why is it so? why it wont calculate the SPF algorithm for other than 1 & 2 LSA's.
2)OSPF will send its LSA DB for every 30 minutes to its neighbors . so every 30 mins, will the OSPF routers run the SPF algorithm? or only if they see any new updates on the LSU.
Kindly help on this questions.
04-11-2014 03:38 AM
Hi Ece,
Your questions make scence, Let me answer in this way. Let us discuss what is LSA 3 and who generates it.
Type 3 - Summary LSA - an Area Border Router (ABR) takes information it has learned on one of its attached areas and summarizes it before sending it out on other areas it is connected to. This summarization helps provide scalability by removing detailed topology information for other areas, because their routing information is summarized into just an address prefix and metric. The summarization process can also be configured to remove a lot of detailed address prefixes and replace them with a single summary prefix, also helping scalability. The link-state ID is the destination network number for type 3 LSAs.
LSA 3 is generated only by ABR, now who is the ABR , the router whose interface is in Area 0 and it is not shut. So other non back bone area routers are not ABRs so they cannot generate LSA3. Other NON Backbone area routers will receive this LSA and they will also process these LSAs.
Note:Type 3 LSA’s provide summary information about Type 1 and 2 LSA’s for other areas.
Same Applies to LSA 4.
Now about LSA DB
Once data base is synchronized, messages are sent only on topology change detection, but when ever the topology changes SPF is run on all the links, we also can tune OSPF to run incremental SPF. Please follow this link.
http://www.cisco.com/c/en/us/td/docs/ios/12_0s/feature/guide/ospfispf.html
Hope this satisfies.
BR
Thanveer
"Please rate all Helpful Posts"
04-11-2014 03:38 AM
Thanveer,
It is really very helpful.
Thanks for that info . Hope we interact more .
Thanks
04-11-2014 03:46 AM
You are always welcome dear friend.
BR
Thanveer
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide