Open Shortest Path First (OSPF)

Open Shortest Path First (OSPF). It is an open standard routing protocol that’s been implemented by a wide variety of network vendors. By using the Dijkstra algorithm. A shortest path tree is constructed, and then the routing table is populated with the resulting best paths.

OSPF provides the following features:

  1. Consists of areas and autonomous systems
  2. Minimizes routing update traffic
  3. Allows scalability
  4. Supports VLSM/CIDR
  5. Has unlimited hop count
  6. Allows multi-vendor deployment (open standard)

OSPF Terminology

  • 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

    TheRouter 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 LinkState 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.
    LSA packets are used to update and maintain the topological database.
  • 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
  • Backup designated router

    A Backup Designated Router (BDR)is a hot standby for the DR on multi-access links. 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.DR and BDR are elected on broadcast and non-broadcast multi-access networks.
  • 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-multi point

    Point-to-multi point 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-multi point 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.
  • SPF Tree Calculation 

    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 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. 

    Cisco uses a simple equation of 10/bandwidth. The bandwidth is the configured bandwidth for the interface. Using this rule, a 100Mbps Fast Ethernet interface would have a default OSPF cost of1 and a 10Mbps Ethernet interface would have a cost of 10.

Configuring OSPF

These two elements are the basic elements of OSPF configuration:

  • Enabling OSPF

    The easiest and also least scalable way to configure OSPF is to just use a single area. Doing this requires a minimum of two commands.
    The command you use to activate the OSPF routing process is as follows:

    Lab_A(config)#router ospf ?
    < 1-65535 >

    A value in the range 1–65,535 identifies the OSPF Process ID.

    Process ID:-It’s a unique number on thisrouter that groups a series of OSPF configuration commands under a specific running process.Different OSPF routers don’t have to use the same Process ID in order to communicate. It’spurely a local value that essentially has little meaning, but it cannot start at 0; it has to startat a minimum of 1.
  • Configuring OSPF Areas

    After identifying the OSPF process, you need to identify the interfaces that you want to activate. OSPF communications on as well as the area in which each resides. This will also configure the networks you’re going to advertise to others. OSPF uses wild cards in the configuration.

    Here’s an OSPF basic configuration example for you:
    Lab_A#config t
    Lab_A(config)#router ospf 1
    Lab_A(config-router)#network ?
    < 0-4294967295 >  OSPF area ID as a decimal value
    A.B.C.D         OSPF area ID in IP address format
    Lab_A(config-router)#network 0
    OSPF DR and BDR Elections


    Routers that share a common segment become neighbors on that segment. These neighbors are elected via the Hello protocol. Hello packets are sent periodically out of each interface using IP multi-cast.Two routers won’t become neighbors unless they agree on the following:

    Area ID

    The idea here is that the two routers’ interfaces have to belong to the same area on a particular segment. And of course, those interfaces have to belong to the same subnet.


    OSPF allows for the configuration of a password for a specific area. Although authentication between routers isn’t required, you have the option to set it if you need to do so.Also, keep in mind that in order for routers to become neighbors, they need to have the same password on a segment if you’re using authentication.

    Hello and Dead intervals

    OSPF exchanges Hello packets on each segment. This is a keep alive system used by routers to acknowledge their existence on a segment and for electing a designated router (DR) on both broadcast and non-broadcast multi-access segments.The Hello interval specifies the number of seconds between Hello packets. The Dead interval is the number of seconds that a router’s Hello packets can go without being seen before its neighbors declare the OSPF router dead (down). OSPF requires these intervals to be exactly the same between two neighbors. If any of these intervals are different, the routers won’t become neighbors on that segment. You can see these timers with the show ip ospf interface command.


    In the election process, adjacency is the next step after the neighboring process. Adjacent routers are routers that go beyond the simple Hello exchange and proceed into the database exchange process. In order to minimize the amount of information exchanged on a particular segment, OSPF elects one router to be a designated router (DR) and one router to be a backup designated router (BDR) on each multi-access segment.The BDR is elected as a backup router in case the DR goes down. The idea behind this is that routers have a central point of contact for information exchange. Instead of each router exchanging updates with every other router on the segment, every router exchanges information with the DR and BDR. The DR and BDR then relay the information to everybody else.

    DR and BDR Elections

    On a broadcast or non-broadcast multi-access network, the router with the highest OSPF priority on a segment will become the DR for that segment. This priority is shown with the show ip ospf interface command, which is set to 1 by default. If all routers have the default priority set,the router with the highest Router ID (RID).

    If you set a router’s interface to a priority value of zero, that router won’t participate in the DR or BDR election on that interface. The state of the interface with priority zero will then be DROTHER.

    OSPF and Loopback Interfaces

    Configuring loopback interfaces when using the OSPF routing protocol is important, and Cisco suggests using them whenever you configure OSPF on a router.

    Loopback interfaces

    are logical interfaces, which are virtual, software-only interfaces; they are not real router interfaces. Using loopback interfaces with your OSPF configuration ensures that an interface is always active for OSPF processes. hey can be used for diagnostic purposes as well as OSPF configuration. The reason you want to configure a loopback interface on a router is because if you don’t, the highest IP address on a router will become that router’s RID. The RID is used to advertise the routes as well as elect the DR and BDR.

    By default, OSPF uses the highest IP address on any active interface at the moment of OSPF startup. However, this can be overridden by a logical interface. The highest IP address of any logical interface will always become a router’s RID.

    In the following sections, you will see how to configure loopback interfaces and how to verify loopback addresses and RIDs.

h4 ExamMATE

Online Personalised Exam Preparation Tool to score higher using Assessment, Analytics & Artificial Intelligence

Copyright ©2015, All Rights Reserved. h4 ExamMATE™ is registered trademark of Hub4tech Portal Services Pvt. Ltd.
All trademarks and logos appearing on this website are the property of their respective owners.
Need help? Ask h4 ExamMATE Bot