Multiarea OSPF for the CCNA

Multiarea OSPF Overview

Multiarea OSPF is used in large or enterprise networks where there are so many routers that having every router communicating every link in their link state database with every other router in the network, even when it is a small change becomes taxing on the network. In this type of situation you don’t need every router, lets say there are 30 or more routers, running the shortest path first algorithm if an interface is momentarily shut down.

The solution is to use multi-area OSPF instead of single area OSPF where every network is in Area 0. In multiarea OSPF you still have to have a backbone area named Area 0 but you can add additional networks in other areas. The result is that routers will only share their entire link state databases with routers in there own area and other areas will be configured to receive only summary information from the area. This way, when there is a change in the network the SPF algorithm will only need to run on routers in the effected area.

I created a packet tracer lab activity that goes with a video tutorial series. Watch all of the videos in-order below, while you follow along with the downloadable packet activity here: multi-area-ospf-begin

Multiarea OSPF Video Tutorial




OSPF Overview

Open Shortest Path First (OSPF) is a link-state routing protocol that is designed to work with large, more complex networks. OSPF is a classless routing protocol that supports VLSM and CIDR, and uses the Shortest Path First (SPF) algorithm to calculate the best path to a network. OSPF uses a routing metric of “cost” that in Cisco’s implementation is based mainly on the bandwidth of a link. OSPF is able to support hierarchical and scalable network designs through its ability to handle multiple OSPF routing areas.

The Cisco CCNA curriculum requires students to know how to implement and configure only a single-area OSPF network.

OSPF has some similarities to EIGRP, especially in regards to configuration, like requiring a process-id number, using wildcard bits for the subnet mask, hello packets, neighbor relationships or adjacencies, triggered updates, and the use of multiple tables like the neighbor and topology tables.

OSPF Characteristics

  • Algorithm – Dijsktra’s SPF algorithm
  • Metric – Cost, which is based on the bandwidth of a link
  • Administrative Distance – 110
  • Process-ID number – the process-id number is declared when OSPF is started/configured and is a number from 1 to 65535. The process id number does NOT need to match other OSPF routers in the area in order to create adjacencies (see commands below).
  • Wildcard bits/mask – The wildcard mask is the inverse of a network subnet mask (e.g. is It is declared after the network number in the network command (see commands below)
  • Area number – The area number is a number from 0-255, declared at the end of the network command after the wildcard bits. Routers in the same area will exchange routing information or Link State Updates or LSUs (see commands below)
  • Hello Interval – Hello packets are sent every 10 seconds by default. In order for OSPF routers to establish neighbor adjacencies and exchange routing information successfully, the hello interval needs to match all OSPF routers in the OSPF area.
  • Dead Interval – The dead interval is 40 seconds by default. The dead interval should be 4 times the hello interval, and needs to match all OSPF routers in the area
  • Multiple Tables – Routing Table, Topology Table, and Neighbor Adjacency Table
  • DR and BDR Elections – In broadcast multi-access networks (Ethernet), routers in the OSPF area will elect a Designated Router (DR) and a Backup Designated Router (BDR). The DR will be the receiver and distributor of Link-State Packets to other routers in the OSPF area. The BDR will wait, and be ready to take over the duties of the DR in case it fails.

IOS CLI Commands

The router ospf command starts the OSPF routing process. The process ID number can be a number between 1 and 65535:

 router(config)# router ospf <process-id>

  EXAMPLE: router(config)# router ospf 1

The network command will add a connected network to the routing process. In addition to the network IP address you need to provide the wildcard mask, which is the inverse of the subnet mask and the area parameter and number. Typically in single area OSPF the area is often set to area 0.

 router(config-router)# network <network-number> <wildcard-mask> area <area-number>

  EXAMPLE: router(config-router)# network area 0
EXAMPLE: router(config-router)# network area 0
  EXAMPLE: router(config-router)# network area 0 //for a /30 subnet mask

In OSPF, the router-id command will manually set the router’s router-id. In broadcast multi-access networks the router with the highest router-ID will become the designated router (DR) and the router with the second highest router-ID will become the backup designated router (BDR).

 router(config-router)# router-id <ip-address>

  EXAMPLE: router(config-router)# router-id

The passive-interface command can be used to stop OSPF packets from being sent out of a network interface where there are no other OSPF routers present.

 router(config-router)# passive-interface <interface-number>

  EXAMPLE: router(config-router)# passive-interface fastEthernet 0/0

Cisco’s OSPF cost metrics do not account for links faster than 100 Mbps. For example, a 100 Mbps Ethernet interface will calculate to an OSPF cost of 1, but what if you have a 1000 or 10000 Mbps Ethernet interface? The auto-cost reference-bandwidth can adjust the cost metrics to account for links fast than 100 Mbps.

 router(config-router)# auto-cost reference-bandwidth <megabits-per-second>

  EXAMPLE: router(config-router)# auto-cost reference-bandwidth 10000


The default-information originate command will distribute a default route to other OSPF area routers.

 router(config-router)# default-information originate 

You can use either of the following commands to exit out of router configuration mode.

 router(config-router)# end
router(config-router)# exit

Since OSPF relies on bandwidth for the metric, it is a good idea to set the specific bandwidth of the serial interface, otherwise the Cisco serial interfaces will default to a speed of 1544 Kbps, which may lead to an inaccurate measurement of the cost of the link. It is important to remember that this command is applied to the network interface in interface configuration mode.

 router(config)# interface serial <interface-number>
router(config-if)# bandwidth <speed-in-kbps>

  EXAMPLE: router(config)# interface serial 0/0/0
router(config-if)# bandwidth 384

Another command that is applied to a network interface is the ip ospf priority command. This command can be used to manipulate the DR/BDR election process. By default, the Cisco router’s interfaces are all given an OSPF priority of 1, by changing this value to a higher number you can effect the DR/BDR elections. An OSPF priority of 0 will insure the router is never the DR, but an OSPF priority number of 255 will insure that the router will be elected as the designated router or DR.

 router(config-if)# ip ospf priority <0-255>

  EXAMPLE: router(config-if)# ip ospf priority 255

The following commands are all applied to a network interface, but they all effect the OSPF routing protocol operation. Instead of configuring the bandwidth of the link, which will subsequently effect the calculation of the cost metric, you can configure the cost value directly. To do this you need to know how to manually calculate the cost metric. The cost metric of a network link is calculated by the following method: cost equals 10^8 power divided by the network interface speed in bits per second, e.g. the cost for Fast Ethernet is 10^8/100,000,000 = 1..

 router(config-if)# ip ospf cost <cost-value>

  EXAMPLE: router(config-if)# ip ospf cost 781 //for a 128kbps link

For neighboring OSPF routers to achieve adjacencies the OSPF hello interval and dead interval, on each OSPF router needs to match. In a multi-access, broadcast network the default hello interval is 10 seconds, and the dead interval is set to four times the hello interval, or 40 seconds. You can manipulate these times to, for example: have less hello packets on the network, but if you adjust the hello interval, you also need to adjust the dead interval, and you need to do so, for all OSPF routers in the OSPF area.

 router(config-if)# ip ospf hello-interval <seconds>
router(config-if)# ip ospf dead-interval <seconds>

  EXAMPLE: router(config-if)# ip ospf hello-interval 10
router(config-if)# ip ospf dead-interval 40


The following show commands are useful in verifying and troubleshooting OSPF operation and configuration, as well as identifying the router-ids and the identities of the DR and BDR. 

 router# show ip ospf neighbor
router# show ip ospf interface
router# clear ip ospf process
router# show running-config
router# show ip protocols
router# show ip route

Sample Command Usage

router(config)#router ospf 1
router(config-router)#network area 0
router(config-router)#network area 0
router(config-router)#passive-interface fa0/1
router(config-router)#default-information originate
router#show ip ospf neighbor
router# show ip ospf interface
router# clear ip ospf process

OSPF Show Commands

Example OSPF Network

     router#show ip ospf neighbor

In the “show ip ospf neighbor” command above you can see that the router R0 has established three neighbor relationships or adjacencies with the other routers. The “Neighbor ID” above is the neighbor router’s Router ID#. The Router ID# can be different than the neighbor router’s IP address on the network. In the example above the first router listed has a Router or Neighbor ID of but its IP address on the network is You can also see that router at (R3) is the current BDR or Backup Designated router and that the “Pri” or Router Priority Number has been changed from the default number of 1 to 50. The “State” shows that all three routers have current “FULL” adjacency or neighbor relationships. DROTHER routers will only form FULL adjacencies with DR and BDR routers and 2WAY adjacencies with each other. You can see this in the image of R1’s “show ip ospf neighbor” output above. Even if we only look at the output of R0’s show command above (top router output image) we can infer that the Designated Router or DR must be the router that issued the command (R0), because of the fact that there is no neighbor listed as a DR, only a BDR and two DROTHERs.

     router#show ip route

In the image above, the “show ip route” command has been issued, displaying router R0’s routing table. From the routing table we can tell that the R0 router has two connected networks “c on FastEthernet0/1” and “c on FastEthernet0/0” and that it has learned from OSPF about routes to three additional “o” networks:,, and a “o*E2” candidate default route/gateway of last resort.


OSPF Lab Overview

In this lab, the goal is to set up multiple routers in a multi-access network to observe and control the OSPF DR/BDR election process. The video tutorials below illustrate the process using Packet Tracer to simulate the network environment.


If you have Packet Tracer, and you would like to follow along with the videos, download my Packet Tracer starter file: click here

Video Tutorials

Link-State Routing Protocols

{loadposition adposition4}

Link-State Routing Protocols Overview

Link-State Routing protocols are routing protocols whose algorithms calculate the best paths to networks differently than Distance Vector routing protocols. Whereas Distance Vector protocols know routes by measures of distance and vector(direction) as reported by neighboring routers, Link-State routing protocols calculate their network routes by building a complete topology of the entire network area and then calculating the best path from this topology or map of all the interconnected networks.

{loadposition adposition5}There are two link-state routing protocols, OSPF and IS-IS. The Cisco CCNA curriculum covers the Open Shortest Path First or OSPF link-state routing protocol, and the IS-IS routing protocol is part of the CCNP curriculum.

Link-State Characteristics

  • SPF algorithm – Link-State routing protocols are designed around Dijkstra’s Shortest Path First Algorithm (SPF) in which the shortest path from point A to point B is build around a metric of cost.
  • Cost metric – SPF algorithm finds the shortest path based on a metric network link costs. Each router measures the cost of its own directly connected networks or "links." Cost is a measure of the quality of a link based mostly on bandwidth.
  • Hello packets – Link-State routing protocols establish adjacencies with neighboring routers using hello packets.
  • Link State Packets (LSP) – Initial flooding of link-states to all routers in the network.
  • Topology or SPF Tree – Link-State routing protocols build and maintain a complete map or topology of the network area.   {loadposition adposition6}

Link-State Advantages

  • Faster Convergence – Unlike Distance Vector routing protocols which run algorithm calculations before sending updates, Link-State routing protocols send link-state updates to all routers in the network before running route calculations
  • Triggered Updates – Unlike Distance Vector routing protocols (except EIGRP) which send periodic updates at regular intervals, Link-State routing protocols send LSPs during router startup (flooding) and when a link changes states like going up or down. If their are no changes in the network the protocol only sends hello packets to maintain adjacencies.
  • Scalability – Link-State routing protocols support the ability to configure multiple routing "areas" which allows an administrator to segment a routing protocol processes to defined areas which supports the expansion and troubleshooting of much larger networks.

Link-State Disadvantages

  • Greater Processing Requirements – Link-State routing protocols typically demand greater processing power and memory resources from the router.
  • Greater Administrator Knowledge – Link-State routing protocols can demand advanced administrator knowledge to configure and troubleshoot the network area


{loadposition adposition4}

{loadposition adposition9}