OSPF Basics

Open Shortest Path First (OSPF) is an open standard routing protocol that’s been implemented by a wide variety of network vendors, including Cisco. If you have routers from different vendors then you can’t use EIGRP. So your remaining CCNA objective options are basically RIP, RIPv2, and OSPF. If it’s a large network, then, really, your only options are OSPF and something called route redistribution-a translation service between routing protocols that we discussed earlier in this chapter.

OSPF works by using the Dijkstra algorithm. First, a shortest path tree is constructed, and then the routing table is populated with the resulting best paths. OSPF converges quickly, although perhaps not as quickly as EIGRP, and it supports multiple, equal-cost routes to the same destination. Like EIGRP, it does support both IP and IPv6 routed protocols.

OSPF provides the following features:

  • Consists of areas and autonomous systems
  • Minimizes routing update traffic
  • Allows scalability
  • Supports VLSM/CIDR
  • Has unlimited hop count
  • Allows multi-vendor deployment (open standard)

OSPF is the first link-state routing protocol that most people are introduced to, so it’s useful to see how it compares to more traditional distance-vector protocols such as RIPv2 and RIPv1.

Characteristic OSPF RIPv2 RIPv1
Type of protocol Link state Distance vector Distance vector
Classless support Yes Yes No
VLSM support Yes Yes No
Auto-summarization No Yes Yes
Manual summarization Yes No No
Discontiguous support Yes Yes No
Route propagation Multicast on change Periodic multicast Periodic broadcast
Path metric Bandwidth Hops Hops
Hop count limit None 15 15
Convergence Fast Slow Slow
Peer authentication Yes Yes No
Hierarchical network Yes (using areas) No (flat only) No (flat only)
Updates Event triggered Route table updates Route table updates
Route computation Dijkstra Bellman-Ford Bellman-Ford

OSPF has many features beyond the few that are listed in the table, and all of them contribute to a fast, scalable, and robust protocol that can be actively deployed in thousands of production networks. OSPF is supposed to be designed in a hierarchical fashion, which basically means that you can separate the larger internetwork into smaller internetworks called areas. This is the best design for OSPF.

The following are reasons for creating OSPF in a hierarchical design:

  • To decrease routing overhead
  • To speed up convergence
  • To confine network instability to single areas of the network

This does not make configuring OSPF easier, but more elaborate and difficult. The picture below shows a typical OSPF simple design. Notice how each router connects to the backbone- called area 0, or the backbone area. OSPF must have an area 0, and all other areas should connect to this area. Routers that connect other areas to the backbone area within an AS are called Area Border Routers (ABRs). Still, at least one interface of the ABR must be in area 0.

OSPF Topology

OSPF runs inside an autonomous system, but it can also connect multiple autonomous systems together. The router that connects these ASes is called an Autonomous System Boundary Router (ASBR). Ideally, you would create other areas of networks to help keep route updates to a minimum and to keep problems from propagating throughout the network.


The following are important OSPF terms to familiarize yourself with before you proceed:

  • Link – A link is a network or router interface assigned to any given network. When an interface is added to the OSPF process, it’s considered by OSPF to be a link. This link, or interface, will have state information associated with it (up or down) as well as one or more IP addresses.
  • Router ID – The Router ID (RID) is an IP address used to identify the router. Cisco chooses the Router ID by using the highest IP address of all configured loopback interfaces. If no loopback interfaces are configured with addresses, OSPF will choose the highest IP address of all active physical interfaces.
  • Neighbor – Neighbors are two or more routers that have an interface on a common network, such as two routers connected on a point-to-point serial link.
  • Adjacency – An adjacency is a relationship between two OSPF routers that permits the direct exchange of route updates. OSPF is really picky about sharing routing information-unlike EIGRP, which directly shares routes with all of its neighbors. Instead, OSPF directly shares routes only with neighbors that have also established adjacencies. And not all neighbors will become adjacent- this depends upon both the type of network and the configuration of the routers.
  • Hello protocol – The OSPF Hello protocol provides dynamic neighbor discovery and maintains neighbor relationships. Hello packets and Link State Advertisements (LSAs) build and maintain the topological database. Hello packets are addressed to
  • Neighborship database – The neighborship database is a list of all OSPF routers for which Hello packets have been seen. A variety of details, including the Router ID and state, are maintained on each router in the neighborship database.
  • Topological database – The topological database contains information from all of the Link State Advertisement packets that have been received for an area. The router uses the information from the topology database as input into the Dijkstra algorithm that computes the shortest path to every network.
  • Link State Advertisement – A Link State Advertisement (LSA) is an OSPF data packet containing link-state and routing information that’s shared among OSPF routers. There are different types of LSA packets, and I’ll go into these shortly. An OSPF router will exchange LSA packets only with routers to which it has established adjacencies.
  • Designated router – A Designated Router (DR) is elected whenever OSPF routers are connected to the same multi-access network. Cisco likes to call these “broadcast” networks, but really, they are networks that have multiple recipients. Try not to confuse multi-access with multipoint, which can be easy to do sometimes. A prime example is an Ethernet LAN. To minimize the number of adjacencies formed, a DR is chosen (elected) to disseminate/receive routing information to/from the remaining routers on the broadcast network or link. This ensures that their topology tables are synchronized. All routers on the shared network will establish adjacencies with the DR and backup designated router (BDR). The election is won by the router with the highest priority, and the Router ID is used as a tiebreaker if the priority of more than one router turns out to be the same.
  • Backup designated router – A Backup Designated Router (BDR) is a hot standby for the DR on multi-access links (remember that Cisco sometimes likes to call these “broadcast” networks). The BDR receives all routing updates from OSPF adjacent routers but doesn’t flood LSA updates.
  • OSPF areas – An OSPF area is a grouping of contiguous networks and routers. All routers in the same area share a common Area ID. Because 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. This would allow some interfaces to belong to area 1 while the remaining interfaces can belong to area 0. All of the routers within the same area have the same topology table. When configuring OSPF, you’ve got to remember that there must be an area 0 and that this is typically configured on the routers that connect to the backbone of the network. Areas also play a role in establishing a hierarchical network organization-something that really enhances the scalability of OSPF!
  • Broadcast (multi-access) – Broadcast (multi-access) networks such as Ethernet allow multiple devices to connect to (or access) the same network as well as provide a broadcast ability in which a single packet is delivered to all nodes on the network. In OSPF, a DR and a BDR must be elected for each broadcast multi-access network.
  • Non-broadcast multi-access – Non-broadcast multi-access (NBMA) networks are types such as Frame Relay, X.25, and Asynchronous Transfer Mode (ATM). These networks allow for multi-access but have no broadcast ability like Ethernet. So, NBMA networks require special OSPF configuration to function properly and neighbor relationships must be defined.
  • Point-to-point – Point-to-point refers to a type of network topology consisting of a direct connection between two routers that provides a single communication path. The point-to-point connection can be physical, as in a serial cable directly connecting two routers, or it can be logical, as in two routers that are thousands of miles apart yet connected by a circuit in a Frame Relay network. In either case, this type of configuration eliminates the need for DRs or BDRs-but neighbors are discovered automatically.
  • Point-to-multipoint – Point-to-multipoint refers to a type of network topology consisting of a series of connections between a single interface on one router and multiple destination routers. All of the interfaces on all of the routers sharing the point-to-multipoint connection belong to the same network. As with point-to-point, no DRs or BDRs are needed. All of these terms play an important part in understanding the operation of OSPF, so again, make sure you’re familiar with each of them.

Within an area, each router calculates the best/shortest path to every network in that same area. This calculation is based upon the information collected in the topology database and an algorithm called shortest path first (SPF). Picture each router in an area constructing a tree- much like a family tree-where the router is the root and all other networks are arranged along the branches and leaves. This is the shortest path tree used by the router to insert routes into the routing table. It’s important to understand that this tree contains only networks that exist in the same area as the router itself does. If a router has interfaces in multiple areas, then separate trees will be constructed for each area. One of the key criteria considered during the route selection process of the SPF algorithm is the metric or cost of each potential path to a network. But this SPF calculation doesn’t apply to routes from other areas.

OSPF uses a metric referred to as cost. A cost is associated with every outgoing interface included in an SPF tree. The cost of the entire path is the sum of the costs of the outgoing interfaces along the path. Because cost is an arbitrary value as defined in RFC 2338, Cisco had to implement its own method of calculating the cost for each OSPF-enabled interface. Cisco uses a simple equation of 108/bandwidth. The bandwidth is the configured bandwidth for the interface. Using this rule, a 100Mbps Fast Ethernet interface would have a default OSPF cost of 1 and a 10Mbps Ethernet interface would have a cost of 10. This value may be overridden by using the ip ospf cost command. The cost is manipulated by changing the value to a number within the range of 1 to 65 535. Because the cost is assigned to each link, the value must be changed on the interface that you want to change the cost.

Our Recommended Premium CCNA Training Resources

These are the best CCNA training resources online:

Click Here to get the Cisco CCNA Gold Bootcamp, the most comprehensive and highest rated CCNA course online with a 4.8 star rating from over 30,000 public reviews. I recommend this as your primary study source to learn all the topics on the exam. Cisco CCNA Gold Bootcamp
And click here for a free trial of AlphaPrep premium practice tests when youre ready to test your knowledge. They have the largest question bank, with adaptive tests and advanced reporting which tells you exactly when you are ready to pass the real exam. Cisco CCNA Gold Bootcamp