What command can you use to view ospf neighbors? Show ip neighbor displays all neighbor information of OSPF.
Two OSPF routers must meet four conditions to form an OSPF neighbor. The four necessary conditions are as follows:
- Area id (Area number)
That is, routers must be configured in the same OSPF area, or they cannot become neighbors.
- Hello and Dead Interval(Hello time and Dead time)
That is, the Hello time and Dead time of routers must be consistent, otherwise, neighbors cannot be formed.
Routers must be configured with the same authentication password. If the passwords are different, neighbors cannot be formed.
- Stub Area Flag
The last node labels between routers must be consistent, that is, they are in the same last node area, or they cannot form neighbors.
On this page
OSPF Neighbor Establishment Phase
- At the initial stage, R1 does not know who its neighbor is. When sending a hello package to R2, the neighbor appears empty.
- When R2 receives the hello package sent by R1, it finds that there is no self in the hello, so it adds the route id of R1 to its neighbor list in the hello package. At this time, the status is init (it receives the hello package but does not see itself in the neighbor list).
- R1 receives R2’s hello package and sees itself in the neighbor list. At this time, the status is 2-way. R1 adds R2’s route id to the neighbor list in its own hello package and sends it to R2.
- R2 receives a hello package with its own route id, and the status changes to 2-way. Neighbor establishment is completed.
Eight states of OSPF neighbors
- Down: No hello packet was received from the neighbor.
2.Attempt: used for NBMA network connection, and indicates that no new information is received from this neighbor.
- Init: You receive a hello message from another router, but you do not see your router ID in the hello message.
- 2way: The neighbor field of the hello message received from the neighbor contains its own router ID. In this state, DR and BDR are elected.
- ExStart: establish the master/slave relationship and determine the initial DD serial number to prepare for DD message exchange. The router with the highest router ID will become the master router.
- Exchange: The router describes its own complete link status database to the neighbor by sending a DD message. At the same time, the router can also send an LSR message to request an updated LSA.
- Loading: The router will send an LSR to the neighbor to request a new LSA found in the Exchange state, and receive a response message (LSU) to the requested LSA.
- Full: All LSAs in the LSDB of the neighbor router are available. The router and the neighbor router form an adjacency relationship.