PHPKB Knowledge Base Software Logo  
Guru Corner
Online Knowledgebase System  
Knowledge Base Home Knowledge Base Home
Home > All Categories > Cisco Systems > Routing > OSPF > Configure OSPF in the Cisco IOS
Question Title Configure OSPF in the Cisco IOS

The OSPF dynamic routing protocol is probably the most popular LAN routing protocol today. OSPF can scale to the largest LANs but can also start out small. While OSPF can be complex to configure, its basic configuration isn't difficult. Let's learn how to configure OSPF in the Cisco IOS.

What do you need to know about OSPF?

Before you configure OSPF, there are three things you should know about it first. Here they are:

  1. OSPF stands for open shortest path first. It also uses the SPF (shortest path first) algorithm to determine the best route to its neighbors.
  2. OSPF is a standard routing protocol, as defined by RFC2328 and RFC1247. This means that OSPF can run on just about any company's' routers and OSPF routes from a non-Cisco router can be exchanged with Cisco routers.
  3. The administrative distance for OSPF is 110.
  4. The entire network that OSPF routes for is called an "Autonomous System", or "AS".
  5. All OSPF routing updates must traverse area 0. Because of this, you should carefully design your network before you begin deploying OSPF.

With OSPF, every router has its own unique "picture" (topology map) of the network. Routers use "HELLO" packets to periodically check with routers to ensure they are still there. Every router in OSPF is identified with a "router ID". The router ID can be manually entered or OSPF will automatically choose the IP address with the highest number.

What features does OSPF offer?

OSPF offers the following features that are found in a number of routing protocols:

  • A standards-based routing protocol that works is very interoperable between different vendors routers and firewalls
  • Supports variable length subnet masks (VLSM), making it a classless routing protocols
  • Authentication of routing updates are supported
  • Route redistribution is supported between different routing protocols
  • OSPF works well in point to point and point to multipoint, broadcast or non-broadcast configurations
  • OSPF also offers a number of OSPF-specific features such as stub areas, virtual links, and OSPF on demand circuits.

How do you configure OSPF in the Cisco IOS?

To configure OSPF in the Cisco IOS, just follow these steps:

Set the bandwidth on your interfaces using the bandwidth command
Router (config-if)# bandwidth XX
(where XX signifies the bandwidth of the WAN connection)

Start the OSPF routing process and specify your process number. The process number is an arbitrary number. It is recommended that the number match on all routers but it is not required. The process ID number does not have to be the AS number, although many people confuse that it is.

Router (config)# router ospf {process-ID#}

Next, instruct the router to advertise the networks that are directly linked to it by entering network statments with the area ID number for that network, like this:

Router (config-router)# network {X.X.X.X} {Y.Y.Y.Y} area {z}

In this example, the X.X.X.X is the network id of a network that is linked directly to the router. The Y.Y.Y.Y is the wildcard mask for that network. The wildcard mask is the inverse mask of the subnet mask. The "z" parameter is the area id number. For small networks, this can always be zero (0) but for larger networks, the area IDs need to be properly planned as all routing updates must traverse area 0.

You should enter a network statement for every network directly attached to the router.

Once OSPF is configured, you can check the status using the show ip route and show ip ospf commands.

For more information on configuring OSPF, see the official Cisco OSPF documentation.

Configuration Examples

Here is an example of a router configured with the OSPF routing protocol:

Interface Gigabit Ethernet 0/0
ip address

Interface Serial 3/0
ip address

router(config)# router ospf 1
router(config-router)# network area 0
router(config-router)# network area 0

In Summary

OSPF is the most popular Interior Routing Protocol (IGP) in use today. For that reason alone, it is a dynamic routing protocol that you should be familiar with. I encourage you to spend some time configuring a basic OSPF network to get experience with OSPF.

Authored by: Guru Corner
Click Here to View all the questions in OSPF category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
Article Information Additional Information
Article Number: 7
Created: 2008-08-20 8:11 PM
Rating: No Rating
Article Options Article Options
Print Question Print this Question
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Search Knowledge Base Search Knowledge Base

Powered by Guru Corner