Open Shortest Path First (OSPF) is a link-state interior gateway protocol (IGP) that uses the cost metric to find the best route to reach a subnet and uses wildcard masks to identify the subnet. It sends routing updates to the multicast IP address, supports fast convergence, and supports variable length subnet mask (VLSM). The default administrative distance for OSPF is 110. Using OSPF, a router floods link state advertisements (LSAs) over the network to share every detail with every other router on the network to form link state databases (LSDBs) on each router and to eventually become OSPF neighbours. Every router applies Dijkstra Shortest Path First algorithm on the LSDBs to find the best path to a particular subnet.
If the routing is not working as intended, then, first of all, we have to make sure that the router-id is set and the router interface participating in the OSPF process is in up state. We also have to be sure that the correct area-id is being written in the configuration commands. And also make sure that the OSPF routing is configured on both the participating interfaces. The correct configuration of the IP address and the subnet mask should also be verified. We also have to verify that the hello and dead timers match on the neighbouring interfaces.
We have to make sure that full neighbor relations are formed between adjacent routers. If the neighbours are in init state that means that the local router can see the OSPF hellos from the neighbour but the neighbour can not see the OSPF hellos from the local router. In this case, make sure there whether an ACL is applied on the interface, if yes, then make sure the ACL is not interfering in the routing process, and also that both the routers are using the same authentication type and keys. If the neighbours are in exchange or exstart state then confirm whether the MTU is the same on both the routers, if not then set a command to ignore the MTU. Also make sure that you can send large packet pings to the neighbour, if no, then check the cabling and hubs. If the neighbours are in the loading state then the packets sent might be getting corrupted. If the neighbours are in a 2way state, then confirm that the router can have a full adjacency with the DR or BDR, if not, then make sure that the OSPF priority is not set to 0, as it stops the router from becoming DR or BDR. If the neighbour state is flapping, make sure the interface status is up. If all the OSPF routes are missing from the routing table then make sure that the neighbours are not connected over redundant serial links and physical links are not swapped. If only the external routes are missing then verify that the external LSA is a part of the OSPF database and also that the forwarding route is known as the inter-area or intra-area route to the router. Also, make sure that the neighbours are configured in the same area for successful neighbour relationships.
Once OSPF has been set up on the network, we can use show ip ospf, show ip route, show ip ospf interface, show ip ospf neighbor commands, among others, to verify the implementation of the OSPF routing.