OSPF

OSPF – Open Shortest Path First

This article explains how to configure Open Shortest Path First Configuration (OSPF). In this tutorial you will learn OSPF commands, states and OSPF authentication.

It is a Dynamic routing protocol which works on the Link state algorithm. It stands for Open Shortest Path First. Link state protocols will create a complete of the network which is helpful in choosing paths more accurately.

Below is some information about OSPF:

-         Open standard Protocol
-         It is a Link state Protocol
-         It uses the Dijkstra shortest Path algorithm (construct a shortest path tree and then populate the routing table with best routes)
-         No limit on hop count
-         Metric is cost ( cost = 10^8 / Bandwidth)
-         Administrative distance is 110
-         It is a Classless Routing Protocol
-         Support VLSM and CIDR
-         Supports only IP routing
-         Supports only Equal cost load-balancing
-         Uses the concept of Areas for easy management, hierarchical design
-         Must have one area as Area 0, which is called backbone area
-         All other areas must connect to this Area 0
-         Scalability is better than of Distance Vector Routing Protocols
-         Supports authentication
-         Update are sent through multicast address 224.0.0.5 ( all routers)  and 224.0.0.6( all Designated Routers)
-         Faster convergence
-         Sends Hello packets every 10 seconds
-         Triggered / Incremental updates : Sends update when change triggers in network and sends only information about the change not complete routing table, LSAs are sent when change occurs and only about the change.
-         LSAs refresh every 30 minutes
-         Forms neighbors with adjacent routers in same area
-         LSAs used to advertises directly connected links

OSPF Router ID

Router ID is a unique ID used to identify the OSPF router. There are different ways in which it can be identified.

  1. The highest IP address of the active Physical interface of the router becomes the Router ID
  2. If a logical interface is configured (loopback), then the highest IP address of the logical interface becomes the router ID.
  3. If we specify the Router-ID manually then it takes priority over all and become the Router-ID.

OSPF Router ID

As per the figure, the logical interface loop back 0 interfaces become the Router ID.

To manually configure a Router-ID

Router IDOSPF Tables

OSPF maintains three tables 

  1. Neighbor Table: Contains the list of directly connected neighbors (Routers). It is also known as the Adjacency database. Can be seen using the command ‘show ip ospf neighbors’.
  2. Database Table: Commonly known as the Link state Database (LSDB). All possible routes to any network in the same area are contained in this table.
  3. Routing Table: The best paths to reach each destination. The routing table can be seen using the ‘show ip route’ command.

All the routers in OSPF have a common database.

OSPF supports hierarchical design and this uses the concept of Areas. The two level of hierarchy consist of:

  1. Transit Area ( backbone or Area 0)
  2. Regular Area ( non-backbone area)

AreaIf OSPF has only one area put too much of burden on SPF calculations, Memory issues due to huge Routing tables.

To avoid this OSPF can make use of the multi-area design.

Autonomous system

If we use multi-area we divide the computations and update being shared to the routers. You must have noted that we have Area 0, Area 1 and Area 2 and must have seen Area 0 is an important part as both other areas connect to Area 0. If Area 1 and Area 2 need to communicate, they have to make use of Area 0. (Backbone Area).

The hierarchical design, reduces routing overhead, speeds up convergence and most important if any network instability, it is limit to the specific area.

Diving the design in different areas create complexity in configuring OSPF routers.

Types of OSPF routers

There are several types of OSPF Routers

Types of OSPF routers

  1. Internal Router: The router for which all its interface belong to one area.  Router 1 and Router 5. These routers have a Single Link state database.
  2. Area Border Router (ABRs): The router that contains interfaces in more than one area. Router 2 and Router 4
  3. Backbone Router: The router that has all or at least one interface in Area 0. Router 3, Router 2 and Router 4.
  4. Autonomous System Boundary Router (ASBR): The routers with connection to a separate autonomous system. R4 in the example is connected to EIGRP.

Advantages of OSPF

-         Open Standard this can be used by all vendors
-         No limitations for hop count
-         Provides a loop free network
-         Provides faster convergence

Disadvantages of OSPF

-         More CPU intensive, uses more CPU resources
-         Design and Implementation is complex
-         It only supports Equal cost load-balancing
-         Only Supports IP and not others like IPX or Apple Talk

OSPF 7 Stage Process

The neighbor formation process in OSPF occurs in 7 stages:

1. DOWN State: After OSPF is configured, Router A will send HELLO Packets and as Router A does not know about any other routers it is in DOWN State.

DOWN State: 2. INIT State: Router B receives the HELLO and adds it to its neighbor table and is not in INIT state.

INIT State: 3. 2-WAY State: Router B, will send a unicast as response to Router A. As Router A receives the packet, it sees its name in the HELLO packet as a neighbor and here we are in 2-WAY State.

2-WAY State4. Exstart State: In case of multi-access network, a DR (Designated Router) and BDR (Backup Designated Router) need to be elected by OSPF. In Exstart State DBs are Synced and Master and Slave role is decided. Higher Router ID becomes Master and starts Exchange.

Exstart State

5. Exchange State: In this the LSDBs are synchronized and exchanged. The Master sends it first and both populate the networks that they don’t know.

Exchange State

6. Loading State: Here LSAcks are sent for acknowledging the DBDs. While comparing if a neighbor has newer information it is requested using LSR. While LSR is being sent the device is in LOADING State. The other routers send the info in LSU.

Loading State

7. Full State: When the requested info is provided using LSU and when the LSAck is received to Finish. We are considered to be in FULL State.

Full StateOSPF Packet Types

  1. Hello: to build and maintain neighbor relationship or adjacencies and as keepalives. 
  2. DBD – Database Descriptor: Used to verify if the LSDB between two routers is same. It is a summary of the Link State Database (LSDB) 
  3. Link State Request (LSR): Any request made to other routers for some information is using this packet. 
  4. Link State Update (LSU): Contains the information requested in the LSR. 
  5. Links State Acknowledgement (LSAck): Acknowledgement for all the OSPF packets except the Hello packet.

Hellos are the keepalives for OSPF. If a Hello is not received in 4 Hello periods, then the neighbor is considered Dead. 4 Hello Periods = Dead Time. The hello and dead timers are as follows:

-         LAN and point-to-point interfaces : Hello 10 seconds , Dead timer 40 seconds
-         Non-broadcast Multi-access (NBMA) interfaces: Hello 30 seconds, Dead timer120 seconds

Parameters to match to become neighbors

For two or more OSPF routers to become neighbors there are some parameters that need to match / be identical:

-         Area ID
-         Area Type ( NSSA, Stub)
-         Subnet Mask
-         Hello Interval
-         Dead Interval
-         Prefix
-         Network Type ( broadcast, point-to-point, etc)
-         Authentication

OSPF Metric

The cost of OSPF is: Cost = 100Mbps / Bandwidth

Configure OSPF

Let’s configure OSPF on the devices. Consider the below topology

Configure OSPFIf we check the routing table of each router, we see the directly connected routes in the routing table.

Router_A

Router_ARouter_B

Router_B

Router_C

Router_CFrom PC 1 in network 192.168.1.0, if we try to ping other devices we are not able to reach them.

PC 1 in network 192.168.1.0

Now let us configure OSPF on the devices and establish connectivity.

Router_A

OSPF Router_ARouter_B

Router_BRouter_C

Router_CWe will check routing table of one of the routers to see how it looks.

routing table We see the OSPF routes marked as ‘O’.

Now that we have configured OSPF, Let us try to ping the other network and see if they are reachable.

configured OSPF

The show ip protocols command will give us good information about the protocol OSPF

show ip protocols command

Neighbor Table looks like below:

Neighbor Table looks like belowTopology Table looks like below:

Topology Table looks like below

Read more

    Free Cisco CCNA Study Guide

Search

Shortcodes Ultimate

 
Follow Us
 
BGP