Menu
OSPF (Open Shortest Path First) Protocol by By Siby T. R

The Open Shortest Path First (OSPF) protocol is a link state protocol that handles routing for IP traffic. Because it is based on an open standard, OSPF is very popular in many corporate networks today and has many advantages, including these:

It will run on most routers, since it is based on an open standard.
It uses the SPF algorithm, developed by Dijkstra, to provide a loop-free topology.
It provides fast convergence with triggered, incremental updates via Link State Advertisements (LSAs).
It is a classless protocol and allows for a hierarchical design with VLSM and route summarization.

What is Convergence?

A router that stores a database, called a routing table, of the network addresses of network devices and the most efficient routes to them. Each router independently runs a routing algorithm to calculate metrics and build a routing table based on this information. In dynamic routing, routing tables are created dynamically by obtaining the network information from other routers. When a new addresses is added, updates are sent to routers across the network that describe changes in the network topology. When all of the routers agree this is called convergence.

What is VLSM?

Variable Length Subnet Mask (VLSM) is a network design strategy where subnet masks can have varying sizes. This enables network designers to use multiple masks for different subnets of a single class. With VLSM a network address space can be divided into a hierarchy of subnets with different sizes.

Given its advantages, OSPF does have its share of disadvantages:

OSPF maintains three types of tables. So it requires more memory to hold the adjacency (list of OSPF neighbors), topology (a link state database containing all of the routers and their routes), and routing tables.
It requires extra CPU processing to run the SPF algorithm, which is especially true when you first turn on your routers and they are initially building the adjacency and topology tables.
For large networks, it requires careful design to break up the network into an appropriate hierarchical design by separating routers into different areas.
It is complex to configure and more difficult to troubleshoot.

Hierarchical Design: Areas

Areas are used to provide hierarchical routing. Basically, areas are used to control when and how much routing information is shared across your network. In flat network designs, such as IP RIP, if a change occurs on one router, perhaps a flapping route problem, it affects every router in the entire network. With a correctly designed hierarchical network, these changes can be contained within a single area. OSPF implements a two-layer hierarchy: the backbone (area 0) and areas off of the backbone. Through a correct IP addressing design, you should be able to summarize routing information between areas. By performing this summarization, the routers have a smaller topology database (they know only about links in their own area and the summarized routes) and their routing tables are smaller (they know only about their own area's routes and the summarized routes).

What is a Network Backbone?

A network backbone is a high-speed cable that ties together networks that may be on different floors of a building or networks that are in different buildings in a campus. A backbone may use fibre optic cable, while the networks connected by the backbone use STP (Shielded Twisted Pair) cable, sometimes refered to as horizontal cabling. A network backbone may use high-speed wireless connectivity.

Metric Structure

Unlike RIP, which uses hop count as a metric, OSPF uses cost. Cost is actually the inverse of the bandwidth of a link: the faster the speed of the connection, the lower the cost. The most preferred path is the one with the lowest cost. By using cost as a metric, OSPF will choose more intelligent paths than RIP. OSPF supports load balancing of up to six equal-cost paths to a single destination. The default measurement that Cisco uses in calculating the cost metric is: cost = 10^8/(interface bandwidth).

Router Identities

Each router in an OSPF network needs a unique ID. The ID is used to provide a unique identity to the OSPF router. This is included in any OSPF messages the router generates. The router ID is chosen according to one of the two following criteria:

The highest IP address on its loop back interfaces (this is a logical interface on a router)
The highest IP address on its active interfaces

It is highly recommended that you use a loop back interface because it is always up and thus the router can obtain a router ID.

Finding Neighbors

OSPF learns about its neighbors and builds its adjacency and topology tables by sharing LSAs. There are different types of LSAs. When learning about the neighbors that a router is connected to, as well as keeping tabs on known neighbors, OSPF routers will generate hello LSAs every 10 seconds. When a neighbor is discovered and an adjacency is formed with the neighbor, a router expects to see hello messages from the neighbor. If a neighbor is not seen within the dead interval time, which defaults to 40 seconds, the neighbor is declared dead. When this occurs, the router will advertise this information, via an LSA message, to other neighboring OSPF routers. In order for two routers to become neighbors, the following must match on each router:

The area number and its type
The hello and dead interval timers

Let's assume that you turned on all your routers simultaneously on a segment. In this case, the OSPF routers will go through three states called the exchange process:

1. Down state the new router has not exchanged any OSPF information with any other router.
2. Init state A destination router has received a new router's hello and adds it to its neighbor list (assuming that certain values match). Note that communication is only unidirectional at this point.
3. Two-Way state the new router receives a unidirectional reply to its initial hello packet and adds the destination router to its neighbor database. Once the routers have entered a two-way state, they are considered neighbors. At this point, an election process takes place to elect the designated router (DR) and the backup designated router (BDR).

Designated and Backup Designated Routers

An OSPF router will not form adjacencies to just any router. Instead, a client/server design is implemented in OSPF. For each network multi-access segment, there is a DR and a BDR as well as other routers. When an OSPF router comes up, it forms adjacencies with the DR and the BDR on each multi-access segment that it is connected to. Any exchange of routing information is between these DR/BDR routers and the other OSPF neighbors on a segment (and vice versa). An OSPF router talks to a DR using the IP multicast address of 224.0.0.6. The DR and the BDR talk to all routers using the 224.0.0.5 multicast IP address.

The OSPF router with the highest priority becomes the DR for the segment. If there is a tie, the router with the highest router ID will become the DR. By default, all routers have a priority of 1 (priorities can range 0-255). If the DR fails, the BDR is promoted to DR and another router is elected as the BDR. OSPF uses incremental updates. This means that whenever changes take place, only the change is shared with the DR, which will then share this information with other routers on the segment. OSPF routers share information about their connected routes with the DR, which includes the link-state type, the ID of the advertising router, the cost of the advertised link, and the sequence number of the link.

Configuring OSPF

Router(config)# router ospf process_ID
Router(config-router)# network IP_address wildcard_mask area area_#

Note that process ID do not need to match between different routers and that they have nothing to do with autonomous system numbers.

A wildcard mask is 32 bits in length. A 0 in a bit position means there must be a match, and a 1 in a bit position means the router doesn't care. Actually, a wildcard mask is an inverted subnet mask, with the 1's and 0's switched.

Class A: 0.255.255.255.255
Class B: 0.0.255.255
Class C: 0.0.0.255

Loopback Interfaces

A loopback interface is a logical, virtual interface on a router. By default, the router doesn't have any loopback interfaces, but they can easily be created. Here are some reasons you might want to create a loopback interface:

To assign a router ID to an OSPF router
To use for testing purposes, since this interface is always up

To create a loopback interface, use the following command:

Router(config)# interface loopback port_#
Router(config-if)# ip address IP_address subnet_mask

Troubleshooting OSPF

show ip protocols
show ip route
show ip ospf interface
show ip ospf neighbor
debug ip ospf adj
debug ip ospf events
debug ip ospf packet


Siby.T.R I am a free lance technical consultant I am interested to learn and publish my thoughts in ccna and system administration side. I hope you will be enjoying my articles if you are a technical person or a technical student or willing to accept technical things. Thanks and Regards Siby


Learn more at amazon.com

More Networking Protocols and Standards:
• IGRP (Interior Gateway Routing Protocol)
• PoE (Power Over Ethernet)
• What's the Difference Between a Packet and a Frame?
• Evolution of the Microsoft NOS (Active Directory)
• X.25 and Frame Relay Overview
• Video - The Upper Layers 5 Through 7 of the OSI Networking Model
• Internet Protocol versions IPv4, IPv5 and IPv6
• Protocol Suites
• Major Protocols in the TCP/IP Suite
• Kerberos Authentication Protocol