OSPF Explained and Useful Troubleshooting Commands

Open Shortest Path First (OSPF) is an open standard link-state routing protocol that supports multiple equal-cost routes to the same destination (four by default). OSPF constructs a shortest path tree and then updates the routing table with the best paths. In this blog I I will be explaining OSPF in the context of OSPF on Cisco routers, so I will be using Cisco IOS command syntax. For some of the commands I have included screenshots from a Cisco 2621XM [IOS 12.3(16a)] router.

With OSPF you can separate a larger internetwork into smaller internetworks called “areas”. This provides the following advantages:

– decreases routing overhead
– speeds up convergence
– confines network instability to single areas of the network

In OSPF the backbone area is called “area 0” and routers that connect other areas to the backbone area within an Autonomous System (AS) are called Area Border Routers (ABRs). Although OSPF runs inside an AS, it can also connect multiple autonomous systems together; a router that does this is called an Autonomous System Border Router (ASBR).

Some important things to know about OSPF are the following:

– When an interface is added to an OSPF process, OSPF considers it a “link”.
– The Router ID (RID) is an IP address used to identify the router. If loopback interfaces are not configured, Cisco routers will choose the highest IP address on the router as the RID, otherwise the highest loopback IP address will be used.
– An OSPF area is a group of contiguous networks and routers, and all routers in the same area share a common Area ID. Also, since a router can be a member of more than one area at a time, the Area ID is associated with specific interfaces on the router. All of the routers within the same area will have the same topology table.
– Neighbors are considered to be two or more routers that have an interface on a common network.
– An adjacency is a relationship between two OSPF routers that permits the direct exchange of route updates. OSPF shares routes only with neighbors that have established adjacencies.
– A Link State Advertisement (LSA) is an OSPF data packet containing link-state and routing information that’s shared among OSPF routers.
– “Hello” packets and LSAs build/maintain the topological database. 224.0.0.5 is the multicast address “Hello” packets are addressed to. By default “Hello” packets are sent every 10 seconds.
– The neighbor database is a list of all OSPF routers where “Hello” packets have been received; details such as Router ID and state are maintained for each router.
– The topology database contains information from all of the LSA packets that have been received for an area. This information is used by OSPF as input for an algorithm that computes the shortest path to every network.
– A Designated Router (DR) is elected when OSPF routers are connected to the same network. The election is won by the router with the highest priority (Router ID is used as a tie breaker). The DR sends/receives routing information to/from the other routers on the broadcast network/link. All the routers on the shared network will establish adjacencies with the DR and Backup Designated Router (BDR). The BDR is simply a backup to the DR and can be considered a hot standby; it receives all routing updates from OSPF adjacent routers but doesn’t flood LSA updates.
– OSPF uses a metric referred to as “cost”. A cost is associated with every outgoing interface included in an Shortest Path First (SPF) tree. RFC 2328 defines cost as an arbitrary value. Cisco uses an equation of: 10^8 / (bandwidth of the interface). Using this equation, a 100 Mbs interface would have a cost of 1 and a 10 Mbps interface would have a cost of 10.

Useful OSPF commands:

– show ip protocols (confirm OSPF is running)

show ip protocols

show ip protocols


– show ip route (see if dynamic routes are learned by OSPF)
show ip route

show ip route


– show ip ospf (display OSPF info for one or all OSPF processes running on the router)
show ip ospf

show ip ospf


– show ip ospf database (see the OSPF routers in the internetwork along with the neighboring routers ID)
show ip ospf database

show ip ospf database


– show ip ospf neighbor (displays summarized info for OSPF regarding neighbors and adjacency state)
show ip ospf neighbor

show ip ospf neighbor


– show ip ospf interface (displays all interface-related OSPF information including “Hello” and “Dead” timer intervals)
show ip ospf interface

show ip ospf interface


– ip ospf cost (interface mode command – change the default OSPF cost on an interface)
– debug ip ospf packet (shows hello packets being sent and received on the router)
– debug ip ospf hello (shows more detailed info regarding packets being sent and received on the router)
– debug ip ospf adj (shows DR and BDR elections on a broadcast or non-broadcast multi-access network)

This entry was posted in Cisco, Labs, Networking, Protocols, Technology, Troubleshooting and tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

3 Responses to OSPF Explained and Useful Troubleshooting Commands

  1. Pingback: Humair’s Blogs » Blog Archive » Cisco – Filtering Unwanted Packets with Standard Access Lists

  2. Pingback: celebrity zz

  3. Pingback: pianist club

Leave a Reply

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


3 × six =