Open Shortest Path First (OSPF)

Introduction

OSPF is an open source Routing protocol that handles routing for IP traffic standardized in IETF RFC2328.

OSPF is classified as an Interior Gateway Protocol (IGP). This means that it distributes routing information between routers belonging to a single Autonomous System. The OSPF protocol is based on link-state or SPF technology.

It was designed mainly for the TCP/IP internet environment. Main focus was to produce a protocol that responds quickly to topology changes, with small amounts of control traffic. OSPF is a dynamic routing protocol.  It quickly detects topological changes in the AS (such as router interface failures) and calculates new loop-free routes after a period of convergence. This period of convergence is short and involves a minimum of routing traffic.

OSPF routes IP packets based solely on the destination IP address found in the IP packet header.  IP packets are routed “as is” — they are not encapsulated in any further protocol headers as they transit the Autonomous System.

OSPF uses Port 89 (IP) for Transport (own transport, not TCP/UDP).

 

 

 


OSPF Attributes (Summary)

 

 


OSPF Router IDs

Every Person/machine/protocol needs an ID in this world & so is the OSPF.

OSPF Router ID (aka Router Identifier) is a 32-bit number (like an IP address) that uniquely identifies this router in the Autonomous System (AS is like a whole world for OSPF).

If a router’s OSPF Router ID is changed, the router’s OSPF software should be restarted before the new Router ID takes effect.

 

Most of Routers (including Cisco) derive the Router ID in one of three ways and with the following precedence order:

  1. Manually configured Router ID
  2. Highest Loopback address
  3. Highest Physical IP address on the router

 

 


OSPF Router types

When whole AS is one area then there Internal & External Routers only.

But when the AS is divided into areas then the routers are further divided according to function into the following four overlapping categories:

 

i. Internal router (IR)

A router that has all its interfaces belonging to the same OSPF area

 

ii. Area border router (ABR)

A router that connects one or more areas to the main backbone network

 

iii. Backbone router (BR)

A backbone router has an interface to the backbone area

 

iv. Autonomous system boundary router (ASBR)

An autonomous system boundary router is a router that is connected by using more than one routing protocol and that exchanges routing information with routers autonomous systems.

 

 


DR & BDR in OSPF

Problems (without DR): When multiple OSPF routers are connected to a multi-access medium the networks, there are two problems that arise:

Problem1: High Number of Adjacencies (A large number of adjecancies is required as in fig below)

Problem2: LSA flooding (Traffic increases exponentially because every router needs to flood its information to all other routers in the OSPF domain & for every LSA sent out there must be an acknowledgement sent back. It wastes a lot of BW)

 

Solution (with DR): To resolve these problems & control the un-necessary flooding of information, DR/BDR solution was proposed. With DR/BDR solution,

  •    Adjacencies are formed with DR/BDR only.
  •    All routers send LSA’s to DR only, DR sends out LSA’s to all other Routers.

 

Designated Router (DR) reduces the network traffic significantly. DR’s reduce network traffic as only they maintain the complete ospf database and then send updates to the other routers on the shared network segment.

Backup Designated Router (BDR) is simply a backup/standby of the DR. If DR fails then BDR takes its position.

 

DR/BDR Election Process

DR is chosen in below order:

 – Highest OSPF priority (default priority is 1), if all are equal then:

 – Highest OSPF Router ID, then

 Highest loopback interface, then

 Highest physical interface (should be up/up)

 

Then Router with the second preference in above list becomes the BDR.

 

 

Important Points about DR/BDR:

 

 

DR/BDR elections DO NOT occur in point to point networks

 

 

In DR/BDR, there is no preemption. Meaning that when a DR goes ofline, the BDR takes his place and when it comes back online it wont be the DR again, for it to be considered for another election process in a network segment, all DR/BDR must go offline so that one router can become the DR again for that segment.

 

 


OSPF Metric (Cost)

Every protocol uses some calculations (metrics) to judge a path’s feasibility (when multiple paths exist to for same destination). OSPF uses cost as metric for this purpose.

Logically a packet will face more overhead in crossing a 56Kbps serial link than crossing a 100Mbps Ethernet link. Respectively it will take less time in crossing a higher bandwidth link than a lower bandwidth link. OSPF uses this logic to calculate the cost. Cost is the inverse proportional of bandwidth. Higher bandwidth has a lower cost. Lower bandwidth has a higher cost.

To calculate cost, we have to use some reference Bandwidth to calculate cost. Reference Bandwidth for OSPF is 100 Mbps for cost calculation. The best route will have the lowest cost. Reference bandwidth defaults to 100Mbps (10^8) & can be modified with command.

 

Formula to calculate OSPF Cost:

 

Below is the table for reference Bandwidth:

 


 

Written by 

Waqas Karim is a seasoned Network Expert … Geek. He is the founder of ATech. ATech was started for learning & sharing. Over time the platform has grown to include other resources which continue to attract fellow networkers. Today it sees upward trend of a hundred thousand visitors per month, scattered all over the globe. His specialty is networking, but his interest & expertise spans from traditional IT to Network Security including Programming, Virtualization, Service Provider & so on... no matter the badge on the box. He is CCIE Certified (CCIE#56732) in addition to below badges: Telecom Engineer (BE) + CCIE-RS (CCIE#56732) + Huawei Certified (HW#706632) + MBA Microsoft Certified MCITP, MCSE#109*26, CCNP-Sec, CCNP-SP, CCNA-DC, CompTIA Security+, Nokia NRS-I, JNCIA, ITIL Certified (ITIL#*6373), CEH (Certified Ethical Hacker).

avatar
16 Comment threads
12 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
12 Comment authors
Oscar SpearStone PeytonNeville NewRelic OlinNorseman Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Relic Olin
Guest
Relic Olin

well … the post is really nice & concise.

If you answer that what is the role of topology and routing table in OSPF?

Liam Jesse
Guest
Liam Jesse

The COST depends on what? Is it only Bandwidth or some other factors as well?

Stone Peyton
Guest
Stone Peyton

Awesome Graphix!!! 🙂

Neville New
Guest
Neville New

Nice Post!!

Oscar Spear
Guest
Oscar Spear

Why is OSPF heavier than any Distance Vector Routing Protocol?

Norseman
Guest
Norseman

How is DR & bDR are selected & which one is selected first?

Triumph Nigel
Guest
Triumph Nigel

Can we have BR & IR roles on the same Router in one ospf area?

Murray Nathaniel
Guest
Murray Nathaniel

The port 89 of OSPF is TCP or UDP Port?

Ezran Elis
Guest
Ezran Elis

What are the roles of 224.0.0.5 and 224.0.0.6 in OSPF messages. I have tried many forums but I cannot find any satisfaction level answer?

Kai Albie
Guest
Kai Albie

What is recommended/optimal range of no. of OSPF areas on a router?

misteryes
Guest
misteryes

OK I got it, thanks.
one more question, if a router boarders 2 areas but neither area is area 0 is it still an ABR?

misteryes
Guest
misteryes

What happens if DR and BDRs are elected in an area of Ethernet segment and the area has a combination of both p2p and p2mp links?

Vikas R Shety
Guest
Vikas R Shety

Bravo!

Mjaryan
Guest
Mjaryan

If ABR and ASBR roles are on the same Router then what difference they have?

shivlu
Guest
shivlu

Long time back, I also wrote a post on OSPF considerations: http://www.mplsvpn.info/2009/01/ospf-design-consideration.html

But your post is simply awesome!!!

Bob Mars
Guest
Bob Mars

Still very helpful, following you from almost a year.

Going to have to rethink some of our OSPF concepts.

Thank you for this post.