Orhan Ergun 31 Comments

OSPF Protocol – OSPF, Open shortest path first is a dynamic routing protocol which creates a topology between the routers to distribute routing information inside an Autonomous system.

If you are not familiar with OSPF, don’t worry ! In this article OSPF will be explained in great detail.

Are you interested in design aspect of OSPF, many OSPF design examples will be covered in the article.

Maybe OSPF network engineering interview question is what you are looking for.

I am going to cover all of the above about OSPF protocol. Just sit down,be focus, enjoy the article !

Latest general OSPF RFC; RFC 2328 was published in 1998 for OSPF.

OSPF routers build a neighborship with each other before starting to advertise link state information.

OSPF protocol packets are used to build and maintaining neighborship and advertising routing information.

OSPF Protocol – OSPF Packet Types : 

  • OSPF Database Description packet : Link State database content is sent within database description packet as summarised.
  • OSPF Hello packet : Used to discover and maintain the neighbouring router. Hello and Down timer is used to maintain neighborship.
  • OSPF Link State Request packet : To make sure if entire database is downloaded from the neighbour
  • OSPF Link State Update packet : Link State information and routing information is sent within link state update packet. OSPF LSA is placed in link state update packet.
  • OSPF Link State Acknowledgement : Similar to EIGRP and IS-IS, OSPF has reliable transport mechanism. OSPF link state acknowledgement packet is used to verify if the packet is received by the neighbor.

OSPF uses different LSA ( Link State Advertisement ) packets for different routing information.

For example if routing information is coming from different routing protocol, such as EIGRP; OSPF uses ‘ External LSA ‘ type to mark those prefixes.

Understanding LSA types is extremely critical for two main reason:

  1. To understand how OSPF areas are created and used.

2.  OSPF LSA types is most common network engineer interview question.

OSPF Protocol – OSPF LSA types :

Router LSA; Also called as type 1 LSA.

Every router within a single area generates a router LSA to advertise link and prefix information.

In an area every router has to have same routing information, otherwise routing loop might occur.

Network LSA; Also called as type 2 LSA.

Type 2 LSA is used to advertise connected routers to multi access network by the DR ( Designated Router).

OSPF uses DR (Designated Router), BDR (Backup Designated Router) on multi access network such as Ethernet.

OSPF DR,BDR will be explained in detail later in the article.

Summary LSA;Also called as type 3 LSA.

Generated by the OSPF ABR (Area Border Router) in multi area OSPF environment.

OSPF ABR doesn’t send topology information between the OSPF areas.

Instability in one  area doesn’t effect the other areas.

Let’s use below OSPF topology to visualise these three important LSA types.

OSPF LSA Types                                                      Figure-1

We have two areas in this topology; Area 0 and Area 10.

Router LSA : All Area 0 and Area 10 routers will generate router lsa to advertise connections and OSPF cost information.

In an Area 0; R1,R2,R3,R4 and R7 generates router LSA.

In an Area 10; R3,R5,R5 and R6  generates router LSA.

Router LSA is generated in Area 0 totally independent from Router lSA generated in Area 10.

OSPF ABR (Area Border Router) generates Summary LSA (Type 3) for each Router LSA.

In this topology since both R3 and R4 has a connection to Area 0 and Area 10, R3 and R4 is an ABR (Area Border Router).

R5 (Router 5) doesn’t know that R7 is connected to R1 and R2.

R5 only knows the subnet between those routers.

ASBR Summary LSA; Also called as Type 4 LSA.

In order to reach to an ASBR (Autonomous System Boundary Router) from different area, ABR creates Type 4 LSA.

External LSA; Also called as Type 5 LSA.

External LSA is used to advertise external reachability information.

R7 is connected to the different routing domain EIGRP.

EIGRP routes is sent by R7 to entire network (Domain) in the External LSA packet.

External LSA is flooded to every router in the domain.

EIGRP routes which are coming from R7 is learned by R5 and R6 in Area 10.

But In order R5 and R6 to use EIGRP information, they need to know how they can reach to R7. Type 4 LSA is used for this purpose.

In area 0, OSPF don’t create Type 4 LSA for the EIGRP prefixes which are coming from R7 since all the routers in an Area 0 use Type 1 (Router LSA) information to reach R7.

NSSA External LSA : Also called as Type 7 LSA.

Used in NSSA (Not-so-stubby) area to allow redistribution external routing information.

OSPF Type 7 LSA will be explained in detail in the OSPF Area types part of the article.

Opaque LSAs : Type 9,10 and 11 are the opaque LSAs.

RFC 5250 ‘ The OSPF Opaque LSA Option ‘ explain these LSAs in great detail.

Type 9 LSA is used for OSPF Graceful Restart operation.

Type 10 LSA is used for MPLS Traffic Engineering.

OSPF Areas is created for scalability. Routing information is removed in some OSPF Area types to achieve scalability.

OSPF Area Types :

OSPF Backbone Area : Also called as Area 0. In order to route between non-backbone areas, OSPF backbone area is used.

OSPF backbone area contains ABR (Area Border Router). ABR has two have backbone and non-backbone area connectivity.

SPF alghoritm is used to calculate the topology in OSPF.

ABR runs SPF alghoritm for each connected area separately.

A router that has a connection to the backbone area is called as backbone router. ABR is a backbone router but backbone router may not be an ABR.

OSPF backbone area has to be contiguous. But may not be physically contiguous.

What does it mean ?



Look at Figure-2.

R9 is connected to R6. We want to place the link between R6 and R9 in Area 20.

I mentioned that router has to have at least one interface in Area 0 to be an ABR.

And summary LSA ( Inter-area routes ) can be received from an ABR.

Since R6 doesn’t have any interface in Area 0 , it is not an ABR.

Thus R6 can’t send neither Area 0 nor Area 10 routes to R9 !

OSPF Virtual Link helps to create an adjacency over Area 0 through non-backbone areas.

In the topology above, virtual link (Yellow)can be created between R6 and R4.

Virtual link is an Area 0 adjacency. Suddenly R6 became an ABR !

Now R9 can receive both Area 0 and Area 10 routes !

OSPF Stub Area : In order to reduce link state database size as well as routing table size, OSPF stub area is used.

OSPF stub area doesn’t allow any external routing information.

R7 redistributes EIGRP information, EIGRP routes will be flooded to every Area 0 router.

But R3 and R4 as an ABR will not allow external prefixes (External LSA) to be flooded into an Area 10.

Area 10 won’t have ASBR summary LSA (Type 4) as well since it will not except External (Type 5) LSA.

OSPF Totally Stub Area : OSPF ABR (Area Border Router) doesn’t prevent OSPF Summary LSA (Type 3) to go into stub area.

For better scalability, Type 3 LSAs can be filtered by doing area as totally stub.

Only configuring OSPF Totally Stub on the R3 and R4 (ABRs) in the above picture, Area 10 can be made Totally stub. Internal Area 10 routers are only configured as stub.

When ABRs are configured as OSPF Totally stub, they start to send default route into an internal area, in this case Area 10.

This behaviour might create suboptimal routing.

I will show suboptimal routing example in the design part of the article.

OSPF NSSA (Not-so-Stubby) Area : In some cases, redistribution might be required in Area 10.

Since Stub Area and Totally Stub Area doesn’t allow External LSA (Type5), a new type of area has been introduced.

NSSA and it’s flavour Totally NSSA areas still don’t allow External LSA but give us redistribution capability.

In NSSA and Totally NSSA Areas, redistributed routes are represented with Type 7 (NSSA External) LSA.



There is a BGP neighborship between R6 in Area 10 and R9 in Figure-3.

Assume we want to make Area 10 NSSA.

Since Area 10 NSSA, any external routes will not be allowed from Area 0 but external routes from R9 over BGP session will be allowed.

The routes within Area10 will be marked as ” N ” routes. ABRs (R3 and R4) don’t send NSSA routes into backbone area as is.

Instead, ABRs translate NSSA External LSA (Type7) and send them into backbone area as OSPF External (Type 5) LSA.

It’s not efficient to translate at both ABR since two copies of same LSA would be sent into backbone.

Thus ABRs elect one translator among them.

The ABR which has lowest OSPF Router ID wins. Only one copy is sent by that ABR into backbone.

Totally NSSA don’t allow External LSA (Type 5) into an area. Thus Type 4 LSA is not created.

But still Summary LSA (Type 3) is allowed with NSSA area.

If you want to reduce link state database and routing table more, which helps to scalability, Totally NSSA Area is used.

OSPF LSA and Area Types are two most commonly asked Network Engineering Interview Questions.

When you design OSPF network, do you ask yourself; Should I design single area ?

Why should I consider multiple area design?

Do you want to just place all your routers in one area and advertise all prefixes into that area ?

It is easy right ?.

You don’t need to worry about ABR placement, you don’t need to have advanced OSPF troubleshooting capability ?.

If It was easy, why we have all these area types, different LSAs, filtering mechanisms?.

Answer is easy.

 ” Scalability “.

if you want to have scalable OSPF network, start considering Multiple Area design.

OSPF Multi Area :

You want to divide your network into multiple areas for many reasons :

  1. Your backbone area stays small. So instability in non-backbone areas don’t effect backbone routers.

The job of your core router is packet forwarding. If one link fails at your remote branch office, you don’t want to calculate OSPF topology.

2.  You can place your routers which have small CPU,memory into same area.

You are only as strong as your weakest link. If there is a link flap,your super fast routers don’t need to wait slow router to converge.

3.  You may want to put the routers which have similar link type into same area.

Some part of your network, you may have slow link such as T1, another part you may have STM-1 or Gigabit Ethernet.

Placing your routers which have a slow connection, you have better convergence.

4.  Routers which have a resource constraint don’t need to keep your entire network prefixes in their routing table.

By placing them into Stub,Totally Stub, NSSA or Totally NSSA, you can reduce routing table perfectly.

You might heard that you shouldn’t place more than some amount of number router in one area.

Don’t place more than 50 routers in one OSPF area !.

Really ?. If this is true, did you think that what might be the reason.

Let me tell you, it is not true , just an OSPF Myth !.

OSPF Myths :

  • You shouldn’t place more than 50 routers in one area !.

No, you can. It depends how many links you have on your routers.

Do those links are stable or flapping every once in a while.

How are your routers connected? Fully meshed ? In a ring ? Partial Mesh ?

Do routers have a resource problem ?

Do you know that SPF algorithm has been evolved since it was invented so, algorithm itself is resource effective.

So, what happens if I put 500 routers in one area? Does that network work ?

Yes, it works. But be careful !

You will be losing all the benefits with the multiple area design which  I mentioned above.

Since all the link information on every router will be placed in Router LSA, you don’t want to exceed MTU (Maximum Transmission Unit) size.

What happens if you exceed MTU size on a router if router LSA grows?

Routers fragment the packet ! Fragmentation is extremely CPU intensive process ! It is bad.

  • You need to install infrastructure links in the routing table.

Infrastructure links are the links which connect your router to each other.

You want to reach the destination behind the router not on the router!

R5 in above figure, don’t need to reach physical interface IP of R7.

If we don’t advertise those infrastructure links in the Router LSA of routers, link state database and routing table size extremely can be summarised.

Infrastructure prefixes can be removed by removing them from Router LSA.

For those who want to have more information about prefix suppression can read RFC 6860 ” Hiding Transit-Only Networks in OSPF “.

OSPF Design Scenario : 

OSPF Multi Area Adjaceny                                                              Figure-4

R1, R2 has high speed link between them. Link speeds and OSPF costs are shown in the topology.

We have two Areas, Area 0 and Area 10.

Red link is in area 0 , Blue links are in Area 10.

R1 doesn’t use R1-R2 high speed link to reach prefixes behind R4.

R1 even doesn’t use R1-R2 high speed link to reach the prefixes behind R2 if they are in Area 10.

The reason is, OSPF prefers intra area prefixes over Inter area.

From R1 point of view, prefixes behind R2 is Inter area since they are connected to area 10.

R1 chooses R1-R3-R4-R2 path to reach to those prefixes.

There are alternate solutions to use that high speed backbone link.

One solution is to put the link between R1 and R2 in Area 10. And create a OSPF virtual link between R1-R2.

Since virtual link will be in area 0, optimal routing seems to be achieved.

But the problem with this approach; you will be placing high speed backbone link in the same area with the slow speed link.

Another solution is ” OSPF Multi-Area Adjacency “. Using one physical link, more than one OSPF adjacency can be built.

For those who want to have more information, RFC 5185 explains the solution in great detail.

So What do you think ?

Which protocol would you like me to write in detail ? Share your insights in the comment box below.


  1. Besides information given in article, questions asked are great as well. Forcing you to learn correct design of ospf network.

    • Thanks Ugur, I am glad you found it helpful. Do you think it would be helpful If I write another post on OSPF design examples or scenario in a separate post ?

      • Hi Orhan,
        The articles are excellent. It would be great to see more design scenario based examples on how the technology fits into real world implementation. This could include new OSPF build, Migration/failover of traffic using OSPF for maintenance etc., Adding new router to a network which will run OSPF, connecting dis contiguous OSPF areas etc.

        • @Pradeep,good points! I want to cover all common technologies in great detail first.Then as you said, more design example scenarios for those technologies will be complementary.Which technology/protocol would you like to see?

          • I would like to see more real life design scenarios based on how companies achieve connectivity based on application services.
            Eg. Video using multicast service, Voice services using QoS, Application database servers connectivity L2(STP,TRILL,fabric path), These kind of services could involve OSPF,BGP,MPLS,NAT,L2 technologies.etc.Probably combine all these in one big awesome design topology :). Just a thought

          • @Pradeep , I see your points.I will be covering all those technologies for sure. In the site there are some examples even in this stage.
            Also as you may know, based on place in the network , it is not “and ” but “or”. I mean you either have TRILL or fabric path which is targeted for datacenter as a PIN ( place in the network ). NAT ( internet edge ) , MPLS ( Primarly WAN , maybe DC ) and so on.
            If more readers interested with real life design example, it is okay , before other planned articles , I write. By the way to be informed from every post asap, don’t forget to subscribe with your email.

      • Orhan , the article is awesome . Specially people can have a quick review of the protocol .Regarding the MTU that you have mentioned I have a question : Does OSPF supports hello padding ?

        • @Hamed Glad you liked it. Quick answer i would say no. I also checked it if there is specific vendor implementation which does padding, I couldn’t see any. As you might know it is in IS-IS for a reason and implementations generally allows you to enable or disable both during neighborship setup and after

        • Digestible technology notes specially for students. I have some question, could you please explain about OSPF HUB & Spoke Design. What are the benefit or drawback of having this term in reality. Do we need this in Backbone or non Backbone or in Enterprise or CE-CE. If not important in real life what will be overcome to HUB & Spoke OSPF. Thanks for sharing this useful post….

          • @Haroon For the hub and spoke topologies , especially for large scale implementations , it is better to stay away from OSPF since you need to manually configure many things for OSPF to works. Also when the spoke site number grows you will need to place them into different areas to minimise the LSDB and routing table , so you need to deal with multi area OSPF design. EIGRP is better for the large scale HUB and Spoke deployments. But as I always say, if you are dealing 20, 30 , 50 sites only , everything does the job.Hope it is more clear now ?

  2. Orhan,

    This is an excellent discussion on OSPF. For people who are not familiar with this protocol, this post gives a great level of detail and can help them understand the reasons why things are configured and the differences between the options this protocol gives. For the people who are familiar with OSPF, this is a great refresher and overview of the protocol as a whole.

    Well done!

    • Hi Orhan,

      Very nice post !!

      Question regarding this part:
      In area 0, OSPF don’t create Type 4 LSA for the EIGRP prefixes which are coming from R7 since all the routers in an Area 0 use Type 1 (Router LSA) information to reach R7

      Do you not mean that within area 0 it is not used because it will use lsa 1 but the ASBR will generate an LSA type 4 and this will be forwarded to other normal area’s to locate the ASBR.

      Thanks !!


        • Oeps a typo I mean ABR creates the type 4.

          Changed the text:

          Question regarding this part:
          In area 0, OSPF don’t create Type 4 LSA for the EIGRP prefixes which are coming from R7 since all the routers in an Area 0 use Type 1 (Router LSA) information to reach R7

          Do you not mean that within area 0 it is not used because it will use lsa 1 but the ABR will generate an LSA type 4 and this will be forwarded to other normal area’s to locate the ABR that originated the type 5 lsa.

  3. Yes, it would be helpful for sure. Particularly, scenarios that are based on different ospf network types would be great.

Leave a Reply

Your email address will not be published.