OSPF Basic Configuration Deep Dive – Part 1

Building OSPF Adjacencies

Down

This is the first OSPF neighbor state. It means that no information (hellos) has been received from this neighbor, but hello packets can still be sent to the neighbor in this state.


Attempt

This state is only valid for manually configured neighbors in an NBMA environment. In the Attempt state, the router sends unicast hello packets every poll interval to the neighbor, from which hellos have not been received within the dead interval.

R1#

interface Ethernet0/0.146
 encapsulation dot1Q 146
 ip address 155.1.146.1 255.255.255.0
 ip ospf network non-broadcast
end

router ospf 1
 network 155.1.146.0 0.0.0.255 area 0
 neighbor 155.1.146.6
 neighbor 155.1.146.4
R1(config-router)#do show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
N/A               0   ATTEMPT/DROTHER 00:01:54    155.1.146.4     Ethernet0/0.146
N/A               0   ATTEMPT/DROTHER 00:01:54    155.1.146.6     Ethernet0/0.146

R4#

router ospf 1
 network 155.1.146.0 0.0.0.255 area 0
 neighbor 155.1.146.6
 neighbor 155.1.146.1

interface Ethernet0/1.146
 encapsulation dot1Q 146
 ip address 155.1.146.4 255.255.255.0
 ip ospf network non-broadcast
end
R4(config-router)#do show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
N/A               0   ATTEMPT/DROTHER 00:01:54    155.1.146.1     Ethernet0/1.146
N/A               0   ATTEMPT/DROTHER 00:01:54    155.1.146.6     Ethernet0/1.146

R6#
router ospf 1
 network 155.1.146.0 0.0.0.255 area 0
 neighbor 155.1.146.1
 neighbor 155.1.146.4

interface Ethernet0/1.146
 encapsulation dot1Q 146
 ip address 155.1.146.6 255.255.255.0
 ip ospf network non-broadcast
end
R6(config-router)#do show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
N/A               0   ATTEMPT/DROTHER 00:01:06    155.1.146.4     Ethernet0/1.146
N/A               0   ATTEMPT/DROTHER 00:01:12    155.1.146.1     Ethernet0/1.146

Init

This state specifies that the router has received a hello packet from its neighbor, but the receiving router ID was not included in the hello packet. When a router receives a hello packet from a neighbor, it must list the sender router ID in its hello packet as an acknowledgment that it received a valid hello packet.


2-Way
  • This state designates that bi-directional communication has been established between two routers.
  • Bi-directional means that each router sees the hello packet from the other router.
    • This state is attained when the router receiving the hello packet sees its own Router ID within the received hello packet neighbor field. At this state, a router decides whether to become adjacent with this neighbor.

On broadcast media and non-broadcast multi-access networks, a router becomes full only with the designated router (DR) and the backup designated router (BDR); it stays in the 2-way state with all other neighbors. On Point-to-point and Point-to-multipoint networks, a router becomes full with all connected routers.

At the end of this stage, the DR and BDR for broadcast and non-broadcast multi-access networks are elected.

Note: Receiving a Database Descriptor (DBD) packet from a neighbor in the init state can also cause a transition to a 2-way state.


Exstart
  • Once the DR and BDR are elected, the actual process of the exchange link state information can start between the routers and their DR and BDR.
  • In this state, the routers and their DR and BDR establish a primary-secondary relationship and choose the initial sequence number for adjacency formation.
  • The router with the higher router ID becomes the primary and starts the exchange, and as such, is the only router that can increment the sequence number.
  • You would logically conclude that the DR/BDR with the highest router ID is the primary for this process. The DR/BDR election could be because of a higher priority configured on the router instead of the highest router ID. Thus, it is possible that a DR plays a secondary role. Also, the primary/secondary election is on a per-neighbor basis.

Exchange
  • In the exchange state, OSPF routers exchange database descriptor (DBD) packets.
  • Database descriptors contain link-state advertisement (LSA) headers only and describe the contents of the entire link-state database.
  • Each DBD packet has a sequence number that can be incremented only by the primary, which is explicitly acknowledged by the secondary.
  • Routers also send link-state request packets and link-state update packets (which contain the entire LSA) in this state.
  • The contents of the DBD received are compared to the information contained in the router’s link-state database to check if new or more current link-state information is available with the neighbor.

Loading
  • In this state, the actual exchange of link-state information occurs. Based on the information provided by the DBDs, routers send link-state request packets.
  • The neighbor then provides the requested link-state information in link-state update packets.
  • During the adjacency, if a router receives an outdated or lost LSA, it sends a link-state request packet for that LSA. All link-state update packets are acknowledged.

Full
  • In this state, routers are fully adjacent with each other. All the router and network LSAs are exchanged, and the routers’ databases are fully synchronized.
  • Full is the normal state for an OSPF router.
  • If a router is stuck in another state, it is an indication that there are problems when the adjacencies are formed. 
    • The only exception to this is the 2-way state, which is normal in a broadcast network.
  • Routers achieve the FULL state with their DR and BDR in NBMA/broadcast media and FULL state with every neighbor in the residual media, such as point-to-point and point-to-multipoint.

Note: The DR and BDR that achieve FULL state with every router on the segment can display FULL/DROTHER state. When you enter the show ip ospf neighbor command on either a DR or BDR.

This simply means that the neighbor is not a DR or BDR, but since the router on which the command was entered is either a DR or BDR, this shows the neighbor as FULL/DROTHER


R1(config-router)#


*Sep  5 17:15:52.273: OSPF-1 HELLO Et0/0.146: Send hello to 224.0.0.5 area 0 from 155.1.146.1
*Sep  5 17:15:52.274: OSPF-1 HELLO Et0/0.146: Rcv hello from 150.1.6.6 area 0 155.1.146.6
*Sep  5 17:15:52.274: OSPF-1 HELLO Et0/0.146: Send immediate hello to nbr 150.1.6.6, src address 155.1.146.6
*Sep  5 17:15:52.274: OSPF-1 HELLO Et0/0.146: Send hello to 155.1.146.6 area 0 from 155.1.146.1
*Sep  5 17:15:52.277: OSPF-1 HELLO Et0/0.146: Rcv hello from 150.1.4.4 area 0 155.1.146.4
*Sep  5 17:15:52.277: OSPF-1 HELLO Et0/0.146: Send immediate hello to nbr 150.1.4.4, src address 155.1.146.4
*Sep  5 17:15:52.277: OSPF-1 HELLO Et0/0.146: Send hello to 155.1.146.4 area 0 from 155.1.146.1
*Sep  5 17:15:52.277: OSPF-1 HELLO Et0/0.146: Rcv hello from 150.1.6.6 area 0 155.1.146.6

R4(config-router)#

*Sep  5 17:16:29.175: OSPF-1 HELLO Et0/1.146: Send hello to 224.0.0.5 area 0 from 155.1.146.4
*Sep  5 17:16:29.177: OSPF-1 HELLO Et0/1.146: Rcv hello from 150.1.6.6 area 0 155.1.146.6
*Sep  5 17:16:29.177: OSPF-1 HELLO Et0/1.146: Send immediate hello to nbr 150.1.6.6, src address 155.1.146.6
*Sep  5 17:16:29.177: OSPF-1 HELLO Et0/1.146: Send hello to 155.1.146.6 area 0 from 155.1.146.4
*Sep  5 17:16:29.179: OSPF-1 HELLO Et0/1.146: Rcv hello from 150.1.6.6 area 0 155.1.146.6
*Sep  5 17:16:29.180: OSPF-1 HELLO Et0/1.146: Rcv hello from 150.1.1.1 area 0 155.1.146.1
*Sep  5 17:16:29.180: OSPF-1 HELLO Et0/1.146: Send immediate hello to nbr 150.1.1.1, src address 155.1.146.1
*Sep  5 17:16:29.180: OSPF-1 HELLO Et0/1.146: Send hello to 155.1.146.1 area 0 from 155.1.146.4
*Sep  5 17:16:29.182: OSPF-1 HELLO Et0/1.146: Rcv hello from 150.1.1.1 area 0 155.1.146.1
R6(config-router)#

*Sep  5 17:15:21.889: OSPF-1 HELLO Et0/1.146: Send hello to 224.0.0.5 area 0 from 155.1.146.6
*Sep  5 17:15:21.891: OSPF-1 HELLO Et0/1.146: Rcv hello from 150.1.4.4 area 0 155.1.146.4
*Sep  5 17:15:21.891: OSPF-1 HELLO Et0/1.146: Send immediate hello to nbr 150.1.4.4, src address 155.1.146.4
*Sep  5 17:15:21.891: OSPF-1 HELLO Et0/1.146: Send hello to 155.1.146.4 area 0 from 155.1.146.6
*Sep  5 17:15:21.893: OSPF-1 HELLO Et0/1.146: Rcv hello from 150.1.1.1 area 0 155.1.146.1
*Sep  5 17:15:21.893: OSPF-1 HELLO Et0/1.146: Send immediate hello to nbr 150.1.1.1, src address 155.1.146.1
*Sep  5 17:15:21.893: OSPF-1 HELLO Et0/1.146: Send hello to 155.1.146.1 area 0 from 155.1.146.6
*Sep  5 17:15:21.893: OSPF-1 HELLO Et0/1.146: Rcv hello from 150.1.4.4 area 0 155.1.146.4
*Sep  5 17:15:21.893: OSPF-1 HELLO Et0/1.146: Rcv hello from 150.1.1.1 area 0 155.1.146.1

Key items to note

  • Each router will send a hello packet with its router ID to the multicast address 224.0.0.5

R1

R4

R6

  • At this point, the routers will be in the 2Way state.
R1(config-router)#do show ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
150.1.4.4         1   2WAY/DROTHER    00:00:31    155.1.146.4     Ethernet0/0.146
150.1.6.6         1   2WAY/DROTHER    00:00:39    155.1.146.6     Ethernet0/0.146
R4(config-router)#do show ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
150.1.1.1         1   2WAY/DROTHER    00:00:36    155.1.146.1     Ethernet0/1.146
150.1.6.6         1   2WAY/DROTHER    00:00:35    155.1.146.6     Ethernet0/1.146
R6(config-router)#do show ip ospf nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
150.1.1.1         1   2WAY/DROTHER    00:00:38    155.1.146.1     Ethernet0/1.146
150.1.4.4         1   2WAY/DROTHER    00:00:39    155.1.146.4     Ethernet0/1.146

Remember that the 2WAY state means the following:

This state designates that bi-directional communication has been established between two routers. Bi-directional means that each router sees the hello packet from the other router. This state is attained when the router receiving the hello packet sees its own Router ID within the received hello packet neighbor field. This will be true for R1, R4 and R6.


What’s next in the process?

Now that each router can “see” and “identify” each other, the DB/BDR election will begin.

DR Election

  • DR and BDR election is done via the Hello protocol. Hello packets are exchanged via IP multicast packets 224.0.0.5 on each segment.
  • The router with the highest OSPF priority on a segment becomes the DR for that segment. The same process is repeated for the BDR.
  • In case of a tie, the router with the highest RID prevails.
  • The default for the interface OSPF priority is one.
  • Remember that the DR and BDR concepts are per multiaccess segment. The OSPF priority value on an interface is done with the ip ospf priority <value> interface command.
  • A priority value of zero indicates an interface that is not to be elected as DR or BDR.
  • The state of the interface with priority zero is DROTHER.
R1(config-router)#

*Sep  5 18:16:15.353: OSPF-1 ADJ   Et0/0.146: end of Wait on interface
*Sep  5 18:16:15.353: OSPF-1 ADJ   Et0/0.146: DR/BDR election
*Sep  5 18:16:15.353: OSPF-1 ADJ   Et0/0.146: Elect BDR 150.1.6.6
*Sep  5 18:16:15.353: OSPF-1 ADJ   Et0/0.146: Elect DR 150.1.6.6
*Sep  5 18:16:15.353: OSPF-1 ADJ   Et0/0.146: DR: 150.1.6.6 (Id)
*Sep  5 18:16:15.353: OSPF-1 ADJ   Et0/0.146:    BDR: 150.1.6.6 (Id)
*Sep  5 18:16:15.353: OSPF-1 ADJ   Et0/0.146: Nbr 150.1.6.6: Prepare dbase exchange
*Sep  5 18:16:15.353: OSPF-1 ADJ   Et0/0.146: Send DBD to 150.1.6.6 seq 0x252B opt 0x52 flag 0x7 len 32
*Sep  5 18:16:15.353: OSPF-1 LSGEN: Scheduling rtr LSA for area 0, build flag 0x41 (from 0xBD9C7F5)
*Sep  5 18:16:15.353: OSPF-1 PAK  : Et0/0.146: OUT: 155.1.146.1->155.1.146.6: ver:2 type:2 len:32 rid:150.1.1.1 area:0.0.0.0 chksum:E9CC auth:0
*Sep  5 18:16:15.354: OSPF-1 PAK  : Et0/0.146:  IN: 155.1.146.6->155.1.146.1: ver:2 type:2 len:32 rid:150.1.6.6 area:0.0.0.0 chksum:EE23 auth:0
*Sep  5 18:16:15.358: OSPF-1 ADJ   Et0/0.146: Rcv DBD from 150.1.6.6 seq 0x1BCF opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Sep  5 18:16:15.358: OSPF-1 ADJ   Et0/0.146: NBR Negotiation Done. We are the SLAVE
*Sep  5 18:16:15.358: OSPF-1 ADJ   Et0/0.146: Nbr 150.1.6.6: Summary list built, size 1
*Sep  5 18:16:15.358: OSPF-1 ADJ   Et0/0.146: Send DBD to 150.1.6.6 seq 0x1BCF opt 0x52 flag 0x2 len 52
*Sep  5 18:16:15.358: OSPF-1 PAK  : Et0/0.146: OUT: 155.1.146.1->155.1.146.6: ver:2 type:2 len:52 rid:150.1.1.1 area:0.0.0.0 chksum:3BE7 auth:0
*Sep  5 18:16:15.362: OSPF-1 PAK  : Et0/0.146:  IN: 155.1.146.6->155.1.146.1: ver:2 type:2 len:52 rid:150.1.6.6 area:0.0.0.0 chksum:D741 auth:0
*Sep  5 18:16:15.362: OSPF-1 ADJ   Et0/0.146: Rcv DBD from 150.1.6.6 seq 0x1BD0 opt 0x52 flag 0x1 len 52  mtu 1500 state EXCHANGE
*Sep  5 18:16:15.362: OSPF-1 ADJ   Et0/0.146: Exchange Done with 150.1.6.6
*Sep  5 18:16:15.362: OSPF-1 ADJ   Et0/0.146: Send LS REQ to 150.1.6.6 length 36
*Sep  5 18:16:15.362: OSPF-1 ADJ   Et0/0.146: Send DBD to 150.1.6.6 seq 0x1BD0 opt 0x52 flag 0x0 len 32
*Sep  5 18:16:15.362: OSPF-1 PAK  : Et0/0.146: OUT: 155.1.146.1->155.1.146.6: ver:2 type:3 len:36 rid:150.1.1.1 area:0.0.0.0 chksum:2EC6 auth:0
*Sep  5 18:16:15.362: OSPF-1 PAK  : Et0/0.146: OUT: 155.1.146.1->155.1.146.6: ver:2 type:2 len:32 rid:150.1.1.1 area:0.0.0.0 chksum:F32E auth:0
*Sep  5 18:16:15.366: OSPF-1 PAK  : Et0/0.146:  IN: 155.1.146.6->155.1.146.1: ver:2 type:4 len:64 rid:150.1.6.6 area:0.0.0.0 chksum:1BD1 auth:0
*Sep  5 18:16:15.366: OSPF-1 PAK  : Et0/0.146:  IN: 155.1.146.6->155.1.146.1: ver:2 type:3 len:36 rid:150.1.6.6 area:0.0.0.0 chksum:33CB auth:0
*Sep  5 18:16:15.366: OSPF-1 ADJ   Et0/0.146: Rcv LS UPD from Nbr ID 150.1.6.6 length 64 LSA count 1
*Sep  5 18:16:15.366: OSPF-1 ADJ   Et0/0.146: Synchronized with 150.1.6.6, state FULL
*Sep  5 18:16:15.366: %OSPF-5-ADJCHG: Process 1, Nbr 150.1.6.6 on Ethernet0/0.146 from LOADING to FULL, Loading Done
*Sep  5 18:16:15.366: OSPF-1 LSGEN: Scheduling rtr LSA for area 0, build flag 0x51 (from 0xBDC5F9E)
*Sep  5 18:16:15.367: OSPF-1 ADJ   Et0/0.146: Rcv LS REQ from 150.1.6.6 length 36 LSA count 1
*Sep  5 18:16:15.367: OSPF-1 PAK  : Et0/0.146: OUT: 155.1.146.1->155.1.146.6: ver:2 type:4 len:64 rid:150.1.1.1 area:0.0.0.0 chksum:8076 auth:0
*Sep  5 18:16:15.370: OSPF-1 PAK  : Et0/0.146:  IN: 155.1.146.6->224.0.0.5: ver:2 type:4 len:100 rid:150.1.6.6 area:0.0.0.0 chksum:F5A7 auth:0
*Sep  5 18:16:15.371: OSPF-1 PAK  : Et0/0.146: OUT: 155.1.146.1->155.1.146.6: ver:2 type:5 len:44 rid:150.1.1.1 area:0.0.0.0 chksum:AF97 auth:0
rid:150.1.6.6 area:0.0.0.0 chksum:C578 auth:0
*Sep  5 18:16:22.045: OSPF-1 HELLO Et0/0.146: Rcv hello from 150.1.6.6 area 0 155.1.146.6
*Sep  5 18:16:22.045: OSPF-1 ADJ   Et0/0.146: Neighbor change event
*Sep  5 18:16:22.045: OSPF-1 ADJ   Et0/0.146: DR/BDR election
*Sep  5 18:16:22.045: OSPF-1 ADJ   Et0/0.146: Elect BDR 150.1.4.4
*Sep  5 18:16:22.045: OSPF-1 ADJ   Et0/0.146: Elect DR 150.1.6.6
*Sep  5 18:16:22.045: OSPF-1 ADJ   Et0/0.146: DR: 150.1.6.6 (Id)
*Sep  5 18:16:22.045: OSPF-1 ADJ   Et0/0.146:    BDR: 150.1.4.4 (Id)
*Sep  5 18:16:22.045: OSPF-1 ADJ   Et0/0.146: Nbr 150.1.4.4: Prepare dbase exchange
*Sep  5 18:16:22.045: OSPF-1 ADJ   Et0/0.146: Send DBD to 150.1.4.4 seq 0x1F19 opt 0x52 flag 0x7 len 32
*Sep  5 18:16:22.045: OSPF-1 LSGEN: Scheduling rtr LSA for area 0, build flag 0x41 (from 0xBD9C7F5)
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146: Neighbor change event
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146: DR/BDR election
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146: Elect BDR 150.1.4.4
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146: Elect DR 150.1.6.6
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146: DR: 150.1.6.6 (Id)
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146:    BDR: 150.1.4.4 (Id)
*Sep  5 18:16:22.046: OSPF-1 LSGEN: Scheduling rtr LSA for area 0, build flag 0x41 (from 0xBD9C7F5)
*Sep  5 18:16:22.046: OSPF-1 PAK  : Et0/0.146: OUT: 155.1.146.1->155.1.146.4: ver:2 type:2 len:32 rid:150.1.1.1 area:0.0.0.0 chksum:EFDE auth:0
*Sep  5 18:16:22.046: OSPF-1 PAK  : Et0/0.146:  IN: 155.1.146.4->155.1.146.1: ver:2 type:2 len:32 rid:150.1.4.4 area:0.0.0.0 chksum:2E6 auth:0
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146: Rcv DBD from 150.1.4.4 seq 0x90F opt 0x52 flag 0x7 len 32  mtu 1500 state EXSTART
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146: NBR Negotiation Done. We are the SLAVE
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146: Nbr 150.1.4.4: Summary list built, size 4
*Sep  5 18:16:22.046: OSPF-1 ADJ   Et0/0.146: Send DBD to 150.1.4.4 seq 0x90F opt 0x52 flag 0x2 len 112
*Sep  5 18:16:22.046: OSPF-1 PAK  : Et0/0.146: OUT: 155.1.146.1->155.1.146.4: ver:2 type:2 len:112 rid:150.1.1.1 area:0.0.0.0 chksum:A024 auth:0
*Sep  5 18:16:22.050: OSPF-1 PAK  : Et0/0.146:  IN: 155.1.146.4->155.1.146.1: ver:2 type:2 len:52 rid:150.1.4.4 area:0.0.0.0 chksum:E55F auth:0
*Sep  5 18:16:22.050: OSPF-1 ADJ   Et0/0.146: Rcv DBD from 150.1.4.4 seq 0x910 opt 0x52 flag 0x1 len 52  mtu 1500 state EXCHANGE
*Sep  5 18:16:22.050: OSPF-1 ADJ   Et0/0.146: Exchange Done with 150.1.4.4
*Sep  5 18:16:22.050: OSPF-1 ADJ   Et0/0.146: Synchronized with 150.1.4.4, state FULL
*Sep  5 18:16:22.050: %OSPF-5-ADJCHG: Process 1, Nbr 150.1.4.4 on Ethernet0/0.146 from LOADING to FULL, Loading Done
R1(config-router)#do show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
150.1.4.4         1   FULL/BDR        00:00:33    155.1.146.4     Ethernet0/0.146
150.1.6.6         1   FULL/DR         00:00:33    155.1.146.6     Ethernet0/0.146
R4#show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
150.1.1.1         1   FULL/DROTHER    00:00:38    155.1.146.1     Ethernet0/1.146
150.1.6.6         1   FULL/DR         00:00:39    155.1.146.6     Ethernet0/1.146
R6#show ip ospf ne

Neighbor ID     Pri   State           Dead Time   Address         Interface
150.1.1.1         1   FULL/DROTHER    00:00:38    155.1.146.1     Ethernet0/1.146
150.1.4.4         1   FULL/BDR        00:00:32    155.1.146.4     Ethernet0/1.146

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.