An OSPF device obtains link information from an interface and then establishes adjacencies with neighbors to exchange the link information. Before establishing adjacencies, these devices need to determine their roles to establish connections. The State field in OSPF interface information (displayed using the display ospf interface command) indicates the function of an OSPF device on a link.
The OSPF interface state machine has the following states:
Down: This state is the initial state of an OSPF interface. If an OSPF interface is Down, it is unavailable and cannot receive or transmit traffic.
Loopback: An OSPF interface that connects a device to a network is in Loopback state. A loopback interface cannot transmit data but its IP address can be advertised using Router-LSAs. Therefore, other devices can learn about paths to this IP address during a connectivity test.
Waiting: The device is determining the DR and BDR on the network. Before the device participates in DR and BDR election, the wait timer starts on an OSPF interface. Before this timer expires, the Hello packets sent by this device do not contain DR and BDR information, and the device cannot be elected as the DR or BDR. This prevents the existing DR and BDR on the link from being changed unnecessarily and ensures stability. This state exists only on NBMA and broadcast networks.
P-2-P: An OSPF interface is connected to a P2P network or virtual link. In this situation, the device establishes an adjacency with the device on the other end of the link. This state exists only on P2MP networks.
DROther: The device is not elected as the DR or BDR. This device will establish an adjacency with the DR and BDR.
BDR: The device functions as the BDR on the network and will become the new DR if the existing DR fails. This device establishes adjacencies with all the other devices on the network.
DR: The device functions as the DR on the network. This device establishes adjacencies with all the other devices on the network.
OSPF interfaces alternate among the preceding states based on the InputEvents (IEs), forming an efficient interface state machine, as shown in Figure 1.
Table 1 lists the IEs triggering interface state switchovers.
InputEvent |
Description |
---|---|
IE1 |
InterfaceUP: Lower-layer protocols indicate that an OSPF interface is available. |
IE2 |
WaitTimer: The wait timer expires, indicating that the DR/BDR election waiting time ends. |
IE3 |
BackupSeen: The device with an OSPF interface has detected whether there is a BDR on the network. This event occurs in either of the following situations:
Both situations indicate that neighbors have communicated with each other and the Waiting state ends. |
IE4 |
The device is elected as the DR on the network. |
IE5 |
The device is elected as the BDR on the network. |
IE6 |
The device is not elected as the DR or BDR on the network. |
IE7 |
NeighborChange: An interface-related neighbor relationship change event occurs, indicating that the DR and BDR need to be elected again. The following neighbor relationship changes may result in DR/BDR re-election:
|
IE8 |
UnLoopInd: The NMS or lower-layer protocols indicate that the interface is not in Loopback state any longer. |
IE9 |
InterfaceDown: Lower-layer protocols indicate that the interface is unavailable. Any state may change to the Down state after this event is triggered. |
IE10 |
LoopInd: The NMS or lower-layer protocols indicate that the interface is in Loopback state. Any state may change to the Loopback state after this event is triggered. |
On an OSPF network, neighbors establish adjacencies through neighbor state switchovers, and then exchange LSAs.
The State field in OSPF neighbor information (displayed using the display ospf peer command) indicates the neighbor status of an OSPF device.
The OSPF neighbor state machine has the following states:
Down: This is the initial state of a neighbor session. This state occurs when a device does not receive any Hello packets from its neighbors within a dead interval. Only OSPF routers on an NBMA network send Hello packets to neighbors at each poll interval, including the neighbors in Down state.
Attempt: This state is only used on NBMA networks where neighbors are manually configured. When the neighbor relationship is in Attempt state, an OSPF router sends a Hello packet to its manually configured neighbors at each Hello interval, attempting to establish neighbor relationships.
Init: This state occurs after the router has received a Hello packet from its neighbor but has not established a two-way session. In Init state, the neighbor does not receive any Hello packet from this router, and the neighbor list in the received Hello packet does not contain the router ID of the local router.
2-Way: This state occurs when a router and its neighbor receive Hello packets containing their own router IDs from each other and establish an OSPF neighbor relationship. If no adjacency needs to be established, the two neighbors remain in 2-Way state. If an adjacency needs to be established, the neighbor enters the Exstart state. The DR and BDR are elected only when the neighbor state is 2-Way or higher.
ExStart: This state occurs when two neighbors start to negotiate their master/slave roles and determine the sequence numbers of DD packets. Entering the Exstart state is the first step in setting up an adjacency.
Exchange: This state occurs when two neighbors exchange DD packets. In this state, DD packets contain LSDB information.
Loading: This state occurs when two neighbors are synchronizing their LSDBs. The two devices send LSR packets to request LSAs from each other to synchronize their LSDBs.
Full: This state occurs when two neighbors complete their LSDB synchronization and establish an adjacency.
Figure 2 shows an OSPF neighbor state machine.
Table 2 lists the IEs triggering neighbor state switchovers.
InputEvent |
Description |
---|---|
IE1 |
Start: A router sends a Hello packet to its neighbors at each Hello interval, attempting to establish neighbor relationships. This event exists only on NBMA networks. |
IE2 |
HelloReceived: The router receives a Hello packet from a neighbor. |
IE3 |
2-WayReceived: The router receives a Hello packet containing its router ID from a neighbor and implements two-way communication with this neighbor. The router then determines its neighbor state:
|
IE4 |
NegotiationDone: The two neighbors have negotiated their master/slave roles and exchanged sequence numbers of DD packets. |
IE5 |
ExchangeDone: The two neighbors have exchanged their DD packets. One of the two routers then determines its neighbor state:
|
IE6 |
LoadingDone: The link state request list is empty. |