Enhance your Career in Networking With IPinBits!!!​

OSPF Adjacency States

Let’s check the OSPF adjacency State Machine, how OSPF routers go through various states before becoming adjacent.

OSPF Routers goes through below 7 states / 8 states (in case NMBA)

Let have a look at all states in details with short lab and debug output to get more insights.

Down: At this point no hello message received at any router.

Attempt: This state comes only in NBMA wherever we configure manual Neighbors statement, hello is sent at regular intervals.

Init: One of the routers send the hello but its not received any hello yet, i.e. no bidirectional communication established as of now.

Two-way: Routers see their own RID (router-id) in the hello packet received, indicating two-way communication channel is established. This is state in which routers decide who becomes DR and BDR (more on DR /BDR election in another Blog) for multiaccess network.

Exstart: Once the two-way state is established, OSPF routers will select master/slave in order to exchange database and topology info, who becomes master? The router with the highest RID becomes the master, in the below case, 3.3.3.3 becomes master 2.2.2.2 becomes slaves as shown in the below debug output. Sequence no are used in order to sync the DBD packets. MTU is also exchanged inside the DBD packet, if there is MTU mismatch, it will remain in this state. More on MTU mismatch issue click on the below link:

Exchange: Once the master slave relationship is established, master will send it’s DBD packet with sequence number (the latest sequence number indicates new information) which will have information of the links, network from its own topology tables and will receive slaves DBD packet as well with the sequence no. Both the OSPF routers will start comparing the Database, of what It already has and what it does not have and needs to ask from neighbor.

Loading: At this point, when they have exchanged DBD and start comparing the Database with each other, both the routers will come to know about the networks, link, cost. They will start exchanging LSU (envelop which contains multiple LSA’s), LSR Link state request for networks which it doesn’t have in its database and LACK acknowledge the LSR.

Full: The exchanging of link state update (LSU), link state request (LSR),link state ack (LACK) will continue until the topology tables of both the OSPF routers becomes identical, once the topology /Database are in sync, adjacency is established router will move from loading to FULL state.

Let see all the adjacency states one by one in detail with Debug:

*Nov 18 07:03:17.771: %LINK-3-UPDOWN: Interface GigabitEthernet0/0, changed state to up
*Nov 18 07:03:18.772: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
*Nov 18 07:03:18.775: OSPF-1 ADJ   Gi0/0: Route adjust notification: UP/UP
*Nov 18 07:03:18.775: OSPF-1 ADJ   Gi0/0: Interface going Up
*Nov 18 07:03:18.777: OSPF-1 ADJ   Gi0/0: Interface state change to UP, new ospf state WAIT
R1#
*Nov 18 07:03:23.596: OSPF-1 ADJ   Gi0/0: 2 Way Communication to 3.3.3.3, state 2WAY
R1#
*Nov 18 07:03:26.437: OSPF-1 ADJ   Gi0/0: 2 Way Communication to 2.2.2.2, state 2WAY
R1#
*Nov 18 07:03:53.701: OSPF-1 ADJ   Gi0/0: Rcv DBD from 3.3.3.3 seq 0x144C opt 0x52 flag 0x7 len 32  mtu 1500 state 2WAY
*Nov 18 07:03:53.702: OSPF-1 ADJ   Gi0/0: Nbr state is 2WAY
R1#
*Nov 18 07:03:58.286: OSPF-1 ADJ   Gi0/0: Rcv DBD from 3.3.3.3 seq 0x144C opt 0x52 flag 0x7 len 32  mtu 1500 state 2WAY
*Nov 18 07:03:58.287: OSPF-1 ADJ   Gi0/0: Nbr state is 2WAY
*Nov 18 07:03:58.775: OSPF-1 ADJ   Gi0/0: end of Wait on interface
*Nov 18 07:03:58.776: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Nov 18 07:03:58.776: OSPF-1 ADJ   Gi0/0: Elect BDR 3.3.3.3
*Nov 18 07:03:58.776: OSPF-1 ADJ   Gi0/0: Elect DR 3.3.3.3
*Nov 18 07:03:58.776: OSPF-1 ADJ   Gi0/0: DR: 3.3.3.3 (Id)
*Nov 18 07:03:58.777: OSPF-1 ADJ   Gi0/0:    BDR: 3.3.3.3 (Id)
*Nov 18 07:03:58.777: OSPF-1 ADJ   Gi0/0: Nbr 3.3.3.3: Prepare dbase exchange
R1#
*Nov 18 07:03:58.777: OSPF-1 ADJ   Gi0/0: Send DBD to 3.3.3.3 seq 0x213B opt 0x52 flag 0x7 len 32
R1#
*Nov 18 07:04:01.719: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Nov 18 07:04:01.719: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Nov 18 07:04:01.720: OSPF-1 ADJ   Gi0/0: Elect BDR 2.2.2.2
*Nov 18 07:04:01.720: OSPF-1 ADJ   Gi0/0: Elect DR 3.3.3.3
*Nov 18 07:04:01.720: OSPF-1 ADJ   Gi0/0: DR: 3.3.3.3 (Id)
*Nov 18 07:04:01.721: OSPF-1 ADJ   Gi0/0:    BDR: 2.2.2.2 (Id)
*Nov 18 07:04:01.721: OSPF-1 ADJ   Gi0/0: Nbr 2.2.2.2: Prepare dbase exchange
*Nov 18 07:04:01.722: OSPF-1 ADJ   Gi0/0: Send DBD to 2.2.2.2 seq 0x1F7D opt 0x52 flag 0x7 len 32
*Nov 18 07:04:01.722: OSPF-1 ADJ   Gi0/0: Neighbor change event
*Nov 18 07:04:01.722: OSPF-1 ADJ   Gi0/0: DR/BDR election
*Nov 18 07:04:01.723: OSPF-1 ADJ   Gi0/0: Elect BDR 2.2.2.2
*Nov 18 07:04:01.723: OSPF-1 ADJ   Gi0/0: Elect DR 3.3.3.3
*Nov 18 07:04:01.724: OSPF-1 ADJ   Gi0/0: DR: 3.3.3.3 (Id)
*Nov 18 07:04:01.724: OSPF-1 ADJ   Gi0/0:    BDR: 2.2.2.2 (Id)
*Nov 18 07:04:01.729: OSPF-1 ADJ   Gi0/0: Rcv DBD from 2.2.2.2 seq 0x230B opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Nov 18 07:04:01.729: OSPF-1 ADJ   Gi0/0: NBR Negotiation Done. We are the SLAVE
*Nov 18 07:04:01.730: OSPF-1 ADJ   Gi0/0: Nbr 2.2.2.2: Summary list built, size 4
*Nov 18 07:04:01.730: OSPF-1 ADJ   Gi0/0: Send DBD to 2.2.2.2 seq 0x230B opt 0x52 flag 0x2 len 112
*Nov 18 07:04:01.737: OSPF-1 ADJ   Gi0/0: Rcv DBD from 2.2.2.2 seq 0x230C opt 0x52 flag 0x1 len 92  mtu 1500 state EXCHANGE
*Nov 18 07:04:01.738: OSPF-1 ADJ   Gi0/0: Exchange Done with 2.2.2.2
*Nov 18 07:04:01.739: OSPF-1 ADJ   Gi0/0: Send LS REQ to 2.2.2.2 length 48
*Nov 18 07:04:01.739: OSPF-1 ADJ   Gi0/0: Send DBD to 2.2.2.2 seq 0x230C opt 0x52 flag 0x0 len 32
*Nov 18 07:04:01.747: OSPF-1 ADJ   Gi0/0: Rcv LS UPD from Nbr ID 2.2.2.2 length 124 LSA count 2
*Nov 18 07:04:01.748: OSPF-1 ADJ   Gi0/0: Synchronized with 2.2.2.2, state FULL
*Nov 18 07:04:01.748: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
R1#
*Nov 18 07:04:01.752: OSPF-1 ADJ   Gi0/0: Rcv LS REQ from 2.2.2.2 length 36 LSA count 1
*Nov 18 07:04:03.050: OSPF-1 ADJ   Gi0/0: Rcv DBD from 3.3.3.3 seq 0x144C opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Nov 18 07:04:03.051: OSPF-1 ADJ   Gi0/0: NBR Negotiation Done. We are the SLAVE
*Nov 18 07:04:03.051: OSPF-1 ADJ   Gi0/0: Nbr 3.3.3.3: Summary list built, size 4
*Nov 18 07:04:03.051: OSPF-1 ADJ   Gi0/0: Send DBD to 3.3.3.3 seq 0x144C opt 0x52 flag 0x2 len 112
*Nov 18 07:04:03.060: OSPF-1 ADJ   Gi0/0: Rcv DBD from 3.3.3.3 seq 0x144D opt 0x52 flag 0x1 len 52  mtu 1500 state EXCHANGE
*Nov 18 07:04:03.061: OSPF-1 ADJ   Gi0/0: Exchange Done with 3.3.3.3
*Nov 18 07:04:03.061: OSPF-1 ADJ   Gi0/0: Synchronized with 3.3.3.3, state FULL
*Nov 18 07:04:03.061: %OSPF-5-ADJCHG: Process 1, Nbr 3.3.3.3 on GigabitEthernet0/0 from LOADING to FULL, Loading Done
*Nov 18 07:04:03.062: OSPF-1 ADJ   Gi0/0: Send DBD to 3.3.3.3 seq 0x144D opt 0x52 flag 0x0 len 32
*Nov 18 07:04:03.069: OSPF-1 ADJ   Gi0/0: Rcv LS REQ from 3.3.3.3 length 36 LSA count 1

This was all about OSPF adjacent states, OSPF packet types and OSPF DR/BDR election will be covered in two other blogs

Related blog posts