Table of contents
- Neighborship Criteria
- OSPF Neighbor and Adjacency States
- Phase 1 - Neighborship States
- Phase 2 - Adjaceny States
- Conclusion / Summary
- Related Lessons
- Other Related Materials
OSPFv3 Neighborship and Adjacency describes the process that routers in an Area must go through before they can share OSPF routing information.
Routers in an Area must first form a neighborship and then form an adjacency. This is done by routers communicating using IPv6’s link-local address. To use IPv6 to transmit and receive data, the interfaces must also be assigned a Global Unicast Address (GUA).
If we are implementing Dual Stack, and we wanted to begin by advertising only IPv4 addresses, we still need to configure link-local addresses and issue the ipv6 unicast-routing command to create the IPv6 routing table.
In an attempt to form a neighborship, an OSPFv3 router will send Hello packets to discover possible neighbors. Hello packets contain all of the information needed to form and maintain a neighborship.
When attempting to form a neighborship, it's important that all of the following values contained in the Hello packet match:
- OSPFv3 Process
- Unique Router ID
- Area ID
- Hello and Dead Intervals
- Stub Flag
- MTU Size
Pro Tip: The Area ID, Authentication, Hello and Dead Intervals and Stub Flag values in the Hello packet are required for a neighborship to form. While the MTU size doesn’t need to match to form a neighborship, however, the MTU size must match to prevent OSPFv3 database inconsistencies that cause problems forming an adjacency.
Areas must share the same OSPF process.
While this is obvious, I’ve listed it because in OSPFv3 enabling a process under an interface automatically causes a new process to be formed. Stay organized and verify often to help avoid troubleshooting later on!
Note that the same interface can participate in multiple OSPFv3 processes.
The interfaces on either side of the link must be in the same subnet.
Unique Router ID
Routers identify themselves with an OSPFv3 router ID. We don't want
OSPFv3 routers to get confused with multiple routers using the same
Router ID. This is could be an issue when merging networks.
To help make OSPF scalable, it uses the concept of Areas. Areas are logical divisions of a network.
In the following diagram we can see there are two Areas. One Area has the Area ID of Area 0, while the other Area has the Area ID of Area 1:
- Neighboring interfaces must be in the same Area:
- R-1 and R-2 have neighboring interfaces in Area 0
- R-2 and R-3 have neighboring interfaces in Area 1
- If a router has interfaces in different Areas, it is called an Area Border Router (ABR).
- R-2 has an interface in Area 0 and a different interface in Area 1
To illustrate how the concept of areas makes OSPF scalable, let’s consider if R-1 represented 100 routers and R-3 also represented 100 routers.
Instead of each router learning about 199 other routers, a router can learn about the other 99 routers in its Area and one summary route to the other Area. A router now learns 100 routes, instead of 199.
Let's consider another example at a larger scale.
If we have a network of 500 routers, we can create five Areas with 100 routers each. Rather than learning about 499 other routers, now a router can learn about 99 other routers in its Area and four summary routes that lead to the other four Areas. A router can now learn 103 routes, instead of 499.
There are other techniques specific to OSPF to make networks even more scalable that are discussed later.
OSPFv3 uses the authentication (and encryption) built into IPv6.
Hello and Dead Intervals
Hello packets are sent every 10 seconds by default. Said another way, Hello Interval = 10 seconds by default.
If a neighbor doesn't receive a Hello packet from a neighbor before the Dead Interval expires, the neighbor is considered lost. The router will then notify its other neighbors about the topology change. Dead Interval = 40 seconds by default.
Stub Area Flag
The Stub Area flag denotes if the Area is a special type of Area called a Stub Area.
This makes sense because neighbors must have the same Area ID (be in the same Area) and this Area must be a Stub or non-Stub Area.
Maximum Transmission Unit (MTU) Size
If a router receives a packet that is larger than its Maximum Transmission Unit (MTU) value, it will ignore it. This will prevent the OSPFv3 database from being updated and cause the neighbors to get stuck in the Exstart or Exchange state while trying to form an adjacency. The Exstart and Exchange states are described later in this lesson.
OSPF Neighbor and Adjacency States
In the previous section, we've discussed the requirements and conditions for being a neighbor. In this section, we'll discuss the 7 states that must be achieved, in order, before routers can begin to share OSPF routing information:
I'm going to break these 7 states into two phases.
Phase 1 is concerned with forming the neighborship.
Phase 2 is concerned with forming the adjacency.
A neighborship forms in states 1-3 when the neighbors agree that the parameters in the Hello packets (described above) of each router match.
An adjacency is achieved in states 4-7 when the parameters for sharing the OSPF routing information are agreed upon and then the OSPF routing information is actually exchanged.
Phase 1 - Neighborship States
A router configured for OSPF begins the neighboring process in the Down state.
In the Down state, the router gathers information for its Hello packets. This information includes the device's Router ID (RID) and the items listed in the Neighborship Conditions and Requirements section above.
A router in the down state, by definition, has not yet received a Hello packet from a potential neighbor.
Pro Tip: It is possible for a correctly configured router to be in the down state and send Hello packets. Again, a router needs to receive a Hello packet to move to the next neighborship state.
The Init and Attempt States are both states where a router sends a Hello packet and then waits for a response.
The Init or the Attempt state will be used, depending on the network type and configuration..
A Hello packet has been received by a potential neighbor, but the receiving router's Router ID wasn't included in the Hello packet.
This happens when the sending router is the first to send a Hello packet and the receiving router hasn't sent a Hello packet (with its Router ID in it), yet.
The Attempt state is the similar to the Init state, but it's used in NBMA (Non-Broadcast Multi-Access) networks that are manually configured with the neighbor command.
In a multi-access network, a router that has just received a Hello packet (via multicast) with acceptable parameters, will look to its neighbor table and see that it doesn't have the sending router's Router ID in it.
It will then add the sending router's information from the Hello packet to its neighbor table and reply with its own Hello packet to the sender's unicast address. (The unicast address was learned from the received Hello packet).
P2P and P2multipoint networks have a similar process, except they only use unicast.
Upon receiving a Hello packet with its own Router ID in the Neighbor field, the router will achieve the two-way state.
FYI: Receiving a DBD (Database Descriptor) packet can also achieve the 2-Way state.
To summarize the above:
- R1 sends a Hello Packet to the OSPFv3 multicast address.
- R2 receives the Hello packet from R1 via multicast, adds R1's information to its neighbor table, and replies with its own Hello packet via unicast.
- R1 receives the Hello packet from R2 with its own Router ID. This is verification that they are successfully communicating and R1 enters the 2-Way state.
Upon achieving the 2-Way state, the neighborship has been formed and now the new neighbors can begin Phase 2 to form an adjacency.
Phase 2 - Adjaceny States
As mentioned above...after achieving states 1-3, the neighborship has been formed and now the neighboring routers can begin working on states 4-7 to form an adjacency.
Adjacent OSPF neighbors can exchange and synchronize their OSPFv3 databases. Simply being neighbors isn't enough to do that.
Adjacencies are formed a little differently depending on the network type...
Adjacency and Network Types
There are two ways that an adjacent can be formed depending on the network link type of the neighbors. Network link types to be considered are:
- Point-to-point and point-to-multipoint
- Non-Broadcast Multi-Access (NBMA)
Pro Tip: The network types must be the same both ends of an OSPFv3 link. Otherwise, the OSPFv3 neighbor relationship cannot be established.
Point-to-Point and Point-to-Multipoint
Neighbors with these link types are statically configured with the neighbor command.
The neighbor command must specify the link-local address of the neighbor.
Routers achieve an adjacency with all connected neighbors.
Non-Broadcast Multi-Access (NBMA)
NBMA networks can use a Designated Router (DR). The DR collects routing information from all routers in an Area and then delivers the learned routing information to all routers in an Area. This greatly reduces bandwidth and CPU overhead.
A Backup Designated Router (BDR) also collects router information from all the routers in the Area...the same as the DR. The difference is that it doesn't deliver the information. If the DR fails, a BDR will become the DR and then will begin delivering the routing information.
By definition, routers can only become adjacent with the DR and BDR. All other neighbors in the Area remain in the 2-Way state.
Pro Tip: An NBMA network can have multiple BDRs.
Pro Tip: Plan for OSPFv3 neighbor relationships on a NBMA network to take some time to form. Don't troubleshoot to soon!
Neighbors that have achieved all 7 states, and thus can exchange and synchronize their OSPF databases, have an Adjacency.
The formation of an adjacency begins with the Exstart state which defines who sends information first. The router on the link with the higher RID (Router ID) will become the Master for that link and the other router becomes the Slave for that link. It's important to understand that Master/Slave is chosen for each link and not the Area.
The Master sends its information first and has the sole responsibility of incrementing sequence numbers that are used between the Master and Slave to keep their updates in order.
Again, what happens in this state depends network link type of the neighbors.
Point-to-Point and Point-to-Multipoint Network Types
Neighboring routers with point-to-point and point-to-multipoint link types form an Adjacency directly with each other:
Note that OSPFv3 routers use a 32-bit RID that has the same format as an IPv4 address.
Non-Broadcast Multi-Access (NBMA) Networks
NBMA networks can elect a Designated Router (DR) and a Backup Designated Router (BDR).
As mentioned above, routers will only exchange their link state information with the DR and BDR. In turn, the DR will share the link state information it receives to all other routers in the OSPF Area.
Routers only establish a master-slave relationship with their DR and BDR(s):
Pro Tip: Since the DR and BDR can be elected by priority (instead of the highest Router ID), it is possible that the DR can become the Slave.
In the Exchange state OSPF routers exchange Database Descriptor (DBD) packets.
Database descriptors contain Link State Advertisement (LSA) headers (not the entire LSA packet). The LSA headers briefly describe all of the entries in the Link State Database (LSDB).
Only the Master can increment the sequence number in a Database Descriptor (DBD) packet. The slave acknowledges receipt of each DBD packet.
Note: A router that has more than one active interface in an Area may learn the same network information from different sources. Routers learn information, add it to their database and then pull information from their database to send to other routers. Receiving the same information from multiple routers is normal and not an issue.
In the Loading state, the actual exchange of link state information occurs.
When a router receives a DBD packet from a neighbor, it compares the information inside it with its Link State Database (LSDB) to see if its LSDB needs to be updated.
If it does need an update, the router will only ask for the update(s) it needs by sending an Link State Request (LSR). After the neighboring router receives the LSR, it will send a Link State Update (LSU), which contains the entire LSA.
After receiving an LSU, the receiving router sends an Link State Acknowledgment (LSAck) packet.
Routers maintain a list of sent LSAs so they can check to see if an acknowledgment for sent LSAs was received. If an acknowledgment isn't received, the LSA is re-sent.
This process continues until all requests from the LSR list have been received.
To illustrate how the Loading state works, let's look at an example.
In the diagram below, R1 sent an LSU which contains two LSAs, but it received acknowledgment of only one LSA, so it had to resend the LSA for which no acknowledgement was received..
In the Full state, routers have achieved an adjacency with each other. Achieving the Full state means OSPF is functioning properly:
- Neighborship formed
- Adjacency formed
- All routers in an Area have fully synchronized Link State Databases (LSDBs)
In Point-to-point and Point-to-Multipoint networks a router should be in the Full State with every neighboring router.
In NBMA networks with a DR/BDR, routers will achieve the Full State with their DR and BDR routers only.
Routers will remain if the Full state until there is a change to the link information within their Area (this includes summary routes to other Areas), then they will go through the adjacency process again.
Full state indicates that routers in an Area have exchanged all LSAs from their LSR lists and their Link State Databases (LSDBs) are completely identical...and thus have an adjacency.