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 126.96.36.199 ( all routers) and 188.8.131.52( 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.
- The highest IP address of the active Physical interface of the router becomes the Router ID
- If a logical interface is configured (loopback), then the highest IP address of the logical interface becomes the router ID.
- If we specify the Router-ID manually then it takes priority over all and become the Router-ID.
As per the figure, the logical interface loop back 0 interfaces become the Router ID.
To manually configure a Router-ID
OSPF maintains three tables
- 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’.
- 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.
- 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:
- Transit Area ( backbone or Area 0)
- Regular Area ( non-backbone area)
To avoid this OSPF can make use of the multi-area design.
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
- 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.
- Area Border Router (ABRs): The router that contains interfaces in more than one area. Router 2 and Router 4
- Backbone Router: The router that has all or at least one interface in Area 0. Router 3, Router 2 and Router 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.
4. 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.
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.
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.
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.
- Hello: to build and maintain neighbor relationship or adjacencies and as keepalives.
- DBD – Database Descriptor: Used to verify if the LSDB between two routers is same. It is a summary of the Link State Database (LSDB)
- Link State Request (LSR): Any request made to other routers for some information is using this packet.
- Link State Update (LSU): Contains the information requested in the LSR.
- 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
– Network Type ( broadcast, point-to-point, etc)
The cost of OSPF is: Cost = 100Mbps / Bandwidth
Let’s configure OSPF on the devices. Consider the below topology
Now let us configure OSPF on the devices and establish connectivity.
Now that we have configured OSPF, Let us try to ping the other network and see if they are reachable.
The show ip protocols command will give us good information about the protocol OSPF
Neighbor Table looks like below:
- Routing and Routing Protocols
- Routing, Static Routing, Dynamic Routing
- Default Route and Static Routes Configuration