OSPF Neighborship Condition and Requirement

OSPF is a routing protocol. It shares routing information only with neighbors. Two routers become neighbors only when their Area ID, Network ID, Authentication, Hello and Dead Intervals, Stub Flag, and MTU Size match.

When we start an OSPF running router, it sends Hello packets from all active interfaces. A Hello packet contains all the parameters the receiving router needs to determine whether it should form a neighborhood with the Hello packet sending router. The receiving router compares the hello packet's parameters with locally configured parameters. If both parameters match, the receiving router adds the sending router to its neighbor list and replies with its hello packet. The sending router matches the hello packet's parameters with its parameters. If both parameters match, it adds the receiving router to its neighbor list and replies with another hello packet. At this stage, both routers become neighbors.

hello packet neighborship

Routers match the following parameters to become neighbors.

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

Area ID

OSPF uses areas to scale and optimize networks. OSPF areas serve as logical boundaries for routing information. By default, routers do not share routing information beyond their respective OSPF areas.

Two routers will become neighbors only if they are in the same area. An area covers only an interface of the router, not the entire router. You can configure one router in multiple OSPF areas. For example, a router with a Serial interface and a FastEthernet interface can run the Serial interface in one area and the FastEthernet interface in another. To ensure that two routers are in the same area, the link connecting them must be in the same area, including the interfaces at both ends.

Let us take an example.

In the following network, R2 and R4 belong to different areas. They will not become neighbors. R1, R2, and R3 belong to the same OSPF area. They will check the remaining parameters to build a neighborship.

Similarly, R4, R5, and R6 belong to the same OSPF area. They will also check the remaining parameters to build a neighborship.

ospf area neighbor

Network ID

Network ID is not a requirement of the OSPF neighborship. But, it directly affects the process of becoming neighborship. A link comes up only when both end interfaces have an IP address from the same subnet. If both end interfaces have an IP configuration from different IP subnets, they can not exchange IP packets. OSPF uses IP packets to share information between interfaces. If two interfaces can not exchange IP packets, they can not build an OSPF neighborship.

In the preceding example, R2 and R3 belong to the same OSPF area. However, they can not become neighbors. The link that connects them has IP configuration from different subnets. The R2's Fa0/2 interface has the IP address from the subnet 192.168.0.4/30. The R3's Fa0/1 interface has the IP address from the subnet 192.168.0.16/30. The R3's Fa0/1 has the wrong IP configuration. It should have an IP configuration from the subnet 192.168.0.4/30. The correct IP address of it will be 192.168.0.6/30.

ospf neighborship network id

Authentication

To enhance network security, OSPF allows you to configure the password for specific areas. Routers who have the same password will be eligible for neighborship. To use this facility, you must configure the password on all routers you want to include in the password-secured network. If you skip a router, the router will not join this network.

In the preceding example, if we configure a password on R1 and leave R2 as it is, they will not become neighbor even if all other conditions match.

ospf neighborship authentication

When both routers see each other's Hello packets in the segment, they try to match all neighborship configuration values, including the password field. One packet contains a value in the password field, while the other is empty. In this case, the routers will ignore each other's packets.

Hello and Dead Intervals

An OSPF router uses hello packets to discover and build neighborship with other OSPF routers in the network. It sends hello packets at a specific interval. This interval is known as the hello interval. After building the neighborship, it uses hello packets to maintain the neighborship. The default Hello interval is 10 seconds.

It accepts a hello packet every 10 seconds from the neighbor. If it does not receive a Hello packet in a Hello interval, it waits till a specific period. This period is known as the dead interval. After the dead interval, it removes the router from the neighbor list. The default dead interval is 40 seconds.

Two routers will become neighbors only when their hello and dead interval match.

hello and dead interval

Stub flag

OSPF allows us to configure certain areas as stub areas. OSPF does not flood external networks in the stub areas. Routing from stub areas to the outside world is based on a default route. Stub area configuration reduces

the topology database size and memory requirement. A stub area has a single exit point. Two routers will become neighbors only when the stub area flag matches.

MTU

MTU (Maximum Transmission Unit) is an optional requirement. Routers can become neighbors even if their MTU values do not match. However, they will not be able to exchange routing updates. For error-free OSPF operation, you must keep this value the same on all routers.

ComputerNetworkingNotes CCNA Study Guide OSPF Neighborship Condition and Requirement