Showing results for 
Search instead for 
Did you mean: 

How ospf works



I have attened the interview last week.

These are questions are asked:

1.)How ospf estabilshed a neighbour?

2.)what are requirements should be the neighbour?

3.)what is LSA and what are the states are there?

4.)How ospf elects DR and BDR?when it is estabilshed?

If anybody know the answer pls tell me.

Also anybody have interview preparation of routing protocols?

If u have pls is very helpful for me further interview.


Peter Paluch
Hall of Fame Cisco Employee Hall of Fame Cisco Employee
Hall of Fame Cisco Employee

Hello Dineshkumar,

The scope of these questions encompasses a general basic course of OSPF - so it's hard to be both concise and reasonably comprehensive here. There are lots of good materials on OSPF out there, just try to Google for "ospf tutorial", "ospf basics", "ospf primer", "introduction to ospf", "ospf explained" etc.

Very shortly about your questions:

1.)How ospf estabilshed a neighbour?

OSPF routers send Hello packets to declare their presence on a network segment and listen for other routers. These Hellos are either multicast to or unicast by static configuration. After OSPF router receives a Hello packet from a neighboring router on the same segment, it performs a series of checks and if they pass, the router is considered a neighbor.

2.)what are requirements should be the neighbour?

  • Identical area number and type
  • Identical netmask, both routers being in the same IP network
  • Identical Hello and Dead intervals
  • Matching authentication (if used)
  • Unique Router IDs

3.)what is LSA and what are the states are there?

LSA, or Link State Advertisement, is a data structure used by OSPF to describe an object of the network, its properties and its relation to other objects in the network. There are several types of LSAs in OSPF:

  • LSA1: Router-LSA. Describes a router and its direction connections to stub networks, transit networks and other routers.
  • LSA2: Network-LSA. Describes a multiaccess transit network and its connections to other routers attached to it.
  • LSA3: Summary-LSA. Describes IP prefixes located in other areas
  • LSA4: Summary-LSA. Describes the autonomous system boundary routers (ASBR routers) present in other areas
  • LSA5: External-LSA. Describes external routes redistributed by ASBRs into the OSPF from outside.
  • LSA7: NSSA-LSA. Describes external routes redistributed by ASBRs into the OSPF from outside, specifically in NSSA areas.

There are no states related to LSAs. There are states related to establishing an adjacency between two routers.

4.)How ospf elects DR and BDR?when it is estabilshed?

OSPF elects DR and BDR routers on every multiaccess segment in a network. The elections are performed in the 2Way state based on member routers' interface priorities and Router IDs. The router with the highest priority becomes the DR, the router with the second highest priority becomes the BDR. If at any point, the priorities are the same, Router ID will be used as a tiebreaker: the router with the higher Router ID will win the particular position. Also, DR/BDR elections are non-preemptive. Once the DR/BDR have been elected, an arrival of a new router with a higher priority will not cause the elections to be repeated.

Best regards,


hi peter,

Thanks for ur valuable information.

Finally i have one question.

What is hello packet?what information they have?

Hi Dinesh,

As you may know that there are 5 types of OSPF packets there are....

Hello packet
Database Descriptor packet
Link State Request packet
Link State Update packet
Link State Acknowledgment packet

In that hello is a protocol used by OSPF routers to find the neighbor devices and it also used to establish neighbor relations ships in between OSPF routers.

And Hello Packet contains the following data:

1. ROUTER ID = Router ID, this is a 32-bit number that is unique to this router
2. HELLOS & DEAD INTERVALS = Hello and dead interval Period of time between hellos and the dead timer, these values must match between two routers becoming neighbors 
3. NEIGHBOUR LIST = Is a List of neighbor Router Ids that this router sees as their neighbor
4. AREA ID = Area ID Area number, this value must be identical between two routers becoming neighbors
5. ROUTER PRIORIY = Router Priority of this interface, the router advertising the highest priority is elected    the designated router during the DR/DBR election process.
6. ROUTER ID = The Router ID of who this router believes is the DR and BDR IP address of designated routers
7. AUTHENTICATION = If you have authentication set it is important that the Password matches between the two    routers becoming neighbors.
8. STUB AREA FLAG = If the routers becoming neighbors are in a Stub Area, then the Stub Area Flag must be set

Hope the above make you clear understand about OSPF packets.
Please rate the helpfull posts.

Thanks for ur information.

Finally i have a one question.

In bgp how many states are there and what does the states??

Well, BGP goes through six states to establish an adjacency.

Idle: Incoming connections are refused, and the system gets ready to start speaking BGP. After this is done (by way of a Start event), move to Connect.

Connect: A connection is made to the peer. Send a BGP OPEN message, and go to OpenSent.

Active: A connection comes in from a peer. Send a BGP OPEN message, and go to OpenSent.

OpenSent: Wait for an OPEN message from the peer. When received, send a KEEPALIVE and go to OpenConfirm.

OpenConfirm: Wait for the KEEEPALIVE from the peer, and then move to Established.

Established: Bidirectional communication is established. Start sending UPDATE and KEEPALIVE messages as required.

Please rate the helpfull posts.

Bgp using any protocol to establish a neighbor???

U have any clear document for BGP protocol kindly give me...

Two BGP routers become neighbors after the routers establish a TCP connection between each other. The
TCP connection is essential in order for the two peer routers to start the exchange of routing updates.

After the TCP connection is up, the routers send open messages in order to exchange values. The values that
the routers exchange include the AS number, the BGP version that the routers run, the BGP router ID, and the
keepalive hold time. After the confirmation and acceptance of these values, establishment of the neighbor connection occurs. Any state other than Established is an indication that the two routers did not become neighbors and that the routers cannot exchange BGP updates.

Issue this neighbor command to establish a TCP connection:
neighbor ip−address remote−as number

Please rate the helpfull posts.

Peter Paluch
Hall of Fame Cisco Employee Hall of Fame Cisco Employee
Hall of Fame Cisco Employee

Hi Dineshkumar,

Hello packet is one of five OSPF packet types. Hello packets are used to detect other neighbors on the same network segment, verify their continuous presence, confirm the ability of routers to hear each other, check the most important OSPF configuration parameters and help in DR/BDR elections.

In the attachment, you can find a series of OSPF hellos exchanged between two routers. Use the Wireshark to open and analyze the file.

Best regards,


Thanks for ur Information.

Please close the case if your query answered.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: