OSPF Neighborship Condition and Requirement

This tutorial explains OSPF Neighborship requirements (Area ID, Network ID, Authentication, Hello and Dead Intervals, Stub Flag and MTU Size) and conditions in detail with examples. Two routers cannot become OSPF neighbor until these configuration values match on both routers.

OSPF routers share routing information only with neighbors. OSPF uses hello packets to discover neighbors in segments. A hello packet contains some essential configuration values that must be same on both routers who want to build an OSPF neighborship. In this tutorial we will explain these configuration values in detail with example.

OSPF Neighborship Requirement

In order to become OSPF neighbor following values must be match on both routers.

  • Area ID
  • Authentication
  • Hello and Dead Intervals
  • Stub Flag
  • MTU Size

This tutorial is the second part of our article “OSPF Routing Protocol Explained with examples". You can read other parts of this article here.

OSPF Fundamental Terminology Explained

This tutorial is the first part of this article. In this part we explained basic terminology of OSPF such as Feature , Advantage and Disadvantage, Autonomous System, Area concept, ABR, IR, Link, State ,LSA and LSDB with example.

OSPF Neighbor States Explained with Example

This tutorial is the third part of this article. OSPF adjacency process goes through the seven states; OSPF State down, OSPF State Init, OSPF State two ways, OSPF State Exstart, OSPF State Exchange, OSPF State Loading and OSPF State full. This part explains these states with DR BDR selection process in detail with examples.

OSPF Configuration Step by Step Guide

This tutorial is the fourth part of this article. Configuration part of OSPF includes process ID, Area ID and wildcard mask which make its setup a litter bit harder. This part explains these parameters in detail with examples.

OSPF Metric cost Calculation Formula Explained

This tutorial is the last part of this article. In this part we will explain OSPF metric component bandwidth, Delay, Load, Reliability and MTU with cost calculation formula in detail with examples.

Area ID

OSPF uses area concept to scale an enterprise size network. I have explained OSPF Areas in first part of this article. Just for reference, OSPF areas create a logical boundary for routing information. By default routers do not share routing information beyond the area. So in order to become neighbor, two routers must belong to same area. Here one confusing fact needs to clear. Area is associated with specific interface, not with entire router. This allows us to configure the router in multiple areas. For example a router that has two interfaces; Serial interface and FastEthernet interface, can run Serial interface in one area and FastEthernet in another area. It means link which connects two routers need be in same area including its both ends interface. Beside this interfaces should have same network ID and subnet mask.

Following figure illustrate a simple OSPF network. In this network R1 is eligible to form neighborship with R4 and R2 respectively on S0/0 and F0/0.

ospf neighborship requierment area id

I have question for you. Why neighborship cannot be built between R1 and R3?

Let’s find out the answer step by step.

Both interfaces should be in same area.
Yes both interfaces ( R1’s Fo/1 and R3’s F0/1) are in same area.

Both interfaces should be in same segment.
Yes both interfaces ( R1’s Fo/1 and R3’s F0/1) are connected with direct link.

Both interfaces should have same subnet mask.
Yes both interfaces have same subnet mask /30.

Both interfaces should have same network ID.
No both interfaces have different network ID. R1’s F0/1 has network ID while R3’s F0/1 has network ID This condition does not match. Thus these two routers on these interfaces cannot build neighborship.


To enhance the security of network, OSPF allows us to configure the password for specific areas. Routers who have same password will be eligible for neighborship. If you want to use this facility, you need to configure password on all routers which you want to include in network. If you skip any router, that will not be able to form an OSPF neighborship.

Suppose that our network has two routers R1 and R2. Both routers are connected with direct link and meet all criteria mentioned in first requirement. What if I configure password in R1 and leave R2 as it is? Will it form neighborship with R2?

Well in this situation neighborship will not take place. Because when both routers see each other’s hello packet in segment, they try to match all configure values including password field. One packet has a value in password filed while other has nothing in it. In this case routers will simply ignore each other’s packet.

Hello packets and hello interval

Hello packets are the special type of LSAs (Link State Advertisements) which are used to discover the neighbors in same segment. And once neighborship is built same hello packets are used to maintain the neighborship. Hello packets contain all necessary information that is required to form a neighborship. Hello packets are generated and distributed in hello interval via multicast. Hello interval is the length of time in seconds between the hello packets. Default hello interval is 10 seconds.

Dead Intervals

As we already know once neighborship is built, hello packets are used to maintain the neighborship.

So a router must see hello packets from neighbor in particular time interval. This time interval is known as dead interval. Dead interval is the number of seconds that a router waits for hello packet from neighbor, before declaring it as dead.

Default dead interval is 40 seconds. If a router does not receive hello packet in 40 seconds from neighbor it will declare that as dead. When this happens, router will propagate this information to other OSPF neighboring router via LSA message.

ospf hello dead interval

Hello and dead interval must be same between two neighbors. If any of these intervals are different, neighborship will not form.

Stub Area Flag

This value indicates that whether sending router belong to stub area or not. Routers who want to build OPSF neighborship must have same stub area flag.

For example we have two routers R1 and R2:-

  • Both routers belong to same stub area, neighborship can be built
  • Both routers belong to different stub area, neighborship cannot be built
  • Both routers do not belong to any stub area, neighborship can be built
  • Only one router belongs to a stub area, neighborship cannot be built

Just like another areas, Stub area also has some specific meanings in OSPF hierarchal design.

A stub area has following requirements:-

  • A stub area can have only single exit point from that area.
  • Stub area cannot be used as a transit area for virtual links.
  • Routing from stub area to outside of the area should not have to take an optimal path.
  • Any external networks (redistributed from other protocols into OSPF) should not be flooded in stub area.

Configuring a stub area reduces the size of topology table inside that area. Thus routers running in this area require less memory.


Technically MTU (Maximum Transmission Unit) is not a part of compulsory matching conditions. Still we should match this value. If this value does not match routers may stuck in Exstart/Exchange exchange stage.

Consider a situation where MTU setting between two OSPF routers does not match. If the router with the higher MTU sends a packet larger than the MTU set on the neighboring router, the neighboring router will ignores this packet. This function creates serious problem for database updates. Database updates are heavier in nature. Once an update becomes larger than the configured MTU setting, it needs to be spilt. In a case of miss match MTU, database update may lost few bytes. Due to this, OSPF will ignore that update and cannot sync with database. It will be stuck in Exstart/Exchange stage.

It is always worth to spend a little extra time in matching optional values along with compulsory values. Matching configuration values will make troubleshooting easier.

That’s all for this part. In next part we will learn how OSPF routers build neighborship in detail with examples.

ComputerNetworkingNotes CCNA Study Guide OSPF Neighborship Condition and Requirement