Cisco Routing Study Guide: Configuring OSPF in a Single Area

- select the contributor at the end of the page -
OSPF stands for Open Shortest Path First and it represents a routing protocol belonging to the group of link-state routing protocols.

OSPF routing protocol is classified among the best dynamic protocols that exist in networks today. It is also considered to be a sophisticated routing protocol that aims to maintain loop-free and accurate routing tables.

Today, we'll go over the necessary commands that are needed to enable the OSPF routing protocol, define OSPF networks, configure advanced options, and more. We'll also look at how and why OSPF is used.

Let's get started by taking a look at some

Unlike distance vector protocols, link-state routing protocols, and specifically OSPF, hold the following key points:

    • Information about its neighbors (local connectivity) is sent to the entire network using multicasting

 

    • The entire routing table is transmitted once every 30 minutes

 

    • Link-state updates (LSAs) are transmitted when there is a change in the state of the links

 

    • HELLO messages are used to maintain adjacent neighbors

 

    • Is a classless routing protocol which uses VLSM and both manual and automatic summarization

 

    • Uses COST as a metric which CISCO defines as the inverse of the bandwidth

 

  • AREA terminology is created to provide a hierarchical structure and limit the multicast LSAs within routers of the same area -- the default or otherwise core area is area 0 and all other areas connect directly to it

Based on OSPF LSAs, each router constructs a topology table which contains every connection link within the network. Then, the Dijkstra algorithm runs over the topology table to find the shortest path to every other router, and hence creates the routing table.

This algorithm, which is also known as the SPF algorithm, runs on every OSPF enabled router on the network, and routers within a particular area all have the same topology tree of the specific area.

Enabling the OSPF Routing Protocol

The following command is needed in order to enable OSPF routing protocol on the router:

  • Router(config)#router ospf process-number

The process-number is nothing more than a number local to the router. It's only used to distinguish processes within a router and can be given an arbitrary value. This value does not have to be the same on every router within the area. However, it is always good practice to keep this number the same for better administration.

 

Defining OSPF Networks

Enabling OSPF is not enough to activate it. The OSPF process needs to know the networks that are going to be advertised (i.e. the interfaces on which OSPF will run) and the area they reside in. Therefore the following command is needed to make OSPF operational:

  • Router(config-router)#network address wildcard-mask area area-number

The address can be the network address, subnet, or the address of a specific interface.

The network command is used to identify the interfaces on the router that are going to participate in the OSPF process. Adjacencies will be created with these interfaces and LSAs will be received and transmitted on these interfaces.

Therefore the wildcard-mask parameter needs to be defined for accurately identifying the necessary interfaces.

The wildcard-mask consists of 4 groups of 8-bits each. Each 0 bit indicates a "must" and each 1 bit indicates an "any". This will become clearer in the next section on Defining OSPF Networks Examples.

The area-number specifies the area to be associated with the specific address and consequently the interfaces to be grouped within that area.

By default, area 0 is used; if more than one area is to be created in a network, area 0 is the first one that needs to be defined.

 

Defining OSPF Networks Examples

The schematic diagram below illustrates how a single command is able to cover all router interfaces and also how individual interfaces can be specified.

OSPF Network Command Example

In the diagram above, RouterA has 3 interfaces, one in the 192.168.7.0 subnet, one in the 192.168.8.0 subnet and the other in the 172.16.1.0. The following command configures all interfaces to participate in OSPF area 0:

  • Router(config-router)#network 0.0.0.0 255.255.255.255 area 0

The following command will force only interfaces addressed from 192.168.0.0 to participate in OSPF:

  • Router(config-router)#network 192.168.0.0 0.0.255.255 area 0

The following command specifically forces the serial interface to participate in OSPF area 0:

  • Router(config-router)#network 172.16.1.1 0.0.0.0 area 0

 

Configuring Advanced Options

A few advanced options can be useful in administrating OSPF, though they are not necessary for OSPFs normal operation. These options include:

  • Configuring a loopback interface
  • Specifying the router ID (RID)
  • Manipulating the cost command
  • Changing the routers priority

 

Configuring a Loopback Interface

The source of Link-state Advertisements in a given area is identified by the RID. This ID has the form of an IP address and can be automatically or manually defined.

 

Automatic selection of RID

If no manual RID is specified, then the RID is taken from the highest IP address assigned to a loopback interface. If no loopback interface is defined, then the highest IP address of an active interface is chosen as the RID.

It is wise to configure a loopback interface on the router because this kind of interface is a virtual one that can never go down; hence the RID will never have to change. The following commands define and configure a loopback interface:

  • Router(config)#interface loopback interface-number
  • Router(config-if)#ip address ip-address subnet-mask

 

Manual Configuration of RID

This is the preferred method of defining the RID. Any unique IP address can be defined as RID and it never changes even if the interface that the router is using for the RID goes down.

Even when a manual configuration change of the RID is performed, this does not take effect until the next router reload or OSPF routing restart.

The following commands show how to manually configure the RID. The clear ip ospf process command is used to activate the RID on a router that is already running OSPF:

  • Router(config)#router ospf process-number
  • Router(config-router)#router-id ip-address
  • Router#clear ip ospf process

 

Configuring the Cost of an Interface

As already mentioned, the OSPF process assigns cost values to interfaces based on the inverse of the bandwidth parameter assigned to the interface with the bandwidth command.

For calculating the SPF to a given destination, the router takes into consideration the costs of the links along various paths. The path with the lower cost is selected as the shortest path.

To force the router to pick up a certain path, manual setting of the cost on a link along the path can be achieved using the following command:

  • Router(config-if)#ip ospf cost cost

 

Setting Priority for the Selection of the Designated Router

In multi-access networks the router with the highest priority value is chosen as the DR which acts as the central point of LSAs exchange.

The priority command is assigned on an interface. Default priority for an OSPF interface is 1. The range is from 0 to 255. 0 means that the interface does not involve in the DR election.

The following command configures a priority value on an interface.

  • Router(config)#interface interface-number
  • Router(config-if)#ip ospf priority priority-value

 

Why Use OSPF?

As I mentioned at the beginning, OSPF routing protocol is classified among the best dynamic protocols existing in networks today. It has all the necessary features of an interior gateway routing protocol:

  • Scalability
  • Adaptability to topology changes
  • Topology awareness within its operation area

OSPF uses multicasting so that each router informs all other routers in the area of its neighbors and costs. This information allows each router to build a complete topological tree consisting of routers and omnidirectional links connecting them together. Each of these links carries a cost value.

SPF algorithm runs over this topology tree and computes the shortest path from every router to every other router in the area. The results from SPF algorithm construct the router's routing table.

 

Master Routing and More with Cisco Certification Training!

Cisco Certification TrainingGet the training you need to pass your certification exams and be on your way to a successful career in Cisco networking.

We provide the tools you need to succeed! Our training includes comprehensive practice exam questions and real world training that's taught by an expert with years of experience.

Find out more about Cisco Certification Training today!

Ready to test your skills in CISCO? See how they stack up with this assessment from Smarterer. Start this CISCO test now

Get our content first. In your inbox.

Loading form...

If this message remains, it may be due to cookies being disabled or to an ad blocker.

Contributor

Stelios Antoniou

Stelios Antoniou holds a BSc in Electronic Engineering and an MSc in Communication Networks. He has over three years of experience in teaching MS Office applications, networking courses and GCE courses in Information Technology. Stelios is currently working as a VoIP Engineer in a Telecom company, where he uses his knowledge in practice. He has successfully completed training on CCNP topics, Linux and IMS. His enthusiasm, ambition and knowledge motivate him to offer his best. Stelios has written many articles covering Cisco CCENT, CCNA, and CCNP.